From b23f858ee317cb113524cefcf65c962e2cd37b48 Mon Sep 17 00:00:00 2001 From: Francois Isabelle Date: Tue, 9 Jun 2009 15:38:09 +0000 Subject: [PATCH] Fixed AMC point-to-point record parsing in FRU -Fixed detection of packing support in GCC -Added packing support detection magic on all packed structures in project --- ipmitool/include/ipmitool/ipmi.h | 3 + ipmitool/include/ipmitool/ipmi_channel.h | 41 ++- ipmitool/include/ipmitool/ipmi_entity.h | 8 +- ipmitool/include/ipmitool/ipmi_event.h | 8 +- ipmitool/include/ipmitool/ipmi_fru.h | 172 +++++++++-- ipmitool/include/ipmitool/ipmi_mc.h | 24 +- ipmitool/include/ipmitool/ipmi_pef.h | 240 +++++++++++++--- ipmitool/include/ipmitool/ipmi_picmg.h | 8 +- ipmitool/include/ipmitool/ipmi_sdr.h | 110 ++++++- ipmitool/include/ipmitool/ipmi_sel.h | 16 +- ipmitool/include/ipmitool/ipmi_sensor.h | 8 +- ipmitool/include/ipmitool/ipmi_session.h | 8 +- ipmitool/include/ipmitool/ipmi_user.h | 8 +- ipmitool/lib/ipmi_fru.c | 2 +- ipmitool/lib/ipmi_hpmfwupg.c | 352 +++++++++++------------ ipmitool/lib/ipmi_ime.c | 17 +- ipmitool/lib/ipmi_sdradd.c | 8 +- 17 files changed, 764 insertions(+), 269 deletions(-) diff --git a/ipmitool/include/ipmitool/ipmi.h b/ipmitool/include/ipmitool/ipmi.h index 2e43793..d8e17b1 100644 --- a/ipmitool/include/ipmitool/ipmi.h +++ b/ipmitool/include/ipmitool/ipmi.h @@ -41,6 +41,9 @@ #include #include +#if HAVE_CONFIG_H +# include +#endif #define IPMI_BUF_SIZE 1024 diff --git a/ipmitool/include/ipmitool/ipmi_channel.h b/ipmitool/include/ipmitool/ipmi_channel.h index 00fda96..7833ee3 100644 --- a/ipmitool/include/ipmitool/ipmi_channel.h +++ b/ipmitool/include/ipmitool/ipmi_channel.h @@ -54,6 +54,9 @@ * The Get Authentication Capabilities response structure * From table 22-15 of the IPMI v2.0 spec */ +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct get_channel_auth_cap_rsp { uint8_t channel_number; #if WORDS_BIGENDIAN @@ -93,7 +96,10 @@ struct get_channel_auth_cap_rsp { #endif uint8_t oem_id[3]; /* IANA enterprise number for auth type */ uint8_t oem_aux_data; /* Additional OEM specific data for oem auths */ -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif @@ -101,6 +107,9 @@ struct get_channel_auth_cap_rsp { * The Get Channel Info response structure * From table 22-29 of the IPMI v2.0 spec */ +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct get_channel_info_rsp { #if WORDS_BIGENDIAN uint8_t __reserved1 : 4; @@ -132,7 +141,10 @@ struct get_channel_info_rsp { #endif uint8_t vendor_id[3]; /* For OEM that specified the protocol */ uint8_t aux_info[2]; /* Not used*/ -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif @@ -140,6 +152,9 @@ struct get_channel_info_rsp { * The Get Channel Access response structure * From table 22-28 of the IPMI v2.0 spec */ +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct get_channel_access_rsp { #if WORDS_BIGENDIAN uint8_t __reserved1 : 2; @@ -161,9 +176,14 @@ struct get_channel_access_rsp { uint8_t channel_priv_limit : 4; /* Channel privilege level limit */ uint8_t __reserved2 : 4; #endif -} __attribute__ ((packed)); - +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct get_user_access_rsp { #if WORDS_BIGENDIAN uint8_t __reserved1 : 2; @@ -190,8 +210,14 @@ struct get_user_access_rsp { uint8_t callin_callback : 1; uint8_t __reserved4 : 1; #endif -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct set_user_access_data { #if WORDS_BIGENDIAN uint8_t change_bits : 1; @@ -218,7 +244,10 @@ struct set_user_access_data { uint8_t session_limit : 4; uint8_t __reserved3 : 4; #endif -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif uint8_t ipmi_get_channel_medium(struct ipmi_intf * intf, uint8_t channel); uint8_t ipmi_current_channel_medium(struct ipmi_intf * intf); diff --git a/ipmitool/include/ipmitool/ipmi_entity.h b/ipmitool/include/ipmitool/ipmi_entity.h index 29f44d2..6e5198c 100644 --- a/ipmitool/include/ipmitool/ipmi_entity.h +++ b/ipmitool/include/ipmitool/ipmi_entity.h @@ -33,6 +33,9 @@ #ifndef IPMI_ENTITY_H #define IPMI_ENTITY_H +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct entity_id { uint8_t id; /* physical entity id */ #if WORDS_BIGENDIAN @@ -42,6 +45,9 @@ struct entity_id { uint8_t instance : 7; /* instance number */ uint8_t logical : 1; /* physical/logical */ #endif -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif #endif /* IPMI_ENTITY_H */ diff --git a/ipmitool/include/ipmitool/ipmi_event.h b/ipmitool/include/ipmitool/ipmi_event.h index e78d453..2ba2fa5 100644 --- a/ipmitool/include/ipmitool/ipmi_event.h +++ b/ipmitool/include/ipmitool/ipmi_event.h @@ -41,6 +41,9 @@ #define EVENT_DIR_ASSERT 0 #define EVENT_DIR_DEASSERT 1 +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct platform_event_msg { uint8_t evm_rev; uint8_t sensor_type; @@ -53,7 +56,10 @@ struct platform_event_msg { uint8_t event_dir : 1; #endif uint8_t event_data[3]; -} __attribute__((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif int ipmi_event_main(struct ipmi_intf *, int, char **); diff --git a/ipmitool/include/ipmitool/ipmi_fru.h b/ipmitool/include/ipmitool/ipmi_fru.h index 4bebfc9..da1ba27 100644 --- a/ipmitool/include/ipmitool/ipmi_fru.h +++ b/ipmitool/include/ipmitool/ipmi_fru.h @@ -63,8 +63,11 @@ enum { struct fru_info { uint16_t size; uint8_t access:1; -} __attribute__ ((packed)); +}; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct fru_header { uint8_t version; struct { @@ -76,7 +79,10 @@ struct fru_header { } offset; uint8_t pad; uint8_t checksum; -} __attribute__ ((packed)); +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif struct fru_area_chassis { uint8_t area_ver; @@ -111,6 +117,9 @@ struct fru_area_product { char * fru; }; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct fru_multirec_header { #define FRU_RECORD_TYPE_POWER_SUPPLY_INFORMATION 0x00 #define FRU_RECORD_TYPE_DC_OUTPUT 0x01 @@ -124,8 +133,14 @@ struct fru_multirec_header { uint8_t len; uint8_t record_checksum; uint8_t header_checksum; -} __attribute__ ((packed)); +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct fru_multirec_powersupply { #if WORDS_BIGENDIAN uint16_t capacity; @@ -168,11 +183,17 @@ struct fru_multirec_powersupply { #endif uint16_t combined_capacity; uint8_t rps_threshold; -} __attribute__ ((packed)); +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif static const char * combined_voltage_desc[] __attribute__((unused)) = { "12 V", "-12 V", "5 V", "3.3 V"}; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct fru_multirec_dcoutput { #if WORDS_BIGENDIAN uint8_t standby:1; @@ -189,8 +210,14 @@ struct fru_multirec_dcoutput { uint16_t ripple_and_noise; uint16_t min_current; uint16_t max_current; -} __attribute__ ((packed)); +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct fru_multirec_dcload { #if WORDS_BIGENDIAN uint8_t __reserved:4; @@ -205,8 +232,14 @@ struct fru_multirec_dcload { uint16_t ripple_and_noise; uint16_t min_current; uint16_t max_current; -} __attribute__ ((packed)); +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct fru_multirec_oem_header { unsigned char mfg_id[3]; #define FRU_PICMG_BACKPLANE_P2P 0x04 @@ -236,12 +269,24 @@ struct fru_multirec_oem_header { #define FRU_PICMG_CLK_CONFIG 0x2D unsigned char record_id; unsigned char record_version; -} __attribute__ ((packed)); +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct fru_picmgext_guid { unsigned char guid[16]; -} __attribute__ ((packed)); +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct fru_picmgext_link_desc { #ifndef WORDS_BIGENDIAN unsigned int desig_channel:6; @@ -268,7 +313,10 @@ struct fru_picmgext_link_desc { unsigned int desig_if:2; unsigned int desig_channel:6; #endif -} __attribute__ ((packed)); +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif #define FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED 0x00 @@ -280,11 +328,20 @@ struct fru_picmgext_link_desc { #define FRU_PICMGEXT_AMC_LINK_TYPE_RAPIDIO 0x06 #define FRU_PICMGEXT_AMC_LINK_TYPE_STORAGE 0x07 +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif /* This is used in command, not in FRU */ struct fru_picmgext_amc_link_info { unsigned char linkInfo[3]; -} __attribute__ ((packed)); +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct fru_picmgext_amc_link_desc_core { #ifndef WORDS_BIGENDIAN unsigned int designator:12; @@ -297,8 +354,14 @@ struct fru_picmgext_amc_link_desc_core { unsigned int type:8; unsigned int designator:12; #endif -} __attribute__ ((packed)); +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct fru_picmgext_amc_link_desc_extra { #ifndef WORDS_BIGENDIAN unsigned char asymetricMatch:2; @@ -307,9 +370,15 @@ struct fru_picmgext_amc_link_desc_extra { unsigned char reserved:6; unsigned char asymetricMatch:2; #endif -} __attribute__ ((packed)); +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct fru_picmgext_amc_link_desc { #ifndef WORDS_BIGENDIAN struct fru_picmgext_amc_link_desc_core core;/* lsb */ @@ -318,14 +387,19 @@ struct fru_picmgext_amc_link_desc { struct fru_picmgext_amc_link_desc_extra extra; struct fru_picmgext_amc_link_desc_core core;/* lsb */ #endif -} __attribute__ ((packed)); +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif #define FRU_PICMGEXT_OEM_SWFW 0x03 #define OEM_SWFW_NBLOCK_OFFSET 0x05 #define OEM_SWFW_FIELD_START_OFFSET 0x06 - +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct fru_picmgext_chn_desc { #ifndef WORDS_BIGENDIAN unsigned char remote_slot:8; @@ -338,36 +412,66 @@ struct fru_picmgext_chn_desc { unsigned char remote_chn:5; unsigned char remote_slot:8; #endif -} __attribute__ ((packed)); +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct fru_picmgext_slot_desc { unsigned char chan_type; unsigned char slot_addr; unsigned char chn_count; -} __attribute__ ((packed)); +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif #define FRU_PICMGEXT_DESIGN_IF_BASE 0x00 #define FRU_PICMGEXT_DESIGN_IF_FABRIC 0x01 #define FRU_PICMGEXT_DESIGN_IF_UPDATE_CHANNEL 0x02 #define FRU_PICMGEXT_DESIGN_IF_RESERVED 0x03 +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct fru_picmgext_carrier_activation_record { unsigned short max_internal_curr; unsigned char allowance_for_readiness; unsigned char module_activation_record_count; -} __attribute__ ((packed)); +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct fru_picmgext_activation_record { unsigned char ibmb_addr; unsigned char max_module_curr; unsigned char reserved; -} __attribute__ ((packed)); +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct fru_picmgext_carrier_p2p_record { unsigned char resource_id; unsigned char p2p_count; -} __attribute__ ((packed)); +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct fru_picmgext_carrier_p2p_descriptor { #ifndef WORDS_BIGENDIAN unsigned char remote_resource_id; @@ -380,8 +484,14 @@ struct fru_picmgext_carrier_p2p_descriptor { unsigned short remote_port:5; unsigned char remote_resource_id; #endif -} __attribute__ ((packed)); +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct fru_picmgext_amc_p2p_record { #ifndef WORDS_BIGENDIAN unsigned char resource_id :4; @@ -392,8 +502,14 @@ struct fru_picmgext_amc_p2p_record { unsigned char /* reserved */ :3; unsigned char resource_id :4; #endif -} __attribute__ ((packed)); +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct fru_picmgext_amc_channel_desc_record { #ifndef WORDS_BIGENDIAN unsigned char lane0port :5; @@ -408,8 +524,14 @@ struct fru_picmgext_amc_channel_desc_record { unsigned char lane1port :5; unsigned char lane0port :5; #endif -} __attribute__ ((packed)); +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct fru_picmgext_amc_link_desc_record { #define FRU_PICMGEXT_AMC_LINK_TYPE_PCIE 0x02 #define FRU_PICMGEXT_AMC_LINK_TYPE_PCIE_AS1 0x03 @@ -452,7 +574,11 @@ struct fru_picmgext_amc_link_desc_record { unsigned short port_flag_0 :1; unsigned short channel_id :8; #endif -} __attribute__ ((packed)); +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + /* FRU Board manufacturing date */ static const uint64_t secs_from_1970_1996 = 820450800; static const char * chassis_type_desc[] __attribute__((unused)) = { diff --git a/ipmitool/include/ipmitool/ipmi_mc.h b/ipmitool/include/ipmitool/ipmi_mc.h index 24b1296..7640ba5 100644 --- a/ipmitool/include/ipmitool/ipmi_mc.h +++ b/ipmitool/include/ipmitool/ipmi_mc.h @@ -52,6 +52,9 @@ int ipmi_mc_main(struct ipmi_intf *, int, char **); * Response data from IPM Get Device ID Command (IPMI rev 1.5, section 17.1) * The following really apply to any IPM device, not just BMCs... */ +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct ipm_devid_rsp { uint8_t device_id; uint8_t device_revision; @@ -62,7 +65,10 @@ struct ipm_devid_rsp { uint8_t manufacturer_id[3]; uint8_t product_id[2]; uint8_t aux_fw_rev[4]; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif #define IPM_DEV_DEVICE_ID_SDR_MASK (0x80) /* 1 = provides SDRs */ #define IPM_DEV_DEVICE_ID_REV_MASK (0x0F) /* BCD-enoded */ @@ -83,10 +89,16 @@ struct ipm_devid_rsp { #define IPM_DEV_ADTL_SUPPORT_BITS (8) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct ipm_selftest_rsp { unsigned char code; unsigned char test; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif #define IPM_SFT_CODE_OK 0x55 #define IPM_SFT_CODE_NOT_IMPLEMENTED 0x56 @@ -103,6 +115,9 @@ struct ipm_selftest_rsp { #define IPM_SELFTEST_FW_BOOTBLOCK 0x02 #define IPM_SELFTEST_FW_CORRUPTED 0x01 +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct ipm_get_watchdog_rsp { unsigned char timer_use; unsigned char timer_actions; @@ -112,7 +127,10 @@ struct ipm_get_watchdog_rsp { unsigned char initial_countdown_msb; unsigned char present_countdown_lsb; unsigned char present_countdown_msb; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif #define IPM_WATCHDOG_RESET_ERROR 0x80 diff --git a/ipmitool/include/ipmitool/ipmi_pef.h b/ipmitool/include/ipmitool/ipmi_pef.h index 904a2ac..cdea4ec 100644 --- a/ipmitool/include/ipmitool/ipmi_pef.h +++ b/ipmitool/include/ipmitool/ipmi_pef.h @@ -50,6 +50,9 @@ typedef enum { P_ABLE, } flg_e; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_table_entry { #define PEF_CONFIG_ENABLED 0x80 #define PEF_CONFIG_PRECONFIGURED 0x40 @@ -90,7 +93,10 @@ struct pef_table_entry { uint8_t event_data_3_AND_mask; uint8_t event_data_3_compare_1; uint8_t event_data_3_compare_2; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif struct desc_map { /* maps a description to a value/mask */ const char *desc; @@ -324,6 +330,9 @@ pef_b2s_generic_ER[] __attribute__((unused)) = { #define PEF_B2S_GENERIC_ER_ENTRIES \ (sizeof(pef_b2s_generic_ER) / sizeof(pef_b2s_generic_ER[0])) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_policy_entry { #define PEF_POLICY_ID_MASK 0xf0 #define PEF_POLICY_ID_SHIFT 4 @@ -341,7 +350,10 @@ struct pef_policy_entry { uint8_t chan_dest; #define PEF_POLICY_EVENT_SPECIFIC 0x80 uint8_t alert_string_key; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif static struct bit_desc_map pef_b2s_policies __attribute__((unused)) = { @@ -384,6 +396,9 @@ BIT_DESC_MAP_LIST, {NULL} } }; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_cfgparm_selector { #define PEF_CFGPARM_ID_REVISION_ONLY_MASK 0x80 #define PEF_CFGPARM_ID_SET_IN_PROGRESS 0 @@ -403,21 +418,36 @@ struct pef_cfgparm_selector { uint8_t id; uint8_t set; uint8_t block; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_cfgparm_set_in_progress { #define PEF_SET_IN_PROGRESS_COMMIT_WRITE 0x02 #define PEF_SET_IN_PROGRESS 0x01 uint8_t data1; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_cfgparm_control { #define PEF_CONTROL_ENABLE_ALERT_STARTUP_DELAY 0x08 #define PEF_CONTROL_ENABLE_STARTUP_DELAY 0x04 #define PEF_CONTROL_ENABLE_EVENT_MESSAGES 0x02 #define PEF_CONTROL_ENABLE 0x01 uint8_t data1; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif static struct bit_desc_map pef_b2s_control __attribute__((unused)) = { @@ -429,6 +459,9 @@ BIT_DESC_MAP_ALL, {NULL} } }; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_cfgparm_action { #define PEF_ACTION_ENABLE_DIAGNOSTIC_INTERRUPT 0x20 #define PEF_ACTION_ENABLE_OEM 0x10 @@ -437,54 +470,114 @@ struct pef_cfgparm_action { #define PEF_ACTION_ENABLE_POWER_DOWN 0x02 #define PEF_ACTION_ENABLE_ALERT 0x01 uint8_t data1; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_cfgparm_startup_delay { uint8_t data1; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_cfgparm_alert_startup_delay { uint8_t data1; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_cfgparm_filter_table_size { #define PEF_FILTER_TABLE_SIZE_MASK 0x7f uint8_t data1; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_cfgparm_filter_table_entry { #define PEF_FILTER_TABLE_ID_MASK 0x7f uint8_t data1; struct pef_table_entry entry; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_cfgparm_filter_table_data_1 { uint8_t data1; uint8_t data2; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_cfgparm_policy_table_size { #define PEF_POLICY_TABLE_SIZE_MASK 0x7f uint8_t data1; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_cfgparm_policy_table_entry { #define PEF_POLICY_TABLE_ID_MASK 0x7f uint8_t data1; struct pef_policy_entry entry; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_cfgparm_system_guid { #define PEF_SYSTEM_GUID_USED_IN_PET 0x01 uint8_t data1; uint8_t guid[16]; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_cfgparm_alert_string_table_size { #define PEF_ALERT_STRING_TABLE_SIZE_MASK 0x7f uint8_t data1; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_cfgparm_alert_string_keys { #define PEF_ALERT_STRING_ID_MASK 0x7f uint8_t data1; @@ -492,16 +585,27 @@ struct pef_cfgparm_alert_string_keys { uint8_t data2; #define PEF_ALERT_STRING_SET_ID_MASK 0x7f uint8_t data3; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_cfgparm_alert_string_table_entry { uint8_t id; uint8_t blockno; uint8_t block[16]; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif /* PEF - LAN */ - +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_lan_cfgparm_selector { #define PEF_LAN_CFGPARM_CH_REVISION_ONLY_MASK 0x80 #define PEF_LAN_CFGPARM_CH_MASK 0x0f @@ -513,13 +617,25 @@ struct pef_lan_cfgparm_selector { uint8_t id; uint8_t set; uint8_t block; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_lan_cfgparm_dest_size { #define PEF_LAN_DEST_TABLE_SIZE_MASK 0x0f uint8_t data1; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_lan_cfgparm_dest_type { #define PEF_LAN_DEST_TYPE_ID_MASK 0x0f uint8_t dest; @@ -532,7 +648,10 @@ struct pef_lan_cfgparm_dest_type { uint8_t alert_timeout; #define PEF_LAN_RETRIES_MASK 0x07 uint8_t retries; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif static struct bit_desc_map pef_b2s_lan_desttype __attribute__((unused)) = { @@ -544,6 +663,9 @@ BIT_DESC_MAP_LIST, {NULL} } }; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_lan_cfgparm_dest_info { #define PEF_LAN_DEST_MASK 0x0f uint8_t dest; @@ -555,10 +677,15 @@ struct pef_lan_cfgparm_dest_info { uint8_t gateway; uint8_t ip[4]; uint8_t mac[6]; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif /* PEF - Serial/PPP */ - +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_serial_cfgparm_selector { #define PEF_SERIAL_CFGPARM_CH_REVISION_ONLY_MASK 0x80 #define PEF_SERIAL_CFGPARM_CH_MASK 0x0f @@ -573,13 +700,25 @@ struct pef_serial_cfgparm_selector { uint8_t id; uint8_t set; uint8_t block; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_serial_cfgparm_dest_size { #define PEF_SERIAL_DEST_TABLE_SIZE_MASK 0x0f uint8_t data1; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_serial_cfgparm_dest_info { #define PEF_SERIAL_DEST_MASK 0x0f uint8_t dest; @@ -608,7 +747,10 @@ struct pef_serial_cfgparm_dest_info { #define PEF_SERIAL_CALLBACK_IPADDR_ID_SHIFT 4 #define PEF_SERIAL_CALLBACK_ACCT_ID_MASK 0xf0 uint8_t data5; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif static struct bit_desc_map pef_b2s_serial_desttype __attribute__((unused)) = { @@ -623,31 +765,58 @@ BIT_DESC_MAP_LIST, {NULL} } }; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_serial_cfgparm_dial_string_count { #define PEF_SERIAL_DIAL_STRING_COUNT_MASK 0x0f uint8_t data1; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_serial_cfgparm_dial_string { #define PEF_SERIAL_DIAL_STRING_MASK 0x0f uint8_t data1; uint8_t data2; uint8_t data3; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_serial_cfgparm_tap_acct_count { #define PEF_SERIAL_TAP_ACCT_COUNT_MASK 0x0f uint8_t data1; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_serial_cfgparm_tap_acct_info { uint8_t data1; #define PEF_SERIAL_TAP_ACCT_INFO_DIAL_STRING_ID_MASK 0xf0 #define PEF_SERIAL_TAP_ACCT_INFO_DIAL_STRING_ID_SHIFT 4 #define PEF_SERIAL_TAP_ACCT_INFO_SVC_SETTINGS_ID_MASK 0x0f uint8_t data2; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct pef_serial_cfgparm_tap_svc_settings { uint8_t data1; #define PEF_SERIAL_TAP_CONFIRMATION_ACK_AFTER_ETX 0x0 @@ -658,7 +827,10 @@ struct pef_serial_cfgparm_tap_svc_settings { uint8_t escape_mask[4]; uint8_t timeout_parms[3]; uint8_t retry_parms[2]; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif static struct bit_desc_map pef_b2s_tap_svc_confirm __attribute__((unused)) = { @@ -685,7 +857,7 @@ BIT_DESC_MAP_LIST, struct pef_cfgparm_alert_string_table_size; struct pef_cfgparm_alert_string_keys; struct pef_cfgparm_alert_string_table_entry; - } __attribute__ ((packed)); + } ATTRIBUTE_PACKING; struct pef_lan_config_parms { /* LAN */ struct pef_lan_cfgparm_set_in_progress; @@ -708,7 +880,7 @@ BIT_DESC_MAP_LIST, struct pef_lan_cfgparm_destination_count; struct pef_lan_cfgparm_destination_type; struct pef_lan_cfgparm_destination_ipaddr; - } __attribute__ ((packed)); + } ATTRIBUTE_PACKING; struct pef_serial_config_parms { /* Serial/PPP */ struct pef_serial_cfgparm_set_in_progress; @@ -760,7 +932,7 @@ BIT_DESC_MAP_LIST, struct pef_serial_cfgparm_ppp_udp_proxy_xmit_bufsize; struct pef_serial_cfgparm_ppp_udp_proxy_recv_bufsize; struct pef_serial_cfgparm_ppp_remote_console_ipaddr; - } __attribute__ ((packed)); + } ATTRIBUTE_PACKING; #endif #define IPMI_CMD_GET_PEF_CAPABILITIES 0x10 diff --git a/ipmitool/include/ipmitool/ipmi_picmg.h b/ipmitool/include/ipmitool/ipmi_picmg.h index 18f6f46..8de9f03 100644 --- a/ipmitool/include/ipmitool/ipmi_picmg.h +++ b/ipmitool/include/ipmitool/ipmi_picmg.h @@ -53,11 +53,17 @@ #define PICMG_PMC 0x08 #define PICMG_RTM 0x09 +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct picmg_set_fru_activation_cmd { unsigned char picmg_id; /* always 0*/ unsigned char fru_id; /* threshold setting mask */ unsigned char fru_state; /* fru activation/deactivation */ -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif /* the LED color capabilities */ static const char* led_color_str[] __attribute__((unused)) = { diff --git a/ipmitool/include/ipmitool/ipmi_sdr.h b/ipmitool/include/ipmitool/ipmi_sdr.h index f84700e..7c91c76 100644 --- a/ipmitool/include/ipmitool/ipmi_sdr.h +++ b/ipmitool/include/ipmitool/ipmi_sdr.h @@ -105,6 +105,9 @@ enum { #define GET_SENSOR_READING 0x2d #define GET_SENSOR_TYPE 0x2f +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct sdr_repo_info_rs { uint8_t version; /* SDR version (51h) */ uint16_t count; /* number of records */ @@ -112,20 +115,39 @@ struct sdr_repo_info_rs { uint32_t add_stamp; /* last add timestamp */ uint32_t erase_stamp; /* last del timestamp */ uint8_t op_support; /* supported operations */ -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif /* builtin (device) sdrs support */ struct sdr_device_info_rs { unsigned char count; /* number of records */ unsigned char flags; /* flags */ unsigned char popChangeInd[3]; /* free space in SDR */ -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif #define GET_SDR_RESERVE_REPO 0x22 struct sdr_reserve_repo_rs { uint16_t reserve_id; /* reservation ID */ -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif #define GET_SDR 0x23 struct sdr_get_rq { uint16_t reserve_id; /* reservation ID */ @@ -133,8 +155,14 @@ struct sdr_get_rq { uint8_t offset; /* offset into SDR */ #define GET_SDR_ENTIRE_RECORD 0xff uint8_t length; /* length to read */ -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct sdr_get_rs { uint16_t next; /* next record id */ uint16_t id; /* record ID */ @@ -152,8 +180,14 @@ struct sdr_get_rs { #define SDR_RECORD_TYPE_OEM 0xc0 uint8_t type; /* record type */ uint8_t length; /* remaining record bytes */ -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct sdr_record_mask { union { struct { @@ -280,8 +314,14 @@ struct sdr_record_mask { }; } threshold; } type; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct sdr_record_compact_sensor { struct { uint8_t owner_id; @@ -391,8 +431,14 @@ struct sdr_record_compact_sensor { uint8_t oem; /* reserved for OEM use */ uint8_t id_code; /* sensor ID string type/length code */ uint8_t id_string[16]; /* sensor ID string bytes, only if id_code != 0 */ -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct sdr_record_eventonly_sensor { struct { uint8_t owner_id; @@ -437,8 +483,14 @@ struct sdr_record_eventonly_sensor { uint8_t id_code; /* sensor ID string type/length code */ uint8_t id_string[16]; /* sensor ID string bytes, only if id_code != 0 */ -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct sdr_record_full_sensor { struct { uint8_t owner_id; @@ -576,8 +628,14 @@ struct sdr_record_full_sensor { uint8_t oem; /* reserved for OEM use */ uint8_t id_code; /* sensor ID string type/length code */ uint8_t id_string[16]; /* sensor ID string bytes, only if id_code != 0 */ -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct sdr_record_mc_locator { uint8_t dev_slave_addr; #if WORDS_BIGENDIAN @@ -602,7 +660,10 @@ struct sdr_record_mc_locator { uint8_t oem; uint8_t id_code; uint8_t id_string[16]; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif struct sdr_record_fru_locator { uint8_t dev_slave_addr; @@ -632,8 +693,14 @@ struct sdr_record_fru_locator { uint8_t oem; uint8_t id_code; uint8_t id_string[16]; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct sdr_record_generic_locator { uint8_t dev_access_addr; uint8_t dev_slave_addr; @@ -660,8 +727,14 @@ struct sdr_record_generic_locator { uint8_t oem; uint8_t id_code; uint8_t id_string[16]; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct sdr_record_entity_assoc { struct entity_id entity; /* container entity ID and instance */ struct { @@ -685,7 +758,10 @@ struct sdr_record_entity_assoc { uint8_t entity_inst_3; /* entity inst 3 | range 2 first instance */ uint8_t entity_id_4; /* entity ID 4 | range 2 entity */ uint8_t entity_inst_4; /* entity inst 4 | range 2 last instance */ -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif struct sdr_record_oem { uint8_t *data; @@ -696,6 +772,9 @@ struct sdr_record_oem { * The Get SDR Repository Info response structure * From table 33-3 of the IPMI v2.0 spec */ +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct get_sdr_repository_info_rsp { uint8_t sdr_version; uint8_t record_count_lsb; @@ -720,7 +799,10 @@ struct get_sdr_repository_info_rsp { uint8_t modal_update_support:2; uint8_t overflow_flag:1; #endif -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif struct ipmi_sdr_iterator { uint16_t reservation; diff --git a/ipmitool/include/ipmitool/ipmi_sel.h b/ipmitool/include/ipmitool/ipmi_sel.h index d71b7bc..3a14d7d 100644 --- a/ipmitool/include/ipmitool/ipmi_sel.h +++ b/ipmitool/include/ipmitool/ipmi_sel.h @@ -57,12 +57,18 @@ enum { IPMI_EVENT_CLASS_OEM, }; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct sel_get_rq { uint16_t reserve_id; uint16_t record_id; uint8_t offset; uint8_t length; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif struct standard_spec_sel_rec{ uint32_t timestamp; @@ -95,6 +101,9 @@ struct oem_nots_spec_sel_rec{ uint8_t oem_defined[SEL_OEM_NOTS_DATA_LEN]; }; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct sel_event_record { uint16_t record_id; uint8_t record_type; @@ -103,7 +112,10 @@ struct sel_event_record { struct oem_ts_spec_sel_rec oem_ts_type; struct oem_nots_spec_sel_rec oem_nots_type; } sel_type; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif struct ipmi_event_sensor_types { uint8_t code; diff --git a/ipmitool/include/ipmitool/ipmi_sensor.h b/ipmitool/include/ipmitool/ipmi_sensor.h index 359d7c8..78f1c6e 100644 --- a/ipmitool/include/ipmitool/ipmi_sensor.h +++ b/ipmitool/include/ipmitool/ipmi_sensor.h @@ -65,6 +65,9 @@ #define STATE_13_ASSERTED 0x20 #define STATE_14_ASSERTED 0x40 +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct sensor_set_thresh_rq { uint8_t sensor_num; /* sensor # */ uint8_t set_mask; /* threshold setting mask */ @@ -74,7 +77,10 @@ struct sensor_set_thresh_rq { uint8_t upper_non_crit; /* new upper non critical threshold*/ uint8_t upper_crit; /* new upper critical threshold*/ uint8_t upper_non_recov; /* new upper non recoverable threshold*/ -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif int ipmi_sensor_main(struct ipmi_intf *, int, char **); diff --git a/ipmitool/include/ipmitool/ipmi_session.h b/ipmitool/include/ipmitool/ipmi_session.h index ad7a09c..21ff12f 100644 --- a/ipmitool/include/ipmitool/ipmi_session.h +++ b/ipmitool/include/ipmitool/ipmi_session.h @@ -43,6 +43,9 @@ /* * From table 22.25 of the IPMIv2 specification */ +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct get_session_info_rsp { uint8_t session_handle; @@ -116,7 +119,10 @@ struct get_session_info_rsp uint16_t console_port; /* LSBF */ } modem_data; } channel_data; -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif diff --git a/ipmitool/include/ipmitool/ipmi_user.h b/ipmitool/include/ipmitool/ipmi_user.h index 8c1d8c7..4a8e481 100644 --- a/ipmitool/include/ipmitool/ipmi_user.h +++ b/ipmitool/include/ipmitool/ipmi_user.h @@ -67,6 +67,9 @@ struct user_access_rsp { uint8_t __reserved3 : 2; #endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif #if WORDS_BIGENDIAN uint8_t __reserved4 : 1; uint8_t no_callin_access : 1; @@ -80,7 +83,10 @@ struct user_access_rsp { uint8_t no_callin_access : 1; uint8_t __reserved4 : 1; #endif -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif diff --git a/ipmitool/lib/ipmi_fru.c b/ipmitool/lib/ipmi_fru.c index 15ba919..abc6706 100644 --- a/ipmitool/lib/ipmi_fru.c +++ b/ipmitool/lib/ipmi_fru.c @@ -1398,7 +1398,7 @@ fru_area_print_multirec(struct ipmi_intf * intf, struct fru_info * fru, } /* FIXME: Add OEM record support here */ else{ - printf(" OEM (0x%s) Record\n", val2str( iana, ipmi_oem_info)); + printf(" OEM (%s) Record\n", val2str( iana, ipmi_oem_info)); } } break; diff --git a/ipmitool/lib/ipmi_hpmfwupg.c b/ipmitool/lib/ipmi_hpmfwupg.c index dd1d4ce..31a6549 100644 --- a/ipmitool/lib/ipmi_hpmfwupg.c +++ b/ipmitool/lib/ipmi_hpmfwupg.c @@ -235,8 +235,8 @@ typedef enum eHpmfwupgComponentId HPMFWUPG_COMPONENT_ID_MAX } tHpmfwupgComponentId; -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgComponentBitMask { @@ -267,8 +267,8 @@ struct HpmfwupgComponentBitMask }bitField; }ComponentBits; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif @@ -283,19 +283,19 @@ static const int HPMFWUPG_UPLOAD_RETRY = 2; * TARGET UPGRADE CAPABILITIES DEFINITIONS */ -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgGetTargetUpgCapabilitiesReq { unsigned char picmgId; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgGetTargetUpgCapabilitiesResp { @@ -333,20 +333,20 @@ struct HpmfwupgGetTargetUpgCapabilitiesResp unsigned char inaccessTimeout; struct HpmfwupgComponentBitMask componentsPresent; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgGetTargetUpgCapabilitiesCtx { struct HpmfwupgGetTargetUpgCapabilitiesReq req; struct HpmfwupgGetTargetUpgCapabilitiesResp resp; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif /* @@ -364,8 +364,8 @@ typedef enum eHpmfwupgCompPropertiesSelect HPMFWUPG_COMP_OEM_PROPERTIES = 192 } tHpmfwupgCompPropertiesSelect; -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgGetComponentPropertiesReq { @@ -373,12 +373,12 @@ struct HpmfwupgGetComponentPropertiesReq unsigned char componentId; unsigned char selector; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgGetGeneralPropResp { @@ -406,76 +406,76 @@ struct HpmfwupgGetGeneralPropResp }bitfield; }GeneralCompProperties; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgGetCurrentVersionResp { unsigned char picmgId; unsigned char currentVersion[HPMFWUPG_VERSION_SIZE]; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgGetDescStringResp { unsigned char picmgId; char descString[HPMFWUPG_DESC_STRING_LENGTH]; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgGetRollbackFwVersionResp { unsigned char picmgId; unsigned char rollbackFwVersion[HPMFWUPG_VERSION_SIZE]; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgGetDeferredFwVersionResp { unsigned char picmgId; unsigned char deferredFwVersion[HPMFWUPG_VERSION_SIZE]; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif /* * GetComponentProperties - OEM properties (192) */ #define HPMFWUPG_OEM_LENGTH 4 -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgGetOemProperties { unsigned char picmgId; unsigned char oemRspData[HPMFWUPG_OEM_LENGTH]; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgGetComponentPropertiesResp { @@ -489,58 +489,58 @@ struct HpmfwupgGetComponentPropertiesResp struct HpmfwupgGetOemProperties oemProperties; }Response; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgGetComponentPropertiesCtx { struct HpmfwupgGetComponentPropertiesReq req; struct HpmfwupgGetComponentPropertiesResp resp; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif /* * ABORT UPGRADE DEFINITIONS */ -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgAbortUpgradeReq { unsigned char picmgId; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgAbortUpgradeResp { unsigned char picmgId; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgAbortUpgradeCtx { struct HpmfwupgAbortUpgradeReq req; struct HpmfwupgAbortUpgradeResp resp; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif /* @@ -555,8 +555,8 @@ typedef enum eHpmfwupgUpgradeAction HPMFWUPG_UPGRADE_ACTION_INVALID = 0xff } tHpmfwupgUpgradeAction; -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgInitiateUpgradeActionReq { @@ -564,31 +564,31 @@ struct HpmfwupgInitiateUpgradeActionReq struct HpmfwupgComponentBitMask componentsMask; unsigned char upgradeAction; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgInitiateUpgradeActionResp { unsigned char picmgId; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgInitiateUpgradeActionCtx { struct HpmfwupgInitiateUpgradeActionReq req; struct HpmfwupgInitiateUpgradeActionResp resp; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif /* @@ -601,8 +601,8 @@ struct HpmfwupgInitiateUpgradeActionCtx #define HPMFWUPG_SEND_DATA_COUNT_IPMB 26 #define HPMFWUPG_SEND_DATA_COUNT_IPMBL 26 -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgUploadFirmwareBlockReq { @@ -610,32 +610,32 @@ struct HpmfwupgUploadFirmwareBlockReq unsigned char blockNumber; unsigned char data[HPMFWUPG_SEND_DATA_COUNT_MAX]; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgUploadFirmwareBlockResp { unsigned char picmgId; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgUploadFirmwareBlockCtx { struct HpmfwupgUploadFirmwareBlockReq req; struct HpmfwupgUploadFirmwareBlockResp resp; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif @@ -645,8 +645,8 @@ struct HpmfwupgUploadFirmwareBlockCtx #define HPMFWUPG_IMAGE_SIZE_BYTE_COUNT 4 -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgFinishFirmwareUploadReq { @@ -654,88 +654,88 @@ struct HpmfwupgFinishFirmwareUploadReq unsigned char componentId; unsigned char imageLength[HPMFWUPG_IMAGE_SIZE_BYTE_COUNT]; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgFinishFirmwareUploadResp { unsigned char picmgId; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgFinishFirmwareUploadCtx { struct HpmfwupgFinishFirmwareUploadReq req; struct HpmfwupgFinishFirmwareUploadResp resp; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif /* * ACTIVATE FW DEFINITIONS */ -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgActivateFirmwareReq { unsigned char picmgId; unsigned char rollback_override; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgActivateFirmwareResp { unsigned char picmgId; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgActivateFirmwareCtx { struct HpmfwupgActivateFirmwareReq req; struct HpmfwupgActivateFirmwareResp resp; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif /* * GET UPGRADE STATUS DEFINITIONS */ -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgGetUpgradeStatusReq { unsigned char picmgId; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgGetUpgradeStatusResp { @@ -743,114 +743,114 @@ struct HpmfwupgGetUpgradeStatusResp unsigned char cmdInProcess; unsigned char lastCmdCompCode; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgGetUpgradeStatusCtx { struct HpmfwupgGetUpgradeStatusReq req; struct HpmfwupgGetUpgradeStatusResp resp; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif /* * MANUAL FW ROLLBACK DEFINITIONS */ -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgManualFirmwareRollbackReq { unsigned char picmgId; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgManualFirmwareRollbackResp { unsigned char picmgId; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif struct HpmfwupgManualFirmwareRollbackCtx { struct HpmfwupgManualFirmwareRollbackReq req; struct HpmfwupgManualFirmwareRollbackResp resp; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif /* * QUERY ROLLBACK STATUS DEFINITIONS */ -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgQueryRollbackStatusReq { unsigned char picmgId; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgQueryRollbackStatusResp { unsigned char picmgId; struct HpmfwupgComponentBitMask rollbackComp; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgQueryRollbackStatusCtx { struct HpmfwupgQueryRollbackStatusReq req; struct HpmfwupgQueryRollbackStatusResp resp; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif /* * QUERY SELF TEST RESULT DEFINITIONS */ -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgQuerySelftestResultReq { unsigned char picmgId; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgQuerySelftestResultResp { @@ -858,20 +858,20 @@ struct HpmfwupgQuerySelftestResultResp unsigned char result1; unsigned char result2; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgQuerySelftestResultCtx { struct HpmfwupgQuerySelftestResultReq req; struct HpmfwupgQuerySelftestResultResp resp; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif /* * HPM.1 IMAGE DEFINITIONS @@ -887,8 +887,8 @@ struct HpmfwupgQuerySelftestResultCtx #define HPMFWUPG_IMAGE_HEADER_VERSION 0 #define HPMFWUPG_IMAGE_SIGNATURE "PICMGFWU" -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgImageHeader { @@ -926,15 +926,15 @@ struct HpmfwupgImageHeader unsigned char firmRevision[HPMFWUPG_FIRM_REVISION_LENGTH]; unsigned short oemDataLength; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif #define HPMFWUPG_DESCRIPTION_LENGTH 21 -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgActionRecord { @@ -942,14 +942,14 @@ struct HpmfwupgActionRecord struct HpmfwupgComponentBitMask components; unsigned char checksum; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif #define HPMFWUPG_FIRMWARE_SIZE_LENGTH 4 -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgFirmwareImage { @@ -957,12 +957,12 @@ struct HpmfwupgFirmwareImage char desc[HPMFWUPG_DESCRIPTION_LENGTH]; unsigned char length[HPMFWUPG_FIRMWARE_SIZE_LENGTH]; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif -#ifdef PRAGMA_PACK -#pramga pack(1) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) #endif struct HpmfwupgUpgradeCtx { @@ -974,8 +974,8 @@ struct HpmfwupgUpgradeCtx struct HpmfwupgGetGeneralPropResp genCompProp[HPMFWUPG_COMPONENT_ID_MAX]; struct ipm_devid_rsp devId; } ATTRIBUTE_PACKING; -#ifdef PRAGMA_PACK -#pramga pack(0) +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) #endif typedef enum eHpmfwupgActionType diff --git a/ipmitool/lib/ipmi_ime.c b/ipmitool/lib/ipmi_ime.c index f5b4f8b..f6924de 100755 --- a/ipmitool/lib/ipmi_ime.c +++ b/ipmitool/lib/ipmi_ime.c @@ -127,6 +127,9 @@ typedef enum tImeUpdateType } tImeUpdateType; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif typedef struct sImeStatus { uint8_t image_status; tImeStateEnum update_state; @@ -135,13 +138,21 @@ typedef struct sImeStatus { uint8_t update_type; uint8_t dependent_flag; uint8_t free_area_size[4]; -} __attribute__ ((packed)) tImeStatus ; +} ATTRIBUTE_PACKING tImeStatus ; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif typedef struct sImeCaps { uint8_t area_supported; uint8_t special_caps; -} __attribute__ ((packed)) tImeCaps ; - +} ATTRIBUTE_PACKING tImeCaps ; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif static void ImePrintUsage(void); diff --git a/ipmitool/lib/ipmi_sdradd.c b/ipmitool/lib/ipmi_sdradd.c index a167798..88b04e6 100644 --- a/ipmitool/lib/ipmi_sdradd.c +++ b/ipmitool/lib/ipmi_sdradd.c @@ -52,6 +52,9 @@ #define ADD_PARTIAL_SDR 0x25 +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif struct sdr_add_rq { uint16_t reserve_id; /* reservation ID */ uint16_t id; /* record ID */ @@ -60,7 +63,10 @@ struct sdr_add_rq { #define PARTIAL_ADD (0) #define LAST_RECORD (1) uint8_t data[1]; /* SDR record data */ -} __attribute__ ((packed)); +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif /* This was formerly initialized to 24, reduced this to 19 so the overall message fits into the recommended 32-byte limit */