From: Christian Lamparter Date: Sat, 16 Oct 2010 16:42:35 +0000 (+0200) Subject: carl9170 firmware: introduce __aligned compiler attribute v2 X-Git-Tag: 1.9.1~10 X-Git-Url: https://jxself.org/git/?p=carl9170fw.git;a=commitdiff_plain;h=63ea5c984f577172a145950580c96b5135bf1629 carl9170 firmware: introduce __aligned compiler attribute v2 This patch reduces the firmware image size considerably. Signed-off-by: Christian Lamparter --- diff --git a/carlfw/include/dma.h b/carlfw/include/dma.h index 0f45e51..ea905f5 100644 --- a/carlfw/include/dma.h +++ b/carlfw/include/dma.h @@ -44,7 +44,7 @@ struct dma_desc { void *dataAddr; } __packed; struct dma_desc *nextAddr; /* Next TD address */ -} __packed; +} __packed __aligned(4); /* (Up, Dn, 5x Tx, Rx), USB Int, (5x delayed Tx + retry), CAB, BA */ #define AR9170_TERMINATOR_NUMBER_B 8 @@ -169,8 +169,8 @@ struct ar9170_data_block { struct ar9170_dma_memory { struct dma_desc terminator[AR9170_TERMINATOR_NUMBER]; struct dma_desc block[AR9170_BLOCK_NUMBER]; - struct ar9170_data_block data[AR9170_BLOCK_NUMBER] __attribute__((aligned(BLOCK_ALIGNMENT))); - struct carl9170_sram_reserved reserved __attribute__((aligned(BLOCK_ALIGNMENT))); + struct ar9170_data_block data[AR9170_BLOCK_NUMBER] __aligned(BLOCK_ALIGNMENT); + struct carl9170_sram_reserved reserved __aligned(BLOCK_ALIGNMENT); }; extern struct ar9170_dma_memory dma_mem; diff --git a/include/linux/compiler.h b/include/linux/compiler.h index ec4edf7..f6f1444 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -25,6 +25,7 @@ #define __unused __attribute__((unused)) #define __force __attribute__((force)) #define __section(s) __attribute__((section("." # s))) +#define __aligned(a) __attribute__((aligned(a))) #define __packed __attribute__((packed)) #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index c0cde48..8abd5d5 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h @@ -799,7 +799,7 @@ struct ieee80211_bar { __u8 ta[6]; __le16 control; __le16 start_seq_num; -} __attribute__((packed)); +} __attribute__((packed)) __aligned(4); /* 802.11 BA(R) control masks */ #define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000 diff --git a/include/shared/fwcmd.h b/include/shared/fwcmd.h index d552166..6bd374a 100644 --- a/include/shared/fwcmd.h +++ b/include/shared/fwcmd.h @@ -97,13 +97,13 @@ struct carl9170_set_key_cmd { __le16 type; u8 macAddr[6]; u32 key[4]; -} __packed; +} __packed __aligned(4); #define CARL9170_SET_KEY_CMD_SIZE 28 struct carl9170_disable_key_cmd { __le16 user; __le16 padding; -} __packed; +} __packed __aligned(4); #define CARL9170_DISABLE_KEY_CMD_SIZE 4 struct carl9170_u32_list { @@ -206,7 +206,7 @@ struct carl9170_cmd { struct carl9170_rx_filter_cmd rx_filter; u8 data[CARL9170_MAX_CMD_PAYLOAD_LEN]; } __packed; -} __packed; +} __packed __aligned(4); #define CARL9170_TX_STATUS_QUEUE 3 #define CARL9170_TX_STATUS_QUEUE_S 0 @@ -279,6 +279,6 @@ struct carl9170_rsp { struct carl9170_psm psm; u8 data[CARL9170_MAX_CMD_PAYLOAD_LEN]; } __packed; -} __packed; +} __packed __aligned(4); #endif /* __CARL9170_SHARED_FWCMD_H */