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

@@ -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[];