diff options
author | Matt Fleming <matt.fleming@linux.intel.com> | 2011-06-08 13:40:31 +0100 |
---|---|---|
committer | Matt Fleming <matt.fleming@linux.intel.com> | 2011-07-21 11:38:59 +0100 |
commit | f25073852c017a80615fecbb92fe47e98c16d378 (patch) | |
tree | 0cfea8508a55699c350fe84f03867d79a28803cd | |
parent | 251a008c666b3961fafbc83291173bd82aedf5de (diff) | |
download | efilinux-f25073852c017a80615fecbb92fe47e98c16d378.tar.gz |
efilinux: Move the services and system tables into entry.c
We only need to allocate space for the services and system table data
structures once, so allocate space in entry.c. Currently, space will
be allocated in every object file that includes efilinux.h. What's
worse is that we only initialise the data objects allocated in entry.c
via register_table(), all other object files will operate on
uninitialised tables.
Signed-off-by: Matt Fleming <matt.fleming@linux.intel.com>
-rw-r--r-- | efilinux.h | 22 | ||||
-rw-r--r-- | entry.c | 14 |
2 files changed, 14 insertions, 22 deletions
@@ -42,25 +42,9 @@ #ifndef __EFILINUX_H__ #define __EFILINUX_H__ -static EFI_SYSTEM_TABLE *sys_table; -static EFI_BOOT_SERVICES *boot; -static EFI_RUNTIME_SERVICES *runtime; - -/** - * register_table - Register the EFI system table - * @_table: EFI system table - * - * If the system table CRC check fails return FALSE, otherwise return - * TRUE. - */ -static inline BOOLEAN register_table(EFI_SYSTEM_TABLE *_table) -{ - sys_table = _table; - boot = sys_table->BootServices; - runtime = sys_table->RuntimeServices; - - return CheckCrc(sys_table->Hdr.HeaderSize, &sys_table->Hdr); -} +extern EFI_SYSTEM_TABLE *sys_table; +extern EFI_BOOT_SERVICES *boot; +extern EFI_RUNTIME_SERVICES *runtime; /** * allocate_pages - Allocate memory pages from the system @@ -36,6 +36,10 @@ #define ERROR_STRING_LENGTH 32 +EFI_SYSTEM_TABLE *sys_table; +EFI_BOOT_SERVICES *boot; +EFI_RUNTIME_SERVICES *runtime; + static void print_memory_map(EFI_MEMORY_DESCRIPTOR *buf, UINTN size, UINTN key, UINTN desc_size, UINTN desc_version) @@ -81,7 +85,7 @@ print_memory_map(EFI_MEMORY_DESCRIPTOR *buf, UINTN size, * @sys_table: EFI system table */ EFI_STATUS -efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) +efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *_table) { EFI_MEMORY_DESCRIPTOR *map_buf; UINTN desc_size, desc_version; @@ -89,8 +93,12 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) WCHAR *error_buf; EFI_STATUS err; - InitializeLib(image, sys_table); - if (register_table(sys_table) != TRUE) + InitializeLib(image, _table); + sys_table = _table; + boot = sys_table->BootServices; + runtime = sys_table->RuntimeServices; + + if (CheckCrc(sys_table->Hdr.HeaderSize, &sys_table->Hdr) != TRUE) return EFI_LOAD_ERROR; Print(L"efilinux loader\n"); |