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>
This commit is contained in:
Stefan Reinauer
2017-07-13 02:20:27 +02:00
parent 9f244a5494
commit 6a00113de8
229 changed files with 1020 additions and 704 deletions

View File

@@ -22,10 +22,10 @@ struct gdb_regs
struct fp_reg
{
u8 byte[12];
} __attribute__((packed)) f[8];
} __packed f[8];
u32 fps;
u32 cpsr;
} __attribute__((packed));
} __packed;
static const u8 type_to_signal[] = {
[EXC_UNDEF] = GDB_SIGILL,

View File

@@ -22,11 +22,11 @@ struct gdb_regs
struct fp_reg
{
u64 quad[2];
} __attribute__((packed)) f[32];
} __packed f[32];
u32 fpcr;
u32 fpsr;
u32 spsr;
} __attribute__((packed));
} __packed;
static const u8 type_to_signal[] = {
[EXC_SYNC_SP0] = GDB_SIGTRAP,

View File

@@ -34,7 +34,7 @@ struct cbmem_console {
uint32_t size;
uint32_t cursor;
uint8_t body[0];
} __attribute__ ((__packed__));
} __packed;
#define CURSOR_MASK ((1 << 28) - 1)
#define OVERFLOW (1 << 31)

View File

@@ -55,7 +55,7 @@ typedef volatile struct {
u32 hcsparams;
u32 hccparams;
u64 hcsp_portroute;
} __attribute__ ((packed)) hc_cap_t;
} __packed hc_cap_t;
typedef volatile struct {
u32 usbcmd;
@@ -83,7 +83,7 @@ typedef volatile struct {
u8 res2[0x40];
u32 hostpc;
/* hostpc register is used for CONFIG_LP_USB_EHCI_HOSTPC_ROOT_HUB_TT */
} __attribute__ ((packed)) hc_op_t;
} __packed hc_op_t;
typedef volatile struct {
#define QTD_TERMINATE 1
@@ -108,7 +108,7 @@ typedef volatile struct {
#define QTD_TOGGLE_DATA1 (1 << QTD_TOGGLE_SHIFT)
u32 bufptrs[5];
u32 bufptrs64[5];
} __attribute__ ((packed)) qtd_t;
} __packed qtd_t;
typedef volatile struct {
u32 horiz_link_ptr;
@@ -132,7 +132,7 @@ typedef volatile struct {
#define QH_PIPE_MULTIPLIER_SHIFT 30
volatile u32 current_td_ptr;
volatile qtd_t td;
} __attribute__ ((packed)) ehci_qh_t;
} __packed ehci_qh_t;
typedef struct ehci {
hc_cap_t *capabilities;

View File

@@ -186,7 +186,7 @@
_DO NOT_ use |= to set the bits,
this clears the entire state */
volatile u32 HcRhPortStatus[];
} __attribute__ ((packed)) opreg_t;
} __packed opreg_t;
typedef struct { /* should be 256 bytes according to spec */
u32 HccaInterruptTable[32];
@@ -195,14 +195,14 @@
volatile u32 HccaDoneHead;
u8 reserved[116]; /* pad according to spec */
u8 what[4]; /* really pad to 256 as spec only covers 252 */
} __attribute__ ((packed)) hcca_t;
} __packed hcca_t;
typedef volatile struct {
u32 config;
u32 tail_pointer;
u32 head_pointer;
u32 next_ed;
} __attribute__ ((packed)) ed_t;
} __packed ed_t;
#define ED_HALTED 1
#define ED_TOGGLE 2
@@ -220,7 +220,7 @@
u32 current_buffer_pointer;
u32 next_td;
u32 buffer_end;
} __attribute__ ((packed)) td_t;
} __packed td_t;
/*
* Bits 0 through 17 of .config won't be interpreted by the host controller
* (HC) and, after processing the TD, the HC has to ensure those bits have

View File

@@ -67,13 +67,13 @@ typedef struct {
u32 bufptr;
} __attribute__ ((packed))
} __packed
td_t;
typedef struct {
flistp_t headlinkptr;
volatile flistp_t elementlinkptr;
} __attribute__ ((packed))
} __packed
qh_t;
typedef enum { USBCMD = 0, USBSTS = 2, USBINTR = 4, FRNUM =

View File

@@ -112,14 +112,14 @@ typedef struct {
unsigned long bCBWCBLength:5;
unsigned long:3;
unsigned char CBWCB[31 - 15];
} __attribute__ ((packed)) cbw_t;
} __packed cbw_t;
typedef struct {
unsigned int dCSWSignature;
unsigned int dCSWTag;
unsigned int dCSWDataResidue;
unsigned char bCSWStatus;
} __attribute__ ((packed)) csw_t;
} __packed csw_t;
enum {
/*
@@ -297,7 +297,7 @@ typedef struct {
unsigned char res2; //6
unsigned short numblocks; //7-8
unsigned char control; //9 - the block is 10 bytes long
} __attribute__ ((packed)) cmdblock_t;
} __packed cmdblock_t;
typedef struct {
unsigned char command; //0
@@ -312,7 +312,7 @@ typedef struct {
unsigned char length; // for REQUEST SENSE
};
unsigned char control; //5
} __attribute__ ((packed)) cmdblock6_t;
} __packed cmdblock6_t;
/**
* Like readwrite_blocks, but for soft-sectors of 512b size. Converts the

View File

@@ -165,7 +165,7 @@ typedef struct {
trb_t *ring;
trb_t *cur;
u8 pcs;
} __attribute__ ((packed)) transfer_ring_t;
} __packed transfer_ring_t;
#define COMMAND_RING_SIZE 4
typedef transfer_ring_t command_ring_t;
@@ -332,8 +332,8 @@ typedef struct xhci {
struct {
u8 hciver_lo;
u8 hciver_hi;
} __attribute__ ((packed));
} __attribute__ ((packed));
} __packed;
} __packed;
union {
u32 hcsparams1;
struct {
@@ -341,8 +341,8 @@ typedef struct xhci {
unsigned long MaxIntrs:11;
unsigned long:6;
unsigned long MaxPorts:8;
} __attribute__ ((packed));
} __attribute__ ((packed));
} __packed;
} __packed;
union {
u32 hcsparams2;
struct {
@@ -352,16 +352,16 @@ typedef struct xhci {
unsigned long Max_Scratchpad_Bufs_Hi:5;
unsigned long SPR:1;
unsigned long Max_Scratchpad_Bufs_Lo:5;
} __attribute__ ((packed));
} __attribute__ ((packed));
} __packed;
} __packed;
union {
u32 hcsparams3;
struct {
unsigned long u1latency:8;
unsigned long:8;
unsigned long u2latency:16;
} __attribute__ ((packed));
} __attribute__ ((packed));
} __packed;
} __packed;
union {
u32 hccparams;
struct {
@@ -376,11 +376,11 @@ typedef struct xhci {
unsigned long:4;
unsigned long MaxPSASize:4;
unsigned long xECP:16;
} __attribute__ ((packed));
} __attribute__ ((packed));
} __packed;
} __packed;
u32 dboff;
u32 rtsoff;
} __attribute__ ((packed)) *capreg;
} __packed *capreg;
/* opreg is R/W is most places, so volatile access is necessary.
volatile means that the compiler seeks byte writes if possible,
@@ -446,8 +446,8 @@ typedef struct xhci {
u32 portpmsc;
u32 portli;
u32 res;
} __attribute__ ((packed)) prs[];
} __attribute__ ((packed)) *opreg;
} __packed prs[];
} __packed *opreg;
/* R/W, volatile, MMIO -> no bitfields */
volatile struct hcrreg {
@@ -462,8 +462,8 @@ typedef struct xhci {
u32 erstba_hi;
u32 erdp_lo;
u32 erdp_hi;
} __attribute__ ((packed)) intrrs[]; // up to 1024, but maximum host specific, given in capreg->MaxIntrs
} __attribute__ ((packed)) *hcrreg;
} __packed intrrs[]; // up to 1024, but maximum host specific, given in capreg->MaxIntrs
} __packed *hcrreg;
/* R/W, volatile, MMIO -> no bitfields */
volatile u32 *dbreg;

View File

@@ -37,7 +37,7 @@ struct bitmap_file_header {
uint32_t file_size;
uint16_t reserved[2];
uint32_t bitmap_offset;
} __attribute__ ((__packed__));
} __packed;
/* Bitmap version 3 */
@@ -53,13 +53,13 @@ struct bitmap_header_v3 {
int32_t v_res;
uint32_t colors_used;
uint32_t colors_important;
} __attribute__ ((__packed__));
} __packed;
struct bitmap_palette_element_v3 {
uint8_t blue;
uint8_t green;
uint8_t red;
uint8_t reserved;
} __attribute__ ((__packed__));
} __packed;
#endif /* __BITMAP_H__ */

View File

@@ -39,7 +39,7 @@ struct exception_state
{
u32 regs[16];
u32 cpsr;
} __attribute__((packed));
} __packed;
extern struct exception_state exception_state;
extern u32 exception_stack[];

View File

@@ -39,7 +39,7 @@ struct exception_state
uint64_t elr;
uint64_t esr;
uint64_t regs[31];
} __attribute__((packed));
} __packed;
extern struct exception_state *exception_state;

View File

@@ -50,6 +50,7 @@
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <compiler.h>
/** These are standard values for the known compression
alogrithms that coreboot knows about for stages and
@@ -97,7 +98,7 @@ struct cbfs_header {
uint32_t offset;
uint32_t architecture;
uint32_t pad[1];
} __attribute__((packed));
} __packed;
/* this used to be flexible, but wasn't ever set to something different. */
#define CBFS_ALIGNMENT 64
@@ -134,7 +135,7 @@ struct cbfs_file {
uint32_t attributes_offset;
uint32_t offset;
char filename[];
} __attribute__((packed));
} __packed;
/* Depending on how the header was initialized, it may be backed with 0x00 or
* 0xff. Support both. */
@@ -151,7 +152,7 @@ struct cbfs_file_attribute {
/* len covers the whole structure, incl. tag and len */
uint32_t len;
uint8_t data[0];
} __attribute__((packed));
} __packed;
struct cbfs_file_attr_compression {
uint32_t tag;
@@ -159,7 +160,7 @@ struct cbfs_file_attr_compression {
/* whole file compression format. 0 if no compression. */
uint32_t compression;
uint32_t decompressed_size;
} __attribute__((packed));
} __packed;
struct cbfs_file_attr_hash {
uint32_t tag;
@@ -167,7 +168,7 @@ struct cbfs_file_attr_hash {
uint32_t hash_type;
/* hash_data is len - sizeof(struct) bytes */
uint8_t hash_data[];
} __PACKED;
} __packed;
/*** Component sub-headers ***/
@@ -183,7 +184,7 @@ struct cbfs_stage {
uint64_t load; /** Where to load in memory */
uint32_t len; /** length of data to load */
uint32_t memlen; /** total length of object in memory */
} __attribute__((packed));
} __packed;
/** this is the sub-header for payload components. Payloads
are loaded by coreboot at the end of the boot process */
@@ -195,7 +196,7 @@ struct cbfs_payload_segment {
uint64_t load_addr;
uint32_t len;
uint32_t mem_len;
} __attribute__((packed));
} __packed;
struct cbfs_payload {
struct cbfs_payload_segment segments;
@@ -210,7 +211,7 @@ struct cbfs_payload {
struct cbfs_optionrom {
uint32_t compression;
uint32_t len;
} __attribute__((packed));
} __packed;
#define CBFS_MEDIA_INVALID_MAP_ADDRESS ((void*)(0xffffffff))
#define CBFS_DEFAULT_MEDIA ((void*)(0x0))

View File

@@ -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

View File

@@ -56,7 +56,7 @@ struct fmap_area {
uint32_t size; /* size in bytes */
uint8_t name[FMAP_STRLEN]; /* descriptive name */
uint16_t flags; /* flags for this area */
} __attribute__((packed));
} __packed;
struct fmap {
uint8_t signature[8]; /* "__FMAP__" (0x5F5F464D41505F5F) */
@@ -68,6 +68,6 @@ struct fmap {
uint16_t nareas; /* number of areas described by
fmap_areas[] below */
struct fmap_area areas[];
} __attribute__((packed));
} __packed;
#endif /* FLASHMAP_SERIALIZED_H__ */

View File

@@ -44,6 +44,7 @@
#define _LIBPAYLOAD_H
#include <libpayload-config.h>
#include <compiler.h>
#include <cbgfx.h>
#include <ctype.h>
#include <die.h>
@@ -361,7 +362,7 @@ long long int llabs(long long int j);
u8 bin2hex(u8 b);
u8 hex2bin(u8 h);
void hexdump(const void *memory, size_t length);
void fatal(const char *msg) __attribute__ ((noreturn));
void fatal(const char *msg) __attribute__((noreturn));
/* Count Leading Zeroes: clz(0) == 32, clz(0xf) == 28, clz(1 << 31) == 0 */
static inline int clz(u32 x) { return x ? __builtin_clz(x) : sizeof(x) * 8; }

View File

@@ -70,7 +70,7 @@ struct exception_state_t {
u32 ra;
} regs;
u32 vector;
} __attribute__((packed));
} __packed;
extern struct exception_state_t *exception_state_ptr;
extern u32 *exception_stack_end;

View File

@@ -43,13 +43,13 @@ extern FILE *stdout, *stdin, *stderr;
* @{
*/
int snprintf(char *str, size_t size, const char *fmt, ...)
__attribute__ ((format (printf, 3, 4)));
__attribute__((format (printf, 3, 4)));
int sprintf(char *str, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
__attribute__((format (printf, 2, 3)));
int printf(const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
__attribute__((format (printf, 1, 2)));
int fprintf(FILE *file, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
__attribute__((format (printf, 2, 3)));
/** @} */
void perror(const char *s);

View File

@@ -214,8 +214,8 @@ void srand(unsigned int seed);
/**
* Stop execution and halt the processor (this function does not return).
*/
void halt(void) __attribute__ ((noreturn));
void exit(int status) __attribute__ ((noreturn));
void halt(void) __attribute__((noreturn));
void exit(int status) __attribute__((noreturn));
#define abort() halt() /**< Alias for the halt() function */
#if IS_ENABLED(CONFIG_LP_REMOTEGDB)
/* Override abort()/halt() to trap into GDB if it is enabled. */

View File

@@ -83,13 +83,13 @@ typedef struct {
unsigned long ttThinkTime:2;
unsigned long arePortIndicatorsSupported:1;
unsigned long:8;
} __attribute__ ((packed));
} __packed;
unsigned short wHubCharacteristics;
} __attribute__ ((packed));
} __packed;
unsigned char bPowerOn2PwrGood;
unsigned char bHubContrCurrent;
char DeviceRemovable[];
} __attribute__ ((packed)) hub_descriptor_t;
} __packed hub_descriptor_t;
typedef struct {
unsigned char bLength;
@@ -106,7 +106,7 @@ typedef struct {
unsigned char iProduct;
unsigned char iSerialNumber;
unsigned char bNumConfigurations;
} __attribute__ ((packed)) device_descriptor_t;
} __packed device_descriptor_t;
typedef struct {
unsigned char bLength;
@@ -117,7 +117,7 @@ typedef struct {
unsigned char iConfiguration;
unsigned char bmAttributes;
unsigned char bMaxPower;
} __attribute__ ((packed)) configuration_descriptor_t;
} __packed configuration_descriptor_t;
typedef struct {
unsigned char bLength;
@@ -129,7 +129,7 @@ typedef struct {
unsigned char bInterfaceSubClass;
unsigned char bInterfaceProtocol;
unsigned char iInterface;
} __attribute__ ((packed)) interface_descriptor_t;
} __packed interface_descriptor_t;
typedef struct {
unsigned char bLength;
@@ -138,7 +138,7 @@ typedef struct {
unsigned char bmAttributes;
unsigned short wMaxPacketSize;
unsigned char bInterval;
} __attribute__ ((packed)) endpoint_descriptor_t;
} __packed endpoint_descriptor_t;
typedef struct {
unsigned char bLength;
@@ -148,7 +148,7 @@ typedef struct {
unsigned char bNumDescriptors;
unsigned char bReportDescriptorType;
unsigned short wReportDescriptorLength;
} __attribute__ ((packed)) hid_descriptor_t;
} __packed hid_descriptor_t;
typedef struct {
union {
@@ -156,14 +156,14 @@ typedef struct {
dev_req_recp req_recp:5;
dev_req_type req_type:2;
dev_req_dir data_dir:1;
} __attribute__ ((packed));
} __packed;
unsigned char bmRequestType;
} __attribute__ ((packed));
} __packed;
unsigned char bRequest;
unsigned short wValue;
unsigned short wIndex;
unsigned short wLength;
} __attribute__ ((packed)) dev_req_t;
} __packed dev_req_t;
struct usbdev_hc;
typedef struct usbdev_hc hci_t;

View File

@@ -58,7 +58,7 @@ struct exception_state
} regs;
u32 error_code;
u32 vector;
} __attribute__((packed));
} __packed;
extern struct exception_state *exception_state;
extern u32 exception_stack[];

View File

@@ -98,7 +98,7 @@ struct lz4_frame_header {
};
/* + uint64_t content_size iff has_content_size is set */
/* + uint8_t header_checksum */
} __attribute__((packed));
} __packed;
struct lz4_block_header {
union {
@@ -110,7 +110,7 @@ struct lz4_block_header {
};
/* + size bytes of data */
/* + uint32_t block_checksum iff has_block_checksum is set */
} __attribute__((packed));
} __packed;
size_t ulz4fn(const void *src, size_t srcn, void *dst, size_t dstn)
{

View File

@@ -82,7 +82,7 @@ void pci_init(struct pci_access *pacc)
memset(pacc, 0, sizeof(*pacc));
}
void pci_cleanup(__attribute__ ((unused)) struct pci_access *pacc)
void pci_cleanup(__attribute__((unused)) struct pci_access *pacc)
{
}