summaryrefslogtreecommitdiffstats
path: root/src/interface/efi
diff options
context:
space:
mode:
authorMichael Brown2009-03-12 20:41:40 +0100
committerMichael Brown2009-03-13 03:06:30 +0100
commit1266d7902bf7f2534ee279671d48613ef9b2434c (patch)
treea1a5b188148d983fa962a887476259768f1751d4 /src/interface/efi
parent[tcp] Avoid setting PSH flag when SYN flag is set (diff)
downloadipxe-1266d7902bf7f2534ee279671d48613ef9b2434c.tar.gz
ipxe-1266d7902bf7f2534ee279671d48613ef9b2434c.tar.xz
ipxe-1266d7902bf7f2534ee279671d48613ef9b2434c.zip
[tables] Redefine methods for accessing linker tables
Intel's C compiler (icc) chokes on the zero-length arrays that we currently use as part of the mechanism for accessing linker table entries. Abstract away the zero-length arrays, to make a port to icc easier. Introduce macros such as for_each_table_entry() to simplify the common case of iterating over all entries in a linker table. Represent table names as #defined string constants rather than unquoted literals; this avoids visual confusion between table names and C variable or type names, and also allows us to force a compilation error in the event of incorrect table names.
Diffstat (limited to 'src/interface/efi')
-rw-r--r--src/interface/efi/efi_init.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/interface/efi/efi_init.c b/src/interface/efi/efi_init.c
index 6e54cf7e1..43a3ca805 100644
--- a/src/interface/efi/efi_init.c
+++ b/src/interface/efi/efi_init.c
@@ -26,18 +26,6 @@ EFI_HANDLE efi_image_handle;
/** System table passed to entry point */
EFI_SYSTEM_TABLE *efi_systab;
-/** Declared used EFI protocols */
-static struct efi_protocol efi_protocols[0] \
- __table_start ( struct efi_protocol, efi_protocols );
-static struct efi_protocol efi_protocols_end[0] \
- __table_end ( struct efi_protocol, efi_protocols );
-
-/** Declared used EFI configuration tables */
-static struct efi_config_table efi_config_tables[0] \
- __table_start ( struct efi_config_table, efi_config_tables );
-static struct efi_config_table efi_config_tables_end[0] \
- __table_end ( struct efi_config_table, efi_config_tables );
-
/**
* Look up EFI configuration table
*
@@ -92,7 +80,7 @@ EFI_STATUS efi_init ( EFI_HANDLE image_handle,
/* Look up used protocols */
bs = systab->BootServices;
- for ( prot = efi_protocols ; prot < efi_protocols_end ; prot++ ) {
+ for_each_table_entry ( prot, EFI_PROTOCOLS ) {
if ( ( efirc = bs->LocateProtocol ( &prot->u.guid, NULL,
prot->protocol ) ) == 0 ) {
DBGC ( systab, "EFI protocol %s is at %p\n",
@@ -106,7 +94,7 @@ EFI_STATUS efi_init ( EFI_HANDLE image_handle,
}
/* Look up used configuration tables */
- for ( tab = efi_config_tables ; tab < efi_config_tables_end ; tab++ ) {
+ for_each_table_entry ( tab, EFI_CONFIG_TABLES ) {
if ( ( *(tab->table) = efi_find_table ( &tab->u.guid ) ) ) {
DBGC ( systab, "EFI configuration table %s is at %p\n",
uuid_ntoa ( &tab->u.uuid ), *(tab->table) );