summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorStefan Reinauer <stefan.reinauer@coreboot.org>2017-07-13 02:20:27 +0200
committerStefan Reinauer <stefan.reinauer@coreboot.org>2017-07-13 19:45:59 +0000
commit6a00113de8b9060a7227bcfa79b3786e3e592a33 (patch)
tree467f5653272ed2d16f6d8033ed8cd0e7391fb426 /src/include
parent9f244a5494192707bfbb72e60f17411e9a35434a (diff)
Rename __attribute__((packed)) --> __packed
Also unify __attribute__ ((..)) to __attribute__((..)) and handle ((__packed__)) like ((packed)) Change-Id: Ie60a51c3fa92b5009724a5b7c2932e361bf3490c Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-on: https://review.coreboot.org/15921 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/bootstate.h4
-rw-r--r--src/include/compiler.h28
-rw-r--r--src/include/console/console.h2
-rw-r--r--src/include/console/spi.h5
-rw-r--r--src/include/cpu/cpu.h2
-rw-r--r--src/include/cpu/x86/smm.h13
-rw-r--r--src/include/device/pci.h2
-rw-r--r--src/include/elog.h8
-rw-r--r--src/include/memory_info.h5
-rw-r--r--src/include/reg_script.h2
-rw-r--r--src/include/smbios.h29
-rw-r--r--src/include/trace.h6
-rw-r--r--src/include/vbe.h7
13 files changed, 74 insertions, 39 deletions
diff --git a/src/include/bootstate.h b/src/include/bootstate.h
index 4e95ca4f3c..c15cb308d7 100644
--- a/src/include/bootstate.h
+++ b/src/include/bootstate.h
@@ -183,9 +183,9 @@ struct boot_state_init_entry {
};
#if ENV_RAMSTAGE
-#define BOOT_STATE_INIT_ATTR __attribute__ ((used, section(".bs_init")))
+#define BOOT_STATE_INIT_ATTR __attribute__((used, section(".bs_init")))
#else
-#define BOOT_STATE_INIT_ATTR __attribute__ ((unused))
+#define BOOT_STATE_INIT_ATTR __attribute__((unused))
#endif
#define BOOT_STATE_INIT_ENTRY(state_, when_, func_, arg_) \
diff --git a/src/include/compiler.h b/src/include/compiler.h
new file mode 100644
index 0000000000..f218725086
--- /dev/null
+++ b/src/include/compiler.h
@@ -0,0 +1,28 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2017 Google Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __COMPILER_H__
+#define __COMPILER_H__
+
+#if defined(__WIN32) || defined(__WIN64)
+#define __packed __attribute__((gcc_struct, packed))
+#else
+#define __packed __attribute__((packed))
+#endif
+
+#define __aligned(x) __attribute__((aligned(x)))
+#define __always_unused __attribute__((unused))
+
+#endif
diff --git a/src/include/console/console.h b/src/include/console/console.h
index e00482439a..aab0411600 100644
--- a/src/include/console/console.h
+++ b/src/include/console/console.h
@@ -40,7 +40,7 @@ void post_log_clear(void);
#endif
/* this function is weak and can be overridden by a mainboard function. */
void mainboard_post(u8 value);
-void __attribute__ ((noreturn)) die(const char *msg);
+void __attribute__((noreturn)) die(const char *msg);
#define __CONSOLE_ENABLE__ \
((ENV_BOOTBLOCK && IS_ENABLED(CONFIG_BOOTBLOCK_CONSOLE)) || \
diff --git a/src/include/console/spi.h b/src/include/console/spi.h
index dd33b0f375..42566eb768 100644
--- a/src/include/console/spi.h
+++ b/src/include/console/spi.h
@@ -18,6 +18,7 @@
#include <rules.h>
#include <stdint.h>
+#include <compiler.h>
void spiconsole_init(void);
void spiconsole_tx_byte(unsigned char c);
@@ -59,12 +60,12 @@ struct em100_msg_header {
uint32_t msg_signature;
uint8_t msg_type;
uint8_t msg_length;
-} __attribute__ ((packed));
+} __packed;
struct em100_msg {
struct em100_msg_header header;
char data[MAX_MSG_LENGTH];
-} __attribute__ ((packed));
+} __packed;
diff --git a/src/include/cpu/cpu.h b/src/include/cpu/cpu.h
index a78dd2f425..60940f07d1 100644
--- a/src/include/cpu/cpu.h
+++ b/src/include/cpu/cpu.h
@@ -10,7 +10,7 @@ void initialize_cpus(struct bus *cpu_bus);
asmlinkage void secondary_cpu_init(unsigned int cpu_index);
int cpu_phys_address_size(void);
-#define __cpu_driver __attribute__ ((used, __section__(".rodata.cpu_driver")))
+#define __cpu_driver __attribute__((used, __section__(".rodata.cpu_driver")))
#ifndef __SIMPLE_DEVICE__
/** start of compile time generated pci driver array */
extern struct cpu_driver _cpu_drivers[];
diff --git a/src/include/cpu/x86/smm.h b/src/include/cpu/x86/smm.h
index 15e3ed30da..34e3d05f2c 100644
--- a/src/include/cpu/x86/smm.h
+++ b/src/include/cpu/x86/smm.h
@@ -22,6 +22,7 @@
#include <arch/cpu.h>
#include <types.h>
+#include <compiler.h>
#define SMM_DEFAULT_BASE 0x30000
#define SMM_DEFAULT_SIZE 0x10000
@@ -129,7 +130,7 @@ typedef struct {
u64 rdx;
u64 rcx;
u64 rax;
-} __attribute__((packed)) amd64_smm_state_save_area_t;
+} __packed amd64_smm_state_save_area_t;
/* Intel Core 2 (EM64T) SMM State-Save Area
@@ -211,7 +212,7 @@ typedef struct {
u64 cr3;
u64 cr0;
-} __attribute__((packed)) em64t_smm_state_save_area_t;
+} __packed em64t_smm_state_save_area_t;
/* Intel Revision 30100 SMM State-Save Area
@@ -298,7 +299,7 @@ typedef struct {
u64 cr3;
u64 cr0;
-} __attribute__((packed)) em64t100_smm_state_save_area_t;
+} __packed em64t100_smm_state_save_area_t;
/* Intel Revision 30101 SMM State-Save Area
* The following processor architectures use this:
@@ -397,7 +398,7 @@ typedef struct {
u64 cr3;
u64 cr0;
-} __attribute__((packed)) em64t101_smm_state_save_area_t;
+} __packed em64t101_smm_state_save_area_t;
/* Legacy x86 SMM State-Save Area
@@ -438,7 +439,7 @@ typedef struct {
u32 eflags;
u32 cr3;
u32 cr0;
-} __attribute__((packed)) legacy_smm_state_save_area_t;
+} __packed legacy_smm_state_save_area_t;
typedef enum {
AMD64,
@@ -514,7 +515,7 @@ struct smm_runtime {
* contiguous like the 1:1 mapping it is up to the caller of the stub
* loader to adjust this mapping. */
u8 apic_id_to_cpu[CONFIG_MAX_CPUS];
-} __attribute__ ((packed));
+} __packed;
struct smm_module_params {
void *arg;
diff --git a/src/include/device/pci.h b/src/include/device/pci.h
index 4f6dfbc590..a04fc10677 100644
--- a/src/include/device/pci.h
+++ b/src/include/device/pci.h
@@ -57,7 +57,7 @@ struct pci_driver {
const unsigned short *devices;
};
-#define __pci_driver __attribute__ ((used, __section__(".rodata.pci_driver")))
+#define __pci_driver __attribute__((used, __section__(".rodata.pci_driver")))
/** start of compile time generated pci driver array */
extern struct pci_driver _pci_drivers[];
/** end of compile time generated pci driver array */
diff --git a/src/include/elog.h b/src/include/elog.h
index c960186c03..e309b58dee 100644
--- a/src/include/elog.h
+++ b/src/include/elog.h
@@ -16,6 +16,8 @@
#ifndef ELOG_H_
#define ELOG_H_
+#include <compiler.h>
+
/* SMI command code for GSMI event logging */
#define ELOG_GSMI_APM_CNT 0xEF
@@ -151,7 +153,7 @@
struct elog_event_data_wake {
u8 source;
u32 instance;
-} __attribute__ ((packed));
+} __packed;
/* Chrome OS related events */
#define ELOG_TYPE_CROS_DEVELOPER_MODE 0xa0
@@ -169,7 +171,7 @@ struct elog_event_data_me_extended {
u8 progress_code;
u8 current_pmevent;
u8 current_state;
-} __attribute__ ((packed));
+} __packed;
/* Last post code from previous boot */
#define ELOG_TYPE_LAST_POST_CODE 0xa3
@@ -195,7 +197,7 @@ struct elog_event_data_me_extended {
struct elog_event_mem_cache_update {
u8 slot;
u8 status;
-} __attribute__ ((packed));
+} __packed;
/* CPU Thermal Trip */
#define ELOG_TYPE_THERM_TRIP 0xab
diff --git a/src/include/memory_info.h b/src/include/memory_info.h
index 02904af285..8569ee493a 100644
--- a/src/include/memory_info.h
+++ b/src/include/memory_info.h
@@ -17,6 +17,7 @@
#define _MEMORY_INFO_H_
#include <stdint.h>
+#include <compiler.h>
/*
* If this table is filled and put in CBMEM,
@@ -37,12 +38,12 @@ struct dimm_info {
uint16_t mod_id;
uint8_t mod_type;
uint8_t bus_width;
-} __attribute__((packed));
+} __packed;
struct memory_info {
uint8_t dimm_cnt;
/* Maximum num of dimm is 8 */
struct dimm_info dimm[8];
-} __attribute__((packed));
+} __packed;
#endif
diff --git a/src/include/reg_script.h b/src/include/reg_script.h
index 13af794f1c..116dd9264b 100644
--- a/src/include/reg_script.h
+++ b/src/include/reg_script.h
@@ -107,7 +107,7 @@ struct reg_script_bus_entry {
void (*reg_script_write)(struct reg_script_context *ctx);
};
-#define REG_SCRIPT_TABLE_ATTRIBUTE __attribute__ ((used, section(".rsbe_init")))
+#define REG_SCRIPT_TABLE_ATTRIBUTE __attribute__((used, section(".rsbe_init")))
#define REG_SCRIPT_BUS_ENTRY(bus_entry_) \
const struct reg_script_bus_entry *rsbe_ ## bus_entry_ \
diff --git a/src/include/smbios.h b/src/include/smbios.h
index 28f8d13939..dec0300eef 100644
--- a/src/include/smbios.h
+++ b/src/include/smbios.h
@@ -19,6 +19,7 @@
#define SMBIOS_H
#include <types.h>
+#include <compiler.h>
unsigned long smbios_write_tables(unsigned long start);
int smbios_add_string(char *start, const char *str);
@@ -230,7 +231,7 @@ struct smbios_entry {
u32 struct_table_address;
u16 struct_count;
u8 smbios_bcd_revision;
-} __attribute__((packed));
+} __packed;
struct smbios_type0 {
u8 type;
@@ -249,7 +250,7 @@ struct smbios_type0 {
u8 ec_major_release;
u8 ec_minor_release;
char eos[2];
-} __attribute__((packed));
+} __packed;
struct smbios_type1 {
u8 type;
@@ -264,7 +265,7 @@ struct smbios_type1 {
u8 sku;
u8 family;
char eos[2];
-} __attribute__((packed));
+} __packed;
struct smbios_type2 {
u8 type;
@@ -275,7 +276,7 @@ struct smbios_type2 {
u8 version;
u8 serial_number;
char eos[2];
-} __attribute__((packed));
+} __packed;
enum {
SMBIOS_ENCLOSURE_OTHER = 0x01,
@@ -336,7 +337,7 @@ struct smbios_type3 {
u8 element_record_length;
u8 sku_number;
char eos[2];
-} __attribute__((packed));
+} __packed;
struct smbios_type4 {
u8 type;
@@ -366,7 +367,7 @@ struct smbios_type4 {
u16 processor_characteristics;
u16 processor_family2;
char eos[2];
-} __attribute__((packed));
+} __packed;
struct smbios_type11 {
u8 type;
@@ -374,7 +375,7 @@ struct smbios_type11 {
u16 handle;
u8 count;
char eos[2];
-} __attribute__((packed));
+} __packed;
struct smbios_type15 {
u8 type;
@@ -391,7 +392,7 @@ struct smbios_type15 {
u8 log_type_descriptors;
u8 log_type_descriptor_length;
char eos[2];
-} __attribute__((packed));
+} __packed;
enum {
SMBIOS_EVENTLOG_ACCESS_METHOD_IO8 = 0,
@@ -418,7 +419,7 @@ struct smbios_type16 {
u16 number_of_memory_devices;
u64 extended_maximum_capacity;
char eos[2];
-} __attribute__((packed));
+} __packed;
struct smbios_type17 {
u8 type;
@@ -447,7 +448,7 @@ struct smbios_type17 {
u16 maximum_voltage;
u16 configured_voltage;
char eos[2];
-} __attribute__((packed));
+} __packed;
struct smbios_type32 {
u8 type;
@@ -456,7 +457,7 @@ struct smbios_type32 {
u8 reserved[6];
u8 boot_status;
u8 eos[2];
-} __attribute__((packed));
+} __packed;
struct smbios_type38 {
u8 type;
@@ -469,7 +470,7 @@ struct smbios_type38 {
u64 base_address;
u8 base_address_modifier;
u8 irq;
-} __attribute__((packed));
+} __packed;
typedef enum {
SMBIOS_DEVICE_TYPE_OTHER = 0x01,
@@ -497,14 +498,14 @@ struct smbios_type41 {
u8 function_number: 3;
u8 device_number: 5;
char eos[2];
-} __attribute__((packed));
+} __packed;
struct smbios_type127 {
u8 type;
u8 length;
u16 handle;
u8 eos[2];
-} __attribute__((packed));
+} __packed;
void smbios_fill_dimm_manufacturer_from_id(uint16_t mod_id,
struct smbios_type17 *t);
diff --git a/src/include/trace.h b/src/include/trace.h
index 8745966bc4..05306f0b30 100644
--- a/src/include/trace.h
+++ b/src/include/trace.h
@@ -28,16 +28,16 @@
#if CONFIG_TRACE && !defined(__SMM__)
void __cyg_profile_func_enter(void *, void *)
- __attribute__ ((no_instrument_function));
+ __attribute__((no_instrument_function));
void __cyg_profile_func_exit(void *, void *)
- __attribute__ ((no_instrument_function));
+ __attribute__((no_instrument_function));
extern volatile int trace_dis;
#define DISABLE_TRACE do { trace_dis = 1; } while (0);
#define ENABLE_TRACE do { trace_dis = 0; } while (0);
-#define DISABLE_TRACE_ON_FUNCTION __attribute__ ((no_instrument_function));
+#define DISABLE_TRACE_ON_FUNCTION __attribute__((no_instrument_function));
#else /* !CONFIG_TRACE */
diff --git a/src/include/vbe.h b/src/include/vbe.h
index 12fac77357..ceceff29fb 100644
--- a/src/include/vbe.h
+++ b/src/include/vbe.h
@@ -13,6 +13,7 @@
#ifndef VBE_H
#define VBE_H
+#include <compiler.h>
#include <boot/coreboot_tables.h>
// these structs are for input from and output to OF
typedef struct {
@@ -24,7 +25,7 @@ typedef struct {
u8 color_depth; // color depth in bits per pixel
u32 framebuffer_address;
u8 edid_block_zero[128];
-} __attribute__ ((__packed__)) screen_info_t;
+} __packed screen_info_t;
typedef struct {
u8 signature[4];
@@ -32,7 +33,7 @@ typedef struct {
u8 monitor_number;
u16 max_screen_width;
u8 color_depth;
-} __attribute__ ((__packed__)) screen_info_input_t;
+} __packed screen_info_input_t;
// these structs only store a subset of the VBE defined fields
// only those needed.
@@ -80,7 +81,7 @@ typedef struct {
u32 offscreen_mem_offset;
u16 offscreen_mem_size;
u8 reserved[206];
-} __attribute__ ((__packed__)) vesa_mode_info_t;
+} __packed vesa_mode_info_t;
typedef struct {
u16 video_mode;