diff options
author | marcel <marcel@FreeBSD.org> | 2006-11-02 02:42:48 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2006-11-02 02:42:48 +0000 |
commit | 2904312753a5ab37478b957ab4ad51612d8a6dd9 (patch) | |
tree | 9b6135a7b8e3d756095b67910ef13366a6611521 /sys/boot/efi | |
parent | dc91b1990af7dcb6d36cfccc9756c830cf400108 (diff) | |
download | FreeBSD-src-2904312753a5ab37478b957ab4ad51612d8a6dd9.zip FreeBSD-src-2904312753a5ab37478b957ab4ad51612d8a6dd9.tar.gz |
Sync the EFI headers with version 1.10.14.62 of the Intel sample EFI
implementation. This re-introduces C99 style comments that previously
were replaced by original C comments.
Diffstat (limited to 'sys/boot/efi')
-rw-r--r-- | sys/boot/efi/include/efi.h | 33 | ||||
-rw-r--r-- | sys/boot/efi/include/efi_nii.h | 72 | ||||
-rw-r--r-- | sys/boot/efi/include/efiapi.h | 505 | ||||
-rw-r--r-- | sys/boot/efi/include/eficon.h | 64 | ||||
-rw-r--r-- | sys/boot/efi/include/efidebug.h | 69 | ||||
-rw-r--r-- | sys/boot/efi/include/efidef.h | 116 | ||||
-rw-r--r-- | sys/boot/efi/include/efidevp.h | 74 | ||||
-rw-r--r-- | sys/boot/efi/include/efierr.h | 11 | ||||
-rw-r--r-- | sys/boot/efi/include/efifs.h | 51 | ||||
-rw-r--r-- | sys/boot/efi/include/efilib.h | 6 | ||||
-rw-r--r-- | sys/boot/efi/include/efinet.h | 139 | ||||
-rw-r--r-- | sys/boot/efi/include/efipart.h | 15 | ||||
-rw-r--r-- | sys/boot/efi/include/efiprot.h | 137 | ||||
-rw-r--r-- | sys/boot/efi/include/efipxebc.h | 109 | ||||
-rw-r--r-- | sys/boot/efi/include/efiser.h | 47 | ||||
-rw-r--r-- | sys/boot/efi/include/efistdarg.h | 9 | ||||
-rw-r--r-- | sys/boot/efi/include/i386/efibind.h | 184 | ||||
-rw-r--r-- | sys/boot/efi/include/i386/pe.h | 39 | ||||
-rw-r--r-- | sys/boot/efi/include/ia64/efibind.h | 183 | ||||
-rw-r--r-- | sys/boot/efi/include/ia64/pe.h | 39 |
20 files changed, 1255 insertions, 647 deletions
diff --git a/sys/boot/efi/include/efi.h b/sys/boot/efi/include/efi.h index f476a25..4869e38 100644 --- a/sys/boot/efi/include/efi.h +++ b/sys/boot/efi/include/efi.h @@ -1,7 +1,14 @@ /* $FreeBSD$ */ /*++ -Copyright (c) 1998 Intel Corporation +Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved +This software and associated documentation (if any) is furnished +under a license and may only be used or copied in accordance +with the terms of the license. Except as permitted by such +license, no part of this software or documentation may be +reproduced, stored in a retrieval system, or transmitted in any +form or by any means without the express written consent of +Intel Corporation. Module Name: @@ -17,19 +24,20 @@ Revision History --*/ -/* - * Build flags on input - * EFI32 - * EFI_DEBUG - Enable debugging code - * EFI_NT_EMULATOR - Building for running under NT - */ +// +// Build flags on input +// EFI32 +// EFI_DEBUG - Enable debugging code +// EFI_NT_EMULATOR - Building for running under NT +// + #ifndef _EFI_INCLUDE_ #define _EFI_INCLUDE_ #define EFI_FIRMWARE_VENDOR L"INTEL" -#define EFI_FIRMWARE_MAJOR_REVISION 12 -#define EFI_FIRMWARE_MINOR_REVISION 33 +#define EFI_FIRMWARE_MAJOR_REVISION 14 +#define EFI_FIRMWARE_MINOR_REVISION 62 #define EFI_FIRMWARE_REVISION ((EFI_FIRMWARE_MAJOR_REVISION <<16) | (EFI_FIRMWARE_MINOR_REVISION)) #include "efibind.h" @@ -43,7 +51,12 @@ Revision History #include "efinet.h" #include "efiapi.h" #include "efifs.h" -#include "efifpswa.h" #include "efierr.h" +#define EFI_STRINGIZE(a) #a +#define EFI_PROTOCOL_DEFINITION(a) EFI_STRINGIZE(Protocol/a/a.h) + +#define EFI_GUID_DEFINITION(a) EFI_STRINGIZE(Guid/a/a##.h) +#define EFI_GUID_STRING(guidpointer, shortstring, longstring) + #endif diff --git a/sys/boot/efi/include/efi_nii.h b/sys/boot/efi/include/efi_nii.h index 6a9c05d..5222232 100644 --- a/sys/boot/efi/include/efi_nii.h +++ b/sys/boot/efi/include/efi_nii.h @@ -3,7 +3,14 @@ #define _EFI_NII_H /*++ -Copyright (c) 2000 Intel Corporation +Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved +This software and associated documentation (if any) is furnished +under a license and may only be used or copied in accordance +with the terms of the license. Except as permitted by such +license, no part of this software or documentation may be +reproduced, stored in a retrieval system, or transmitted in any +form or by any means without the express written consent of +Intel Corporation. Module name: efi_nii.h @@ -20,8 +27,11 @@ Revision history: #define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL \ { 0xE18541CD, 0xF755, 0x4f73, 0x92, 0x8D, 0x64, 0x3C, 0x8A, 0x79, 0xB2, 0x29 } +#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_31 \ + { 0x1ACED566, 0x76ED, 0x4218, 0xBC, 0x81, 0x76, 0x7F, 0x1F, 0x97, 0x7A, 0x89 } #define EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE_REVISION 0x00010000 +#define EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE_REVISION_31 0x00010001 typedef enum { EfiNetworkInterfaceUndi = 1 @@ -29,54 +39,48 @@ typedef enum { typedef struct { - /* Revision of the network interface identifier protocol interface. */ UINT64 Revision; + // Revision of the network interface identifier protocol interface. - /* - * Address of the first byte of the identifying structure for this - * network interface. This is set to zero if there is no structure. - * For PXE/UNDI this is the first byte of the !PXE structure. - */ UINT64 ID; + // Address of the first byte of the identifying structure for this + // network interface. This is set to zero if there is no structure. + // + // For PXE/UNDI this is the first byte of the !PXE structure. - /* - * Address of the UNrelocated driver/ROM image. This is set - * to zero if there is no driver/ROM image. - * For 16-bit UNDI, this is the first byte of the option ROM in - * upper memory. - * For 32/64-bit S/W UNDI, this is the first byte of the EFI ROM - * image. - * For H/W UNDI, this is set to zero. - */ UINT64 ImageAddr; + // Address of the UNrelocated driver/ROM image. This is set + // to zero if there is no driver/ROM image. + // + // For 16-bit UNDI, this is the first byte of the option ROM in + // upper memory. + // + // For 32/64-bit S/W UNDI, this is the first byte of the EFI ROM + // image. + // + // For H/W UNDI, this is set to zero. - /* - * Size of the UNrelocated driver/ROM image of this network interface. - * This is set to zero if there is no driver/ROM image. - */ UINT32 ImageSize; + // Size of the UNrelocated driver/ROM image of this network interface. + // This is set to zero if there is no driver/ROM image. - /* - * 4 char ASCII string to go in class identifier (option 60) in DHCP - * and Boot Server discover packets. - * For EfiNetworkInterfaceUndi this field is "UNDI". - * For EfiNetworkInterfaceSnp this field is "SNPN". - */ CHAR8 StringId[4]; + // 4 char ASCII string to go in class identifier (option 60) in DHCP + // and Boot Server discover packets. + // For EfiNetworkInterfaceUndi this field is "UNDI". + // For EfiNetworkInterfaceSnp this field is "SNPN". - /* - * Information to be placed into the PXE DHCP and Discover packets. - * This is the network interface type and version number that will - * be placed into DHCP option 94 (client network interface identifier). - */ UINT8 Type; UINT8 MajorVer; UINT8 MinorVer; - + // Information to be placed into the PXE DHCP and Discover packets. + // This is the network interface type and version number that will + // be placed into DHCP option 94 (client network interface identifier). BOOLEAN Ipv6Supported; - UINT8 IfNum; /* interface number to be used with pxeid structure */ + UINT8 IfNum; // interface number to be used with pxeid structure } EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE; extern EFI_GUID NetworkInterfaceIdentifierProtocol; +extern EFI_GUID NetworkInterfaceIdentifierProtocol_31; -#endif /* _EFI_NII_H */ +#endif // _EFI_NII_H diff --git a/sys/boot/efi/include/efiapi.h b/sys/boot/efi/include/efiapi.h index 93c6995..187fe29 100644 --- a/sys/boot/efi/include/efiapi.h +++ b/sys/boot/efi/include/efiapi.h @@ -4,7 +4,14 @@ /*++ -Copyright (c) 1998 Intel Corporation +Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved +This software and associated documentation (if any) is furnished +under a license and may only be used or copied in accordance +with the terms of the license. Except as permitted by such +license, no part of this software or documentation may be +reproduced, stored in a retrieval system, or transmitted in any +form or by any means without the express written consent of +Intel Corporation. Module Name: @@ -21,22 +28,22 @@ Revision History --*/ -/* - * EFI Specification Revision - */ +// +// EFI Specification Revision +// #define EFI_SPECIFICATION_MAJOR_REVISION 1 -#define EFI_SPECIFICATION_MINOR_REVISION 02 +#define EFI_SPECIFICATION_MINOR_REVISION 10 -/* - * Declare forward referenced data structures - */ +// +// Declare forward referenced data structures +// INTERFACE_DECL(_EFI_SYSTEM_TABLE); -/* - * EFI Memory - */ +// +// EFI Memory +// typedef EFI_STATUS @@ -92,8 +99,8 @@ EFI_STATUS #define EFI_OPTIONAL_PTR 0x00000001 -#define EFI_INTERNAL_FNC 0x00000002 /* Pointer to internal runtime fnc */ -#define EFI_INTERNAL_PTR 0x00000004 /* Pointer to internal runtime data */ +#define EFI_INTERNAL_FNC 0x00000002 // Pointer to internal runtime fnc +#define EFI_INTERNAL_PTR 0x00000004 // Pointer to internal runtime data typedef @@ -104,9 +111,9 @@ EFI_STATUS ); -/* - * EFI Events - */ +// +// EFI Events +// @@ -181,9 +188,9 @@ EFI_STATUS IN EFI_EVENT Event ); -/* - * Task priority level - */ +// +// Task priority level +// #define TPL_APPLICATION 4 #define TPL_CALLBACK 8 @@ -203,19 +210,19 @@ VOID ); -/* - * EFI platform variables - */ +// +// EFI platform varibles +// #define EFI_GLOBAL_VARIABLE \ { 0x8BE4DF61, 0x93CA, 0x11d2, 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C } -/* Variable attributes */ +// Variable attributes #define EFI_VARIABLE_NON_VOLATILE 0x00000001 #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002 #define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004 -/* Variable size limitation */ +// Variable size limitation #define EFI_MAXIMUM_VARIABLE_SIZE 1024 typedef @@ -248,14 +255,14 @@ EFI_STATUS ); -/* - * EFI Time - */ +// +// EFI Time +// typedef struct { - UINT32 Resolution; /* 1e-6 parts per million */ - UINT32 Accuracy; /* hertz */ - BOOLEAN SetsToZero; /* Set clears sub-second time */ + UINT32 Resolution; // 1e-6 parts per million + UINT32 Accuracy; // hertz + BOOLEAN SetsToZero; // Set clears sub-second time } EFI_TIME_CAPABILITIES; @@ -288,12 +295,12 @@ EFI_STATUS ); -/* - * Image functions - */ +// +// Image functions +// -/* PE32+ Subsystem type for EFI images */ +// PE32+ Subsystem type for EFI images #if !defined(IMAGE_SUBSYSTEM_EFI_APPLICATION) #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10 @@ -301,7 +308,7 @@ EFI_STATUS #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12 #endif -/* PE32+ Machine type for EFI images */ +// PE32+ Machine type for EFI images #if !defined(EFI_IMAGE_MACHINE_IA32) #define EFI_IMAGE_MACHINE_IA32 0x014c @@ -311,7 +318,11 @@ EFI_STATUS #define EFI_IMAGE_MACHINE_IA64 0x0200 #endif -/* Image Entry prototype */ +#if !defined(EFI_IMAGE_MACHINE_EBC) +#define EFI_IMAGE_MACHINE_EBC 0x0EBC +#endif + +// Image Entry prototype typedef EFI_STATUS @@ -355,32 +366,32 @@ EFI_STATUS ); -/* Image handle */ +// Image handle #define LOADED_IMAGE_PROTOCOL \ { 0x5B1B31A1, 0x9562, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B } -#define EFI_IMAGE_INFORMATION_REVISION 0x1000 +#define EFI_LOADED_IMAGE_INFORMATION_REVISION 0x1000 typedef struct { UINT32 Revision; EFI_HANDLE ParentHandle; struct _EFI_SYSTEM_TABLE *SystemTable; - /* Source location of image */ + // Source location of image EFI_HANDLE DeviceHandle; EFI_DEVICE_PATH *FilePath; VOID *Reserved; - /* Images load options */ + // Images load options UINT32 LoadOptionsSize; VOID *LoadOptions; - /* Location of where image was loaded */ + // Location of where image was loaded VOID *ImageBase; UINT64 ImageSize; EFI_MEMORY_TYPE ImageCodeType; EFI_MEMORY_TYPE ImageDataType; - /* If the driver image supports a dynamic unload request */ + // If the driver image supports a dynamic unload request EFI_IMAGE_UNLOAD Unload; } EFI_LOADED_IMAGE; @@ -393,9 +404,9 @@ EFI_STATUS IN UINTN MapKey ); -/* - * Misc - */ +// +// Misc +// typedef @@ -416,11 +427,12 @@ EFI_STATUS typedef enum { EfiResetCold, - EfiResetWarm + EfiResetWarm, + EfiResetShutdown } EFI_RESET_TYPE; typedef -EFI_STATUS +VOID (EFIAPI *EFI_RESET_SYSTEM) ( IN EFI_RESET_TYPE ResetType, IN EFI_STATUS ResetStatus, @@ -440,13 +452,12 @@ EFI_STATUS OUT UINT32 *HighCount ); -/* - * Protocol handler functions - */ +// +// Protocol handler functions +// typedef enum { - EFI_NATIVE_INTERFACE, - EFI_PCODE_INTERFACE + EFI_NATIVE_INTERFACE } EFI_INTERFACE_TYPE; typedef @@ -525,179 +536,355 @@ EFI_STATUS typedef EFI_STATUS (EFIAPI *EFI_RESERVED_SERVICE) ( - VOID ); -/* - * Standard EFI table header - */ +typedef +EFI_STATUS +(EFIAPI *EFI_CONNECT_CONTROLLER) ( + IN EFI_HANDLE ControllerHandle, + IN EFI_HANDLE *DriverImageHandle OPTIONAL, + IN EFI_DEVICE_PATH *RemainingDevicePath OPTIONAL, + IN BOOLEAN Recursive + ); -typedef struct _EFI_TABLE_HEARDER { - UINT64 Signature; - UINT32 Revision; - UINT32 HeaderSize; - UINT32 CRC32; - UINT32 Reserved; -} EFI_TABLE_HEADER; +typedef +EFI_STATUS +(EFIAPI *EFI_DISCONNECT_CONTROLLER)( + IN EFI_HANDLE ControllerHandle, + IN EFI_HANDLE DriverImageHandle, OPTIONAL + IN EFI_HANDLE ChildHandle OPTIONAL + ); +#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001 +#define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002 +#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004 +#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008 +#define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010 +#define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020 -/* - * EFI Runtime Serivces Table - */ +typedef +EFI_STATUS +(EFIAPI *EFI_OPEN_PROTOCOL) ( + IN EFI_HANDLE Handle, + IN EFI_GUID *Protocol, + OUT VOID **Interface, + IN EFI_HANDLE ImageHandle, + IN EFI_HANDLE ControllerHandle, OPTIONAL + IN UINT32 Attributes + ); -#define EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552 -#define EFI_RUNTIME_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION) +typedef +EFI_STATUS +(EFIAPI *EFI_CLOSE_PROTOCOL) ( + IN EFI_HANDLE Handle, + IN EFI_GUID *Protocol, + IN EFI_HANDLE ImageHandle, + IN EFI_HANDLE DeviceHandle + ); -typedef struct { - EFI_TABLE_HEADER Hdr; +typedef struct { + EFI_HANDLE AgentHandle; + EFI_HANDLE ControllerHandle; + UINT32 Attributes; + UINT32 OpenCount; +} EFI_OPEN_PROTOCOL_INFORMATION_ENTRY; - /* Time services */ +typedef +EFI_STATUS +(EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) ( + IN EFI_HANDLE UserHandle, + IN EFI_GUID *Protocol, + IN EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer, + OUT UINTN *EntryCount + ); - EFI_GET_TIME GetTime; - EFI_SET_TIME SetTime; - EFI_GET_WAKEUP_TIME GetWakeupTime; - EFI_SET_WAKEUP_TIME SetWakeupTime; +typedef +EFI_STATUS +(EFIAPI *EFI_PROTOCOLS_PER_HANDLE) ( + IN EFI_HANDLE UserHandle, + OUT EFI_GUID ***ProtocolBuffer, + OUT UINTN *ProtocolBufferCount + ); - /* Virtual memory services */ +typedef +EFI_STATUS +(EFIAPI *EFI_LOCATE_HANDLE_BUFFER) ( + IN EFI_LOCATE_SEARCH_TYPE SearchType, + IN EFI_GUID *Protocol OPTIONAL, + IN VOID *SearchKey OPTIONAL, + IN OUT UINTN *NumberHandles, + OUT EFI_HANDLE **Buffer + ); - EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap; - EFI_CONVERT_POINTER ConvertPointer; +typedef +EFI_STATUS +(EFIAPI *EFI_LOCATE_PROTOCOL) ( + EFI_GUID *Protocol, + VOID *Registration, OPTIONAL + VOID **Interface + ); - /* Variable serviers */ +typedef +EFI_STATUS +(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) ( + IN OUT EFI_HANDLE *Handle, + ... + ); - EFI_GET_VARIABLE GetVariable; - EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName; - EFI_SET_VARIABLE SetVariable; +typedef +EFI_STATUS +(EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) ( + IN EFI_HANDLE Handle, + ... + ); - /* Misc */ +typedef +EFI_STATUS +(EFIAPI *EFI_CALCULATE_CRC32) ( + IN VOID *Data, + IN UINTN DataSize, + OUT UINT32 *Crc32 + ); - EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount; - EFI_RESET_SYSTEM ResetSystem; +typedef +VOID +(EFIAPI *EFI_COPY_MEM) ( + IN VOID *Destination, + IN VOID *Source, + IN UINTN Length + ); -} EFI_RUNTIME_SERVICES; +typedef +VOID +(EFIAPI *EFI_SET_MEM) ( + IN VOID *Buffer, + IN UINTN Size, + IN UINT8 Value + ); +// +// Standard EFI table header +// -/* - * EFI Boot Services Table - */ +typedef struct _EFI_TABLE_HEARDER { + UINT64 Signature; + UINT32 Revision; + UINT32 HeaderSize; + UINT32 CRC32; + UINT32 Reserved; +} EFI_TABLE_HEADER; -#define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42 -#define EFI_BOOT_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION) -typedef struct _EFI_BOOT_SERVICES { +// +// EFI Runtime Serivces Table +// - EFI_TABLE_HEADER Hdr; +#define EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552 +#define EFI_RUNTIME_SERVICES_REVISION ((EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)) - /* Task priority functions */ +typedef struct { + EFI_TABLE_HEADER Hdr; - EFI_RAISE_TPL RaiseTPL; - EFI_RESTORE_TPL RestoreTPL; + // + // Time services + // - /* Memory functions */ + EFI_GET_TIME GetTime; + EFI_SET_TIME SetTime; + EFI_GET_WAKEUP_TIME GetWakeupTime; + EFI_SET_WAKEUP_TIME SetWakeupTime; - EFI_ALLOCATE_PAGES AllocatePages; - EFI_FREE_PAGES FreePages; - EFI_GET_MEMORY_MAP GetMemoryMap; - EFI_ALLOCATE_POOL AllocatePool; - EFI_FREE_POOL FreePool; + // + // Virtual memory services + // - /* Event & timer functions */ + EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap; + EFI_CONVERT_POINTER ConvertPointer; - EFI_CREATE_EVENT CreateEvent; - EFI_SET_TIMER SetTimer; - EFI_WAIT_FOR_EVENT WaitForEvent; - EFI_SIGNAL_EVENT SignalEvent; - EFI_CLOSE_EVENT CloseEvent; - EFI_CHECK_EVENT CheckEvent; + // + // Variable serviers + // - /* Protocol handler functions */ + EFI_GET_VARIABLE GetVariable; + EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName; + EFI_SET_VARIABLE SetVariable; - EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface; - EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface; - EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface; - EFI_HANDLE_PROTOCOL HandleProtocol; - EFI_HANDLE_PROTOCOL PCHandleProtocol; - EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify; - EFI_LOCATE_HANDLE LocateHandle; - EFI_LOCATE_DEVICE_PATH LocateDevicePath; - EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable; + // + // Misc + // - /* Image functions */ + EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount; + EFI_RESET_SYSTEM ResetSystem; - EFI_IMAGE_LOAD LoadImage; - EFI_IMAGE_START StartImage; - EFI_EXIT Exit; - EFI_IMAGE_UNLOAD UnloadImage; - EFI_EXIT_BOOT_SERVICES ExitBootServices; +} EFI_RUNTIME_SERVICES; - /* Misc functions */ - EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount; - EFI_STALL Stall; - EFI_SET_WATCHDOG_TIMER SetWatchdogTimer; +// +// EFI Boot Services Table +// + +#define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42 +#define EFI_BOOT_SERVICES_REVISION ((EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)) + +typedef struct { + + EFI_TABLE_HEADER Hdr; + + // + // Task priority functions + // + + EFI_RAISE_TPL RaiseTPL; + EFI_RESTORE_TPL RestoreTPL; + + // + // Memory functions + // + + EFI_ALLOCATE_PAGES AllocatePages; + EFI_FREE_PAGES FreePages; + EFI_GET_MEMORY_MAP GetMemoryMap; + EFI_ALLOCATE_POOL AllocatePool; + EFI_FREE_POOL FreePool; + + // + // Event & timer functions + // + + EFI_CREATE_EVENT CreateEvent; + EFI_SET_TIMER SetTimer; + EFI_WAIT_FOR_EVENT WaitForEvent; + EFI_SIGNAL_EVENT SignalEvent; + EFI_CLOSE_EVENT CloseEvent; + EFI_CHECK_EVENT CheckEvent; + + // + // Protocol handler functions + // + + EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface; + EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface; + EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface; + EFI_HANDLE_PROTOCOL HandleProtocol; + VOID *Reserved; + EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify; + EFI_LOCATE_HANDLE LocateHandle; + EFI_LOCATE_DEVICE_PATH LocateDevicePath; + EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable; + + // + // Image functions + // + + EFI_IMAGE_LOAD LoadImage; + EFI_IMAGE_START StartImage; + EFI_EXIT Exit; + EFI_IMAGE_UNLOAD UnloadImage; + EFI_EXIT_BOOT_SERVICES ExitBootServices; + + // + // Misc functions + // + + EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount; + EFI_STALL Stall; + EFI_SET_WATCHDOG_TIMER SetWatchdogTimer; + + // + // DriverSupport Services + // + EFI_CONNECT_CONTROLLER ConnectController; + EFI_DISCONNECT_CONTROLLER DisconnectController; + + // + // Open and Close Protocol Services + // + EFI_OPEN_PROTOCOL OpenProtocol; + EFI_CLOSE_PROTOCOL CloseProtocol; + EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation; + + // + // Library Services to reduce size of drivers + // + EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle; + EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer; + EFI_LOCATE_PROTOCOL LocateProtocol; + + EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces; + EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces; + + // + // CRC32 services + // + EFI_CALCULATE_CRC32 CalculateCrc32; + + // + // Memory Utility Services + // + EFI_COPY_MEM CopyMem; + EFI_SET_MEM SetMem; } EFI_BOOT_SERVICES; -/* - * EFI Configuration Table and GUID definitions - */ +// +// EFI Configuration Table and GUID definitions +// #define MPS_TABLE_GUID \ - { 0xeb9d2d2f, 0x2d88, 0x11d3, { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } } + { 0xeb9d2d2f, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } #define ACPI_TABLE_GUID \ - { 0xeb9d2d30, 0x2d88, 0x11d3, { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } } + { 0xeb9d2d30, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } #define ACPI_20_TABLE_GUID \ - { 0x8868e871, 0xe4f1, 0x11d3, { 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } } + { 0x8868e871, 0xe4f1, 0x11d3, 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } #define SMBIOS_TABLE_GUID \ - { 0xeb9d2d31, 0x2d88, 0x11d3, { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } } + { 0xeb9d2d31, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } #define SAL_SYSTEM_TABLE_GUID \ - { 0xeb9d2d32, 0x2d88, 0x11d3, { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } } + { 0xeb9d2d32, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } -/* DIG64 Headless Console & Debug Port Table. */ -#define HCDP_TABLE_GUID \ - {0xf951938d,0x620b,0x42ef,{0x82,0x79,0xa8,0x4b,0x79,0x61,0x78,0x98}} typedef struct _EFI_CONFIGURATION_TABLE { - EFI_GUID VendorGuid; - VOID *VendorTable; + EFI_GUID VendorGuid; + VOID *VendorTable; } EFI_CONFIGURATION_TABLE; -/* - * EFI System Table - */ +// +// EFI System Table +// #define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249 -#define EFI_SYSTEM_TABLE_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION) +#define EFI_SYSTEM_TABLE_REVISION ((EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)) +#define EFI_1_10_SYSTEM_TABLE_REVISION ((1<<16) | 10) +#define EFI_1_02_SYSTEM_TABLE_REVISION ((1<<16) | 02) typedef struct _EFI_SYSTEM_TABLE { - EFI_TABLE_HEADER Hdr; + EFI_TABLE_HEADER Hdr; - CHAR16 *FirmwareVendor; - UINT32 FirmwareRevision; + CHAR16 *FirmwareVendor; + UINT32 FirmwareRevision; - EFI_HANDLE ConsoleInHandle; - SIMPLE_INPUT_INTERFACE *ConIn; + EFI_HANDLE ConsoleInHandle; + SIMPLE_INPUT_INTERFACE *ConIn; - EFI_HANDLE ConsoleOutHandle; - SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut; + EFI_HANDLE ConsoleOutHandle; + SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut; - EFI_HANDLE StandardErrorHandle; - SIMPLE_TEXT_OUTPUT_INTERFACE *StdErr; + EFI_HANDLE StandardErrorHandle; + SIMPLE_TEXT_OUTPUT_INTERFACE *StdErr; - EFI_RUNTIME_SERVICES *RuntimeServices; - EFI_BOOT_SERVICES *BootServices; + EFI_RUNTIME_SERVICES *RuntimeServices; + EFI_BOOT_SERVICES *BootServices; - UINTN NumberOfTableEntries; - EFI_CONFIGURATION_TABLE *ConfigurationTable; + UINTN NumberOfTableEntries; + EFI_CONFIGURATION_TABLE *ConfigurationTable; } EFI_SYSTEM_TABLE; diff --git a/sys/boot/efi/include/eficon.h b/sys/boot/efi/include/eficon.h index a288571..ef4af81 100644 --- a/sys/boot/efi/include/eficon.h +++ b/sys/boot/efi/include/eficon.h @@ -4,7 +4,14 @@ /*++ -Copyright (c) 1998 Intel Corporation +Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved +This software and associated documentation (if any) is furnished +under a license and may only be used or copied in accordance +with the terms of the license. Except as permitted by such +license, no part of this software or documentation may be +reproduced, stored in a retrieval system, or transmitted in any +form or by any means without the express written consent of +Intel Corporation. Module Name: @@ -20,9 +27,9 @@ Revision History --*/ -/* - * Text output protocol - */ +// +// Text output protocol +// #define SIMPLE_TEXT_OUTPUT_PROTOCOL \ { 0x387477c2, 0x69c7, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } @@ -126,7 +133,7 @@ EFI_STATUS typedef struct { INT32 MaxMode; - /* current settings */ + // current settings INT32 Mode; INT32 Attribute; INT32 CursorColumn; @@ -148,13 +155,13 @@ typedef struct _SIMPLE_TEXT_OUTPUT_INTERFACE { EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition; EFI_TEXT_ENABLE_CURSOR EnableCursor; - /* Current mode */ + // Current mode SIMPLE_TEXT_OUTPUT_MODE *Mode; } SIMPLE_TEXT_OUTPUT_INTERFACE; -/* - * Define's for required EFI Unicode Box Draw character - */ +// +// Define's for required EFI Unicode Box Draw character +// #define BOXDRAW_HORIZONTAL 0x2500 #define BOXDRAW_VERTICAL 0x2502 @@ -206,29 +213,31 @@ typedef struct _SIMPLE_TEXT_OUTPUT_INTERFACE { #define BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL 0x256b #define BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL 0x256c -/* - * EFI Required Block Elements Code Chart - */ +// +// EFI Required Block Elements Code Chart +// + #define BLOCKELEMENT_FULL_BLOCK 0x2588 #define BLOCKELEMENT_LIGHT_SHADE 0x2591 +// +// EFI Required Geometric Shapes Code Chart +// -/* - * EFI Required Geometric Shapes Code Chart - */ #define GEOMETRICSHAPE_UP_TRIANGLE 0x25b2 #define GEOMETRICSHAPE_RIGHT_TRIANGLE 0x25ba #define GEOMETRICSHAPE_DOWN_TRIANGLE 0x25bc #define GEOMETRICSHAPE_LEFT_TRIANGLE 0x25c4 -/* - * EFI Required Arrow shapes - */ +// +// EFI Required Arrow shapes +// + #define ARROW_UP 0x2191 #define ARROW_DOWN 0x2193 -/* - * Text input protocol - */ +// +// Text input protocol +// #define SIMPLE_TEXT_INPUT_PROTOCOL \ { 0x387477c1, 0x69c7, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } @@ -240,9 +249,9 @@ typedef struct { CHAR16 UnicodeChar; } EFI_INPUT_KEY; -/* - * Baseline unicode control chars - */ +// +// Baseline unicode control chars +// #define CHAR_NULL 0x0000 #define CHAR_BACKSPACE 0x0008 @@ -250,9 +259,10 @@ typedef struct { #define CHAR_LINEFEED 0x000A #define CHAR_CARRIAGE_RETURN 0x000D -/* - * Scan codes for base line keys - */ +// +// Scan codes for base line keys +// + #define SCAN_NULL 0x0000 #define SCAN_UP 0x0001 #define SCAN_DOWN 0x0002 diff --git a/sys/boot/efi/include/efidebug.h b/sys/boot/efi/include/efidebug.h index 5214737..5576d5f 100644 --- a/sys/boot/efi/include/efidebug.h +++ b/sys/boot/efi/include/efidebug.h @@ -4,7 +4,14 @@ /*++ -Copyright (c) 1998 Intel Corporation +Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved +This software and associated documentation (if any) is furnished +under a license and may only be used or copied in accordance +with the terms of the license. Except as permitted by such +license, no part of this software or documentation may be +reproduced, stored in a retrieval system, or transmitted in any +form or by any means without the express written consent of +Intel Corporation. Module Name: @@ -44,32 +51,38 @@ extern UINTN EFIDebug; #endif -#define D_INIT 0x00000001 /* Initialization style messages */ -#define D_WARN 0x00000002 /* Warnings */ -#define D_LOAD 0x00000004 /* Load events */ -#define D_FS 0x00000008 /* EFI File system */ -#define D_POOL 0x00000010 /* Alloc & Free's */ -#define D_PAGE 0x00000020 /* Alloc & Free's */ -#define D_INFO 0x00000040 /* Verbose */ -#define D_VAR 0x00000100 /* Variable */ -#define D_PARSE 0x00000200 /* Command parsing */ -#define D_BM 0x00000400 /* Boot manager */ -#define D_BLKIO 0x00001000 /* BlkIo Driver */ -#define D_BLKIO_ULTRA 0x00002000 /* BlkIo Driver */ -#define D_NET 0x00004000 /* SNI Driver */ -#define D_NET_ULTRA 0x00008000 /* SNI Driver */ -#define D_TXTIN 0x00010000 /* Simple Input Driver */ -#define D_TXTOUT 0x00020000 /* Simple Text Output Driver */ -#define D_ERROR_ATA 0x00040000 /* ATA error messages */ -#define D_ERROR 0x80000000 /* Error */ - -#define D_RESERVED 0x7fffC880 /* Bits not reserved above */ - -/* - * Current Debug level of the system, value of EFIDebug - */ +#define D_INIT 0x00000001 // Initialization style messages +#define D_WARN 0x00000002 // Warnings +#define D_LOAD 0x00000004 // Load events +#define D_FS 0x00000008 // EFI File system +#define D_POOL 0x00000010 // Alloc & Free's +#define D_PAGE 0x00000020 // Alloc & Free's +#define D_INFO 0x00000040 // Verbose +#define D_VARIABLE 0x00000100 // Variable +#define D_VAR 0x00000100 // Variable +#define D_BM 0x00000400 // Boot Manager +#define D_BLKIO 0x00001000 // BlkIo Driver +#define D_BLKIO_ULTRA 0x00002000 // BlkIo Driver +#define D_NET 0x00004000 // SNI Driver +#define D_NET_ULTRA 0x00008000 // SNI Driver +#define D_UNDI 0x00010000 // UNDI Driver +#define D_LOADFILE 0x00020000 // UNDI Driver +#define D_EVENT 0x00080000 // Event messages + +#define D_ERROR 0x80000000 // Error + +#define D_RESERVED 0x7ff40A80 // Bits not reserved above + +// +// Current Debug level of the system, value of EFIDebug +// +//#define EFI_DBUG_MASK (D_ERROR | D_WARN | D_LOAD | D_BLKIO | D_INIT) #define EFI_DBUG_MASK (D_ERROR) +// +// +// + #if EFI_DEBUG #define ASSERT(a) if(!(a)) DBGASSERT(a) @@ -84,9 +97,9 @@ extern UINTN EFIDebug; #endif -/* - * Prototypes - */ +// +// Prototypes +// INTN DbgAssert ( diff --git a/sys/boot/efi/include/efidef.h b/sys/boot/efi/include/efidef.h index 2bd7f9b..2d5d7ef 100644 --- a/sys/boot/efi/include/efidef.h +++ b/sys/boot/efi/include/efidef.h @@ -4,7 +4,14 @@ /*++ -Copyright (c) 1998 Intel Corporation +Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved +This software and associated documentation (if any) is furnished +under a license and may only be used or copied in accordance +with the terms of the license. Except as permitted by such +license, no part of this software or documentation may be +reproduced, stored in a retrieval system, or transmitted in any +form or by any means without the express written consent of +Intel Corporation. Module Name: @@ -41,14 +48,14 @@ typedef VOID *EFI_HANDLE; typedef VOID *EFI_EVENT; -/* - * Prototype argument decoration for EFI parameters to indicate - * their direction - * - * IN - argument is passed into the function - * OUT - argument (pointer) is returned from the function - * OPTIONAL - argument is optional - */ +// +// Prototype argument decoration for EFI parameters to indicate +// their direction +// +// IN - argument is passed into the function +// OUT - argument (pointer) is returned from the function +// OPTIONAL - argument is optional +// #ifndef IN #define IN @@ -57,9 +64,9 @@ typedef VOID *EFI_EVENT; #endif -/* - * A GUID - */ +// +// A GUID +// typedef struct { UINT32 Data1; @@ -69,36 +76,36 @@ typedef struct { } EFI_GUID; -/* - * Time - */ +// +// Time +// typedef struct { - UINT16 Year; /* 1998 - 20XX */ - UINT8 Month; /* 1 - 12 */ - UINT8 Day; /* 1 - 31 */ - UINT8 Hour; /* 0 - 23 */ - UINT8 Minute; /* 0 - 59 */ - UINT8 Second; /* 0 - 59 */ - UINT8 Pad1; - UINT32 Nanosecond; /* 0 - 999,999,999 */ - INT16 TimeZone; /* -1440 to 1440 or 2047 */ - UINT8 Daylight; - UINT8 Pad2; + UINT16 Year; // 1998 - 20XX + UINT8 Month; // 1 - 12 + UINT8 Day; // 1 - 31 + UINT8 Hour; // 0 - 23 + UINT8 Minute; // 0 - 59 + UINT8 Second; // 0 - 59 + UINT8 Pad1; + UINT32 Nanosecond; // 0 - 999,999,999 + INT16 TimeZone; // -1440 to 1440 or 2047 + UINT8 Daylight; + UINT8 Pad2; } EFI_TIME; -/* Bit definitions for EFI_TIME.Daylight */ +// Bit definitions for EFI_TIME.Daylight #define EFI_TIME_ADJUST_DAYLIGHT 0x01 #define EFI_TIME_IN_DAYLIGHT 0x02 -/* Value definition for EFI_TIME.TimeZone */ +// Value definition for EFI_TIME.TimeZone #define EFI_UNSPECIFIED_TIMEZONE 0x07FF -/* - * Networking - */ +// +// Networking +// typedef struct { UINT8 Addr[4]; @@ -112,9 +119,9 @@ typedef struct { UINT8 Addr[32]; } EFI_MAC_ADDRESS; -/* - * Memory - */ +// +// Memory +// typedef UINT64 EFI_PHYSICAL_ADDRESS; typedef UINT64 EFI_VIRTUAL_ADDRESS; @@ -126,13 +133,12 @@ typedef enum { MaxAllocateType } EFI_ALLOCATE_TYPE; -/* - * Preseve the attr on any range supplied. - * ConventialMemory must have WB,SR,SW when supplied. - * When allocating from ConventialMemory always make it WB,SR,SW - * When returning to ConventialMemory always make it WB,SR,SW - * When getting the memory map, or on RT for runtime types - */ +//Preseve the attr on any range supplied. +//ConventialMemory must have WB,SR,SW when supplied. +//When allocating from ConventialMemory always make it WB,SR,SW +//When returning to ConventialMemory always make it WB,SR,SW +//When getting the memory map, or on RT for runtime types + typedef enum { EfiReservedMemoryType, @@ -152,42 +158,46 @@ typedef enum { EfiMaxMemoryType } EFI_MEMORY_TYPE; -/* possible caching types for the memory range */ +// possible caching types for the memory range #define EFI_MEMORY_UC 0x0000000000000001 #define EFI_MEMORY_WC 0x0000000000000002 #define EFI_MEMORY_WT 0x0000000000000004 #define EFI_MEMORY_WB 0x0000000000000008 #define EFI_MEMORY_UCE 0x0000000000000010 -/* physical memory protection on range */ +// physical memory protection on range #define EFI_MEMORY_WP 0x0000000000001000 #define EFI_MEMORY_RP 0x0000000000002000 #define EFI_MEMORY_XP 0x0000000000004000 -/* range requires a runtime mapping */ +// range requires a runtime mapping #define EFI_MEMORY_RUNTIME 0x8000000000000000 #define EFI_MEMORY_DESCRIPTOR_VERSION 1 typedef struct { - UINT32 Type; /* 32 bit padding */ - EFI_PHYSICAL_ADDRESS PhysicalStart; - EFI_VIRTUAL_ADDRESS VirtualStart; - UINT64 NumberOfPages; - UINT64 Attribute; + UINT32 Type; // Field size is 32 bits followed by 32 bit pad + EFI_PHYSICAL_ADDRESS PhysicalStart; // Field size is 64 bits + EFI_VIRTUAL_ADDRESS VirtualStart; // Field size is 64 bits + UINT64 NumberOfPages; // Field size is 64 bits + UINT64 Attribute; // Field size is 64 bits } EFI_MEMORY_DESCRIPTOR; -/* - * International Language - */ +// +// International Language +// typedef UINT8 ISO_639_2; #define ISO_639_2_ENTRY_SIZE 3 +// +// +// + #define EFI_PAGE_SIZE 4096 #define EFI_PAGE_MASK 0xFFF #define EFI_PAGE_SHIFT 12 #define EFI_SIZE_TO_PAGES(a) \ - ( ((a) >> EFI_PAGE_SHIFT) + ((a) & EFI_PAGE_MASK ? 1 : 0) ) + ( ((a) >> EFI_PAGE_SHIFT) + (((a) & EFI_PAGE_MASK) ? 1 : 0) ) #endif diff --git a/sys/boot/efi/include/efidevp.h b/sys/boot/efi/include/efidevp.h index ebd6b3b..a332af5 100644 --- a/sys/boot/efi/include/efidevp.h +++ b/sys/boot/efi/include/efidevp.h @@ -4,7 +4,14 @@ /*++ -Copyright (c) 1998 Intel Corporation +Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved +This software and associated documentation (if any) is furnished +under a license and may only be used or copied in accordance +with the terms of the license. Except as permitted by such +license, no part of this software or documentation may be +reproduced, stored in a retrieval system, or transmitted in any +form or by any means without the express written consent of +Intel Corporation. Module Name: @@ -20,9 +27,9 @@ Revision History --*/ -/* - * Device Path structures - Section C - */ +// +// Device Path structures - Section C +// typedef struct _EFI_DEVICE_PATH { UINT8 Type; @@ -33,7 +40,9 @@ typedef struct _EFI_DEVICE_PATH { #define EFI_DP_TYPE_MASK 0x7F #define EFI_DP_TYPE_UNPACKED 0x80 +//#define END_DEVICE_PATH_TYPE 0xff #define END_DEVICE_PATH_TYPE 0x7f +//#define END_DEVICE_PATH_TYPE_UNPACKED 0x7f #define END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff #define END_INSTANCE_DEVICE_PATH_SUBTYPE 0x01 @@ -47,6 +56,7 @@ typedef struct _EFI_DEVICE_PATH { #define DevicePathSubType(a) ( (a)->SubType ) #define DevicePathNodeLength(a) ( ((a)->Length[0]) | ((a)->Length[1] << 8) ) #define NextDevicePathNode(a) ( (EFI_DEVICE_PATH *) ( ((UINT8 *) (a)) + DevicePathNodeLength(a))) +//#define IsDevicePathEndType(a) ( DevicePathType(a) == END_DEVICE_PATH_TYPE_UNPACKED ) #define IsDevicePathEndType(a) ( DevicePathType(a) == END_DEVICE_PATH_TYPE ) #define IsDevicePathEndSubType(a) ( (a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE ) #define IsDevicePathEnd(a) ( IsDevicePathEndType(a) && IsDevicePathEndSubType(a) ) @@ -82,7 +92,7 @@ typedef struct _PCI_DEVICE_PATH { #define HW_PCCARD_DP 0x02 typedef struct _PCCARD_DEVICE_PATH { EFI_DEVICE_PATH Header; - UINT8 SocketNumber; + UINT8 FunctionNumber; } PCCARD_DEVICE_PATH; #define HW_MEMMAP_DP 0x03 @@ -125,16 +135,25 @@ typedef struct _ACPI_HID_DEVICE_PATH { UINT32 UID; } ACPI_HID_DEVICE_PATH; -/* - * EISA ID Macro - * EISA ID Definition 32-bits - * bits[15:0] - three character compressed ASCII EISA ID. - * bits[31:16] - binary number - * Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z' - */ +#define ACPI_EXTENDED_DP 0x02 +typedef struct _ACPI_EXTENDED_HID_DEVICE_PATH { + EFI_DEVICE_PATH Header; + UINT32 HID; + UINT32 UID; + UINT32 CID; +} ACPI_EXTENDED_HID_DEVICE_PATH; + +// +// EISA ID Macro +// EISA ID Definition 32-bits +// bits[15:0] - three character compressed ASCII EISA ID. +// bits[31:16] - binary number +// Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z' +// #define PNP_EISA_ID_CONST 0x41d0 #define EISA_ID(_Name, _Num) ((UINT32) ((_Name) | (_Num) << 16)) #define EISA_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId))) +#define EFI_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId))) #define PNP_EISA_ID_MASK 0xffff #define EISA_ID_TO_NUM(_Id) ((_Id) >> 16) @@ -175,9 +194,9 @@ typedef struct _F1394_DEVICE_PATH { #define MSG_USB_DP 0x05 typedef struct _USB_DEVICE_PATH { - EFI_DEVICE_PATH Header; - UINT8 Port; - UINT8 Endpoint; + EFI_DEVICE_PATH Header; + UINT8 ParentPortNumber; + UINT8 InterfaceNumber; } USB_DEVICE_PATH; #define MSG_USB_CLASS_DP 0x0F @@ -186,7 +205,7 @@ typedef struct _USB_CLASS_DEVICE_PATH { UINT16 VendorId; UINT16 ProductId; UINT8 DeviceClass; - UINT8 DeviceSubclass; + UINT8 DeviceSubClass; UINT8 DeviceProtocol; } USB_CLASS_DEVICE_PATH; @@ -227,13 +246,20 @@ typedef struct _IPv6_DEVICE_PATH { #define MSG_INFINIBAND_DP 0x09 typedef struct _INFINIBAND_DEVICE_PATH { - EFI_DEVICE_PATH Header; - UINT32 Reserved; - UINT64 NodeGuid; - UINT64 IocGuid; - UINT64 DeviceId; + EFI_DEVICE_PATH Header; + UINT32 ResourceFlags; + UINT8 PortGid[16]; + UINT64 ServiceId; + UINT64 TargetPortId; + UINT64 DeviceId; } INFINIBAND_DEVICE_PATH; +#define INFINIBAND_RESOURCE_FLAG_IOC_SERVICE 0x01 +#define INFINIBAND_RESOURCE_FLAG_EXTENDED_BOOT_ENVIRONMENT 0x02 +#define INFINIBAND_RESOURCE_FLAG_CONSOLE_PROTOCOL 0x04 +#define INFINIBAND_RESOURCE_FLAG_STORAGE_PROTOCOL 0x08 +#define INFINIBAND_RESOURCE_FLAG_NETWORK_PROTOCOL 0x10 + #define MSG_UART_DP 0x0e typedef struct _UART_DEVICE_PATH { EFI_DEVICE_PATH Header; @@ -253,6 +279,11 @@ typedef struct _UART_DEVICE_PATH { #define DEVICE_PATH_MESSAGING_VT_100 \ { 0xdfa66065, 0xb419, 0x11d3, 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } +#define DEVICE_PATH_MESSAGING_VT_100_PLUS \ + { 0x7baec70b, 0x57e0, 0x4c76, 0x8e, 0x87, 0x2f, 0x9e, 0x28, 0x08, 0x83, 0x43 } + +#define DEVICE_PATH_MESSAGING_VT_UTF8 \ + { 0xad15a0d6, 0x8bec, 0x4acf, 0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88 } #define MEDIA_DEVICE_PATH 0x04 @@ -362,6 +393,7 @@ typedef union { UNKNOWN_DEVICE_VENDOR_DEVICE_PATH *UnknownVendor; CONTROLLER_DEVICE_PATH *Controller; ACPI_HID_DEVICE_PATH *Acpi; + ACPI_EXTENDED_HID_DEVICE_PATH *ExtendedAcpi; ATAPI_DEVICE_PATH *Atapi; SCSI_DEVICE_PATH *Scsi; diff --git a/sys/boot/efi/include/efierr.h b/sys/boot/efi/include/efierr.h index a6db90c..dc57f0e 100644 --- a/sys/boot/efi/include/efierr.h +++ b/sys/boot/efi/include/efierr.h @@ -4,7 +4,14 @@ /*++ -Copyright (c) 1998 Intel Corporation +Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved +This software and associated documentation (if any) is furnished +under a license and may only be used or copied in accordance +with the terms of the license. Except as permitted by such +license, no part of this software or documentation may be +reproduced, stored in a retrieval system, or transmitted in any +form or by any means without the express written consent of +Intel Corporation. Module Name: @@ -52,7 +59,7 @@ Revision History #define EFI_TFTP_ERROR EFIERR(23) #define EFI_PROTOCOL_ERROR EFIERR(24) -#define EFI_WARN_UNKOWN_GLYPH EFIWARN(1) +#define EFI_WARN_UNKNOWN_GLYPH EFIWARN(1) #define EFI_WARN_DELETE_FAILURE EFIWARN(2) #define EFI_WARN_WRITE_FAILURE EFIWARN(3) #define EFI_WARN_BUFFER_TOO_SMALL EFIWARN(4) diff --git a/sys/boot/efi/include/efifs.h b/sys/boot/efi/include/efifs.h index 8ef3615..58febb6 100644 --- a/sys/boot/efi/include/efifs.h +++ b/sys/boot/efi/include/efifs.h @@ -4,7 +4,14 @@ /*++ -Copyright (c) 1998 Intel Corporation +Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved +This software and associated documentation (if any) is furnished +under a license and may only be used or copied in accordance +with the terms of the license. Except as permitted by such +license, no part of this software or documentation may be +reproduced, stored in a retrieval system, or transmitted in any +form or by any means without the express written consent of +Intel Corporation. Module Name: @@ -21,9 +28,9 @@ Revision History --*/ -/* - * EFI Partition header (normaly starts in LBA 1) - */ +// +// EFI Partition header (normaly starts in LBA 1) +// #define EFI_PARTITION_SIGNATURE 0x5053595320494249 #define EFI_PARTITION_REVISION 0x00010001 @@ -43,9 +50,9 @@ typedef struct _EFI_PARTITION_HEADER { } EFI_PARTITION_HEADER; -/* - * File header - */ +// +// File header +// #define EFI_FILE_HEADER_SIGNATURE 0x454c494620494249 #define EFI_FILE_HEADER_REVISION 0x00010000 @@ -65,10 +72,10 @@ typedef struct _EFI_FILE_HEADER { } EFI_FILE_HEADER; -/* - * Return the file's first LBAL which is in the same - * logical block as the file header - */ +// +// Return the file's first LBAL which is in the same +// logical block as the file header +// #define EFI_FILE_LBAL(a) ((EFI_LBAL *) (((CHAR8 *) (a)) + (a)->LBALOffset)) @@ -77,10 +84,10 @@ typedef struct _EFI_FILE_HEADER { #define EFI_FILE_CLASS_NORMAL 3 -/* - * Logical Block Address List - the fundemental block - * description structure - */ +// +// Logical Block Address List - the fundemental block +// description structure +// #define EFI_LBAL_SIGNATURE 0x4c41424c20494249 #define EFI_LBAL_REVISION 0x00010000 @@ -94,22 +101,22 @@ typedef struct _EFI_LBAL { UINT32 ArrayCount; } EFI_LBAL; -/* Array size */ +// Array size #define EFI_LBAL_ARRAY_SIZE(lbal,offs,blks) \ (((blks) - (offs) - (lbal)->Hdr.HeaderSize) / sizeof(EFI_RL)) -/* - * Logical Block run-length - */ +// +// Logical Block run-length +// typedef struct { EFI_LBA Start; UINT64 Length; } EFI_RL; -/* - * Return the run-length structure from an LBAL header - */ +// +// Return the run-length structure from an LBAL header +// #define EFI_LBAL_RL(a) ((EFI_RL*) (((CHAR8 *) (a)) + (a)->Hdr.HeaderSize)) diff --git a/sys/boot/efi/include/efilib.h b/sys/boot/efi/include/efilib.h index abd3e50..acb1c31 100644 --- a/sys/boot/efi/include/efilib.h +++ b/sys/boot/efi/include/efilib.h @@ -26,11 +26,17 @@ * $FreeBSD$ */ +#include <efifpswa.h> + extern EFI_HANDLE IH; extern EFI_SYSTEM_TABLE *ST; extern EFI_BOOT_SERVICES *BS; extern EFI_RUNTIME_SERVICES *RS; +/* DIG64 Headless Console & Debug Port Table. */ +#define HCDP_TABLE_GUID \ + {0xf951938d,0x620b,0x42ef,{0x82,0x79,0xa8,0x4b,0x79,0x61,0x78,0x98}} + void *efi_get_table(EFI_GUID *tbl); void efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table); diff --git a/sys/boot/efi/include/efinet.h b/sys/boot/efi/include/efinet.h index c137ef8..b4996d9 100644 --- a/sys/boot/efi/include/efinet.h +++ b/sys/boot/efi/include/efinet.h @@ -4,7 +4,14 @@ /*++ -Copyright (c) 1999 Intel Corporation +Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved +This software and associated documentation (if any) is furnished +under a license and may only be used or copied in accordance +with the terms of the license. Except as permitted by such +license, no part of this software or documentation may be +reproduced, stored in a retrieval system, or transmitted in any +form or by any means without the express written consent of +Intel Corporation. Module Name: efinet.h @@ -16,55 +23,78 @@ Revision History --*/ +/////////////////////////////////////////////////////////////////////////////// +// +// Simple Network Protocol +// + #define EFI_SIMPLE_NETWORK_PROTOCOL \ { 0xA19832B9, 0xAC25, 0x11D3, 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } + INTERFACE_DECL(_EFI_SIMPLE_NETWORK); +/////////////////////////////////////////////////////////////////////////////// +// + typedef struct { - /* - * Total number of frames received. Includes frames with errors and - * dropped frames. - */ + // + // Total number of frames received. Includes frames with errors and + // dropped frames. + // UINT64 RxTotalFrames; - /* Number of valid frames received and copied into receive buffers. */ + // + // Number of valid frames received and copied into receive buffers. + // UINT64 RxGoodFrames; - /* - * Number of frames below the minimum length for the media. - * This would be <64 for ethernet. - */ + // + // Number of frames below the minimum length for the media. + // This would be <64 for ethernet. + // UINT64 RxUndersizeFrames; - /* - * Number of frames longer than the maxminum length for the - * media. This would be >1500 for ethernet. - */ + // + // Number of frames longer than the maxminum length for the + // media. This would be >1500 for ethernet. + // UINT64 RxOversizeFrames; - /* Valid frames that were dropped because receive buffers were full. */ + // + // Valid frames that were dropped because receive buffers were full. + // UINT64 RxDroppedFrames; - /* Number of valid unicast frames received and not dropped. */ + // + // Number of valid unicast frames received and not dropped. + // UINT64 RxUnicastFrames; - /* Number of valid broadcast frames received and not dropped. */ + // + // Number of valid broadcast frames received and not dropped. + // UINT64 RxBroadcastFrames; - /* Number of valid mutlicast frames received and not dropped. */ + // + // Number of valid mutlicast frames received and not dropped. + // UINT64 RxMulticastFrames; - /* Number of frames w/ CRC or alignment errors. */ + // + // Number of frames w/ CRC or alignment errors. + // UINT64 RxCrcErrorFrames; - /* - * Total number of bytes received. Includes frames with errors - * and dropped frames. - */ + // + // Total number of bytes received. Includes frames with errors + // and dropped frames. + // UINT64 RxTotalBytes; - /* Transmit statistics. */ + // + // Transmit statistics. + // UINT64 TxTotalFrames; UINT64 TxGoodFrames; UINT64 TxUndersizeFrames; @@ -76,14 +106,21 @@ typedef struct { UINT64 TxCrcErrorFrames; UINT64 TxTotalBytes; - /* Number of collisions detection on this subnet. */ + // + // Number of collisions detection on this subnet. + // UINT64 Collisions; - /* Number of frames destined for unsupported protocol. */ + // + // Number of frames destined for unsupported protocol. + // UINT64 UnsupportedProtocol; } EFI_NETWORK_STATISTICS; +/////////////////////////////////////////////////////////////////////////////// +// + typedef enum { EfiSimpleNetworkStopped, EfiSimpleNetworkStarted, @@ -91,17 +128,25 @@ typedef enum { EfiSimpleNetworkMaxState } EFI_SIMPLE_NETWORK_STATE; +/////////////////////////////////////////////////////////////////////////////// +// + #define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST 0x01 #define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST 0x02 #define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST 0x04 #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS 0x08 #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10 +/////////////////////////////////////////////////////////////////////////////// +// + #define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT 0x01 #define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT 0x02 #define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT 0x04 #define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT 0x08 +/////////////////////////////////////////////////////////////////////////////// +// #define MAX_MCAST_FILTER_CNT 16 typedef struct { UINT32 State; @@ -125,18 +170,27 @@ typedef struct { BOOLEAN MediaPresent; } EFI_SIMPLE_NETWORK_MODE; +/////////////////////////////////////////////////////////////////////////////// +// + typedef EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_START) ( IN struct _EFI_SIMPLE_NETWORK *This ); +/////////////////////////////////////////////////////////////////////////////// +// + typedef EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_STOP) ( IN struct _EFI_SIMPLE_NETWORK *This ); +/////////////////////////////////////////////////////////////////////////////// +// + typedef EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_INITIALIZE) ( @@ -145,6 +199,9 @@ EFI_STATUS IN UINTN ExtraTxBufferSize OPTIONAL ); +/////////////////////////////////////////////////////////////////////////////// +// + typedef EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_RESET) ( @@ -152,12 +209,18 @@ EFI_STATUS IN BOOLEAN ExtendedVerification ); +/////////////////////////////////////////////////////////////////////////////// +// + typedef EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_SHUTDOWN) ( IN struct _EFI_SIMPLE_NETWORK *This ); +/////////////////////////////////////////////////////////////////////////////// +// + typedef EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE_FILTERS) ( @@ -169,6 +232,9 @@ EFI_STATUS IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL ); +/////////////////////////////////////////////////////////////////////////////// +// + typedef EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_STATION_ADDRESS) ( @@ -177,6 +243,9 @@ EFI_STATUS IN EFI_MAC_ADDRESS *New OPTIONAL ); +/////////////////////////////////////////////////////////////////////////////// +// + typedef EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_STATISTICS) ( @@ -186,6 +255,9 @@ EFI_STATUS OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL ); +/////////////////////////////////////////////////////////////////////////////// +// + typedef EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC) ( @@ -195,6 +267,9 @@ EFI_STATUS OUT EFI_MAC_ADDRESS *MAC ); +/////////////////////////////////////////////////////////////////////////////// +// + typedef EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_NVDATA) ( @@ -205,6 +280,9 @@ EFI_STATUS IN OUT VOID *Buffer ); +/////////////////////////////////////////////////////////////////////////////// +// + typedef EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_GET_STATUS) ( @@ -213,6 +291,9 @@ EFI_STATUS OUT VOID **TxBuf OPTIONAL ); +/////////////////////////////////////////////////////////////////////////////// +// + typedef EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_TRANSMIT) ( @@ -225,6 +306,9 @@ EFI_STATUS IN UINT16 *Protocol OPTIONAL ); +/////////////////////////////////////////////////////////////////////////////// +// + typedef EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE) ( @@ -237,6 +321,9 @@ EFI_STATUS OUT UINT16 *Protocol OPTIONAL ); +/////////////////////////////////////////////////////////////////////////////// +// + #define EFI_SIMPLE_NETWORK_INTERFACE_REVISION 0x00010000 typedef struct _EFI_SIMPLE_NETWORK { diff --git a/sys/boot/efi/include/efipart.h b/sys/boot/efi/include/efipart.h index b504bd9..ef1a870 100644 --- a/sys/boot/efi/include/efipart.h +++ b/sys/boot/efi/include/efipart.h @@ -4,7 +4,14 @@ /*++ -Copyright (c) 1998 Intel Corporation +Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved +This software and associated documentation (if any) is furnished +under a license and may only be used or copied in accordance +with the terms of the license. Except as permitted by such +license, no part of this software or documentation may be +reproduced, stored in a retrieval system, or transmitted in any +form or by any means without the express written consent of +Intel Corporation. Module Name: @@ -20,6 +27,10 @@ Revision History --*/ +// +// +// + #define EFI_PARTITION 0xef #define MBR_SIZE 512 @@ -42,7 +53,7 @@ typedef struct { #define MBR_SIGNATURE 0xaa55 #define MIN_MBR_DEVICE_SIZE 0x80000 -#define MBR_ERRATA_PAD 0x40000 /* 128 MB */ +#define MBR_ERRATA_PAD 0x40000 // 128 MB #define MAX_MBR_PARTITIONS 4 typedef struct { diff --git a/sys/boot/efi/include/efiprot.h b/sys/boot/efi/include/efiprot.h index d81d605..fac4568 100644 --- a/sys/boot/efi/include/efiprot.h +++ b/sys/boot/efi/include/efiprot.h @@ -4,7 +4,14 @@ /*++ -Copyright (c) 1998 Intel Corporation +Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved +This software and associated documentation (if any) is furnished +under a license and may only be used or copied in accordance +with the terms of the license. Except as permitted by such +license, no part of this software or documentation may be +reproduced, stored in a retrieval system, or transmitted in any +form or by any means without the express written consent of +Intel Corporation. Module Name: @@ -20,17 +27,17 @@ Revision History --*/ -/* - * Device Path protocol - */ +// +// Device Path protocol +// #define DEVICE_PATH_PROTOCOL \ { 0x9576e91, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } -/* - * Block IO protocol - */ +// +// Block IO protocol +// #define BLOCK_IO_PROTOCOL \ { 0x964e5b21, 0x6459, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } @@ -104,9 +111,9 @@ typedef struct _EFI_BLOCK_IO { -/* - * Disk Block IO protocol - */ +// +// Disk Block IO protocol +// #define DISK_IO_PROTOCOL \ { 0xce345171, 0xba0b, 0x11d2, 0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } @@ -143,9 +150,9 @@ typedef struct _EFI_DISK_IO { } EFI_DISK_IO; -/* - * Simple filesystem protocol - */ +// +// Simple file system protocol +// #define SIMPLE_FILE_SYSTEM_PROTOCOL \ { 0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } @@ -167,6 +174,10 @@ typedef struct _EFI_FILE_IO_INTERFACE { EFI_VOLUME_OPEN OpenVolume; } EFI_FILE_IO_INTERFACE; +// +// +// + typedef EFI_STATUS (EFIAPI *EFI_FILE_OPEN) ( @@ -177,12 +188,12 @@ EFI_STATUS IN UINT64 Attributes ); -/* Open modes */ +// Open modes #define EFI_FILE_MODE_READ 0x0000000000000001 #define EFI_FILE_MODE_WRITE 0x0000000000000002 #define EFI_FILE_MODE_CREATE 0x8000000000000000 -/* File attributes */ +// File attributes #define EFI_FILE_READ_ONLY 0x0000000000000001 #define EFI_FILE_HIDDEN 0x0000000000000002 #define EFI_FILE_SYSTEM 0x0000000000000004 @@ -275,9 +286,9 @@ typedef struct _EFI_FILE_HANDLE { } EFI_FILE, *EFI_FILE_HANDLE; -/* - * File information types - */ +// +// File information types +// #define EFI_FILE_INFO_ID \ { 0x9576e92, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } @@ -293,14 +304,13 @@ typedef struct { CHAR16 FileName[1]; } EFI_FILE_INFO; -/* - * The FileName field of the EFI_FILE_INFO data structure is variable length. - * Whenever code needs to know the size of the EFI_FILE_INFO data structure, - * it needs to be the size of the data structure without the FileName field. - * The following macro computes this size correctly no matter how big the - * FileName array is declared. This is required to make the EFI_FILE_INFO - * data structure ANSI compliant. - */ +// +// The FileName field of the EFI_FILE_INFO data structure is variable length. +// Whenever code needs to know the size of the EFI_FILE_INFO data structure, it needs to +// be the size of the data structure without the FileName field. The following macro +// computes this size correctly no matter how big the FileName array is declared. +// This is required to make the EFI_FILE_INFO data structure ANSI compilant. +// #define SIZE_OF_EFI_FILE_INFO EFI_FIELD_OFFSET(EFI_FILE_INFO,FileName) @@ -316,15 +326,13 @@ typedef struct { CHAR16 VolumeLabel[1]; } EFI_FILE_SYSTEM_INFO; -/* - * The VolumeLabel field of the EFI_FILE_SYSTEM_INFO data structure is - * variable length. Whenever code needs to know the size of the - * EFI_FILE_SYSTEM_INFO data structure, it needs to be the size of the data - * structure without the VolumeLable field. The following macro computes - * this size correctly no matter how big the VolumeLable array is declared. - * This is required to make the EFI_FILE_SYSTEM_INFO data structure ANSI - * compilant. - */ +// +// The VolumeLabel field of the EFI_FILE_SYSTEM_INFO data structure is variable length. +// Whenever code needs to know the size of the EFI_FILE_SYSTEM_INFO data structure, it needs +// to be the size of the data structure without the VolumeLable field. The following macro +// computes this size correctly no matter how big the VolumeLable array is declared. +// This is required to make the EFI_FILE_SYSTEM_INFO data structure ANSI compilant. +// #define SIZE_OF_EFI_FILE_SYSTEM_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_INFO,VolumeLabel) @@ -337,9 +345,10 @@ typedef struct { #define SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_VOLUME_LABEL_INFO,VolumeLabel) -/* - * Load file protocol - */ +// +// Load file protocol +// + #define LOAD_FILE_PROTOCOL \ { 0x56EC3091, 0x954C, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B } @@ -361,9 +370,9 @@ typedef struct _EFI_LOAD_FILE_INTERFACE { } EFI_LOAD_FILE_INTERFACE; -/* - * Device IO protocol - */ +// +// Device IO protocol +// #define DEVICE_IO_PROTOCOL \ { 0xaf6ac311, 0x84c3, 0x11d2, 0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } @@ -375,19 +384,17 @@ typedef enum { IO_UINT16, IO_UINT32, IO_UINT64, -/* - * Specification Change: Copy from MMIO to MMIO vs. MMIO to buffer, buffer to - * MMIO - */ +// +// Specification Change: Copy from MMIO to MMIO vs. MMIO to buffer, buffer to MMIO +// MMIO_COPY_UINT8, MMIO_COPY_UINT16, MMIO_COPY_UINT32, MMIO_COPY_UINT64 } EFI_IO_WIDTH; -#define EFI_PCI_ADDRESS(_bus,_dev,_func) \ - ( (UINT64) ( (((UINTN)_bus) << 24) + (((UINTN)_dev) << 16) + (((UINTN)_func) << 8) ) ) - +#define EFI_PCI_ADDRESS(bus,dev,func,reg) \ + ( (UINT64) ( (((UINTN)bus) << 24) + (((UINTN)dev) << 16) + (((UINTN)func) << 8) + ((UINTN)reg) )) typedef EFI_STATUS @@ -473,9 +480,9 @@ typedef struct _EFI_DEVICE_IO_INTERFACE { } EFI_DEVICE_IO_INTERFACE; -/* - * Unicode Collation protocol - */ +// +// Unicode Collation protocol +// #define UNICODE_COLLATION_PROTOCOL \ { 0x1d85cd7f, 0xf43d, 0x11d2, 0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } @@ -486,7 +493,7 @@ INTERFACE_DECL(_EFI_UNICODE_COLLATION_INTERFACE); typedef INTN -(EFIAPI *EFI_UNICODE_STRICOLL) ( +(EFIAPI *EFI_UNICODE_COLLATION_STRICOLL) ( IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, IN CHAR16 *s1, IN CHAR16 *s2 @@ -494,7 +501,7 @@ INTN typedef BOOLEAN -(EFIAPI *EFI_UNICODE_METAIMATCH) ( +(EFIAPI *EFI_UNICODE_COLLATION_METAIMATCH) ( IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, IN CHAR16 *String, IN CHAR16 *Pattern @@ -502,21 +509,21 @@ BOOLEAN typedef VOID -(EFIAPI *EFI_UNICODE_STRLWR) ( +(EFIAPI *EFI_UNICODE_COLLATION_STRLWR) ( IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, IN OUT CHAR16 *Str ); typedef VOID -(EFIAPI *EFI_UNICODE_STRUPR) ( +(EFIAPI *EFI_UNICODE_COLLATION_STRUPR) ( IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, IN OUT CHAR16 *Str ); typedef VOID -(EFIAPI *EFI_UNICODE_FATTOSTR) ( +(EFIAPI *EFI_UNICODE_COLLATION_FATTOSTR) ( IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, IN UINTN FatSize, IN CHAR8 *Fat, @@ -525,7 +532,7 @@ VOID typedef BOOLEAN -(EFIAPI *EFI_UNICODE_STRTOFAT) ( +(EFIAPI *EFI_UNICODE_COLLATION_STRTOFAT) ( IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, IN CHAR16 *String, IN UINTN FatSize, @@ -535,15 +542,15 @@ BOOLEAN typedef struct _EFI_UNICODE_COLLATION_INTERFACE { - /* general */ - EFI_UNICODE_STRICOLL StriColl; - EFI_UNICODE_METAIMATCH MetaiMatch; - EFI_UNICODE_STRLWR StrLwr; - EFI_UNICODE_STRUPR StrUpr; + // general + EFI_UNICODE_COLLATION_STRICOLL StriColl; + EFI_UNICODE_COLLATION_METAIMATCH MetaiMatch; + EFI_UNICODE_COLLATION_STRLWR StrLwr; + EFI_UNICODE_COLLATION_STRUPR StrUpr; - /* for supporting fat volumes */ - EFI_UNICODE_FATTOSTR FatToStr; - EFI_UNICODE_STRTOFAT StrToFat; + // for supporting fat volumes + EFI_UNICODE_COLLATION_FATTOSTR FatToStr; + EFI_UNICODE_COLLATION_STRTOFAT StrToFat; CHAR8 *SupportedLanguages; } EFI_UNICODE_COLLATION_INTERFACE; diff --git a/sys/boot/efi/include/efipxebc.h b/sys/boot/efi/include/efipxebc.h index 7a6df76..3781a67 100644 --- a/sys/boot/efi/include/efipxebc.h +++ b/sys/boot/efi/include/efipxebc.h @@ -4,7 +4,14 @@ /*++ -Copyright (c) 1998 Intel Corporation +Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved +This software and associated documentation (if any) is furnished +under a license and may only be used or copied in accordance +with the terms of the license. Except as permitted by such +license, no part of this software or documentation may be +reproduced, stored in a retrieval system, or transmitted in any +form or by any means without the express written consent of +Intel Corporation. Module Name: @@ -20,21 +27,20 @@ Revision History --*/ -/* - * PXE Base Code protocol - */ +// +// PXE Base Code protocol +// #define EFI_PXE_BASE_CODE_PROTOCOL \ { 0x03c4e603, 0xac28, 0x11d3, 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } INTERFACE_DECL(_EFI_PXE_BASE_CODE); -#define DEFAULT_TTL 4 +#define DEFAULT_TTL 8 #define DEFAULT_ToS 0 - -/* - * Address definitions - */ +// +// Address definitions +// typedef union { UINT32 Addr[4]; @@ -44,9 +50,9 @@ typedef union { typedef UINT16 EFI_PXE_BASE_CODE_UDP_PORT; -/* - * Packet definitions - */ +// +// Packet definitions +// typedef struct { UINT8 BootpOpcode; @@ -67,9 +73,15 @@ typedef struct { UINT8 DhcpOptions[56]; } EFI_PXE_BASE_CODE_DHCPV4_PACKET; +// TBD in EFI v1.1 +//typedef struct { +// UINT8 reserved; +//} EFI_PXE_BASE_CODE_DHCPV6_PACKET; + typedef union { UINT8 Raw[1472]; EFI_PXE_BASE_CODE_DHCPV4_PACKET Dhcpv4; +// EFI_PXE_BASE_CODE_DHCPV6_PACKET Dhcpv6; } EFI_PXE_BASE_CODE_PACKET; typedef struct { @@ -93,9 +105,9 @@ typedef struct { CHAR8 ErrorString[127]; } EFI_PXE_BASE_CODE_TFTP_ERROR; -/* - * IP Receive Filter definitions - */ +// +// IP Receive Filter definitions +// #define EFI_PXE_BASE_CODE_MAX_IPCNT 8 typedef struct { UINT8 Filters; @@ -109,9 +121,9 @@ typedef struct { #define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS 0x0004 #define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST 0x0008 -/* - * ARP Cache definitions - */ +// +// ARP Cache definitions +// typedef struct { EFI_IP_ADDRESS IpAddr; @@ -124,9 +136,9 @@ typedef struct { EFI_IP_ADDRESS GwAddr; } EFI_PXE_BASE_CODE_ROUTE_ENTRY; -/* - * UDP definitions - */ +// +// UDP definitions +// #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP 0x0001 #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT 0x0002 @@ -135,9 +147,9 @@ typedef struct { #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_FILTER 0x0010 #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_MAY_FRAGMENT 0x0020 -/* - * Discover() definitions - */ +// +// Discover() definitions +// #define EFI_PXE_BASE_CODE_BOOT_TYPE_BOOTSTRAP 0 #define EFI_PXE_BASE_CODE_BOOT_TYPE_MS_WINNT_RIS 1 @@ -156,15 +168,16 @@ typedef struct { #define EFI_PXE_BASE_CODE_BOOT_TYPE_REDHAT_BOOT 14 #define EFI_PXE_BASE_CODE_BOOT_TYPE_REMBO 15 #define EFI_PXE_BASE_CODE_BOOT_TYPE_BEOBOOT 16 -/* - * 17 through 32767 are reserved - * 32768 through 65279 are for vendor use - * 65280 through 65534 are reserved - */ +// +// 17 through 32767 are reserved +// 32768 through 65279 are for vendor use +// 65280 through 65534 are reserved +// #define EFI_PXE_BASE_CODE_BOOT_TYPE_PXETEST 65535 #define EFI_PXE_BASE_CODE_BOOT_LAYER_MASK 0x7FFF #define EFI_PXE_BASE_CODE_BOOT_LAYER_INITIAL 0x0000 +#define EFI_PXE_BASE_CODE_BOOT_LAYER_CREDENTIALS 0x8000 typedef struct { @@ -184,9 +197,9 @@ typedef struct { EFI_PXE_BASE_CODE_SRVLIST SrvList[1]; } EFI_PXE_BASE_CODE_DISCOVER_INFO; -/* - * Mtftp() definitions - */ +// +// Mtftp() definitions +// typedef enum { EFI_PXE_BASE_CODE_TFTP_FIRST, @@ -208,9 +221,9 @@ typedef struct { UINT16 TransmitTimeout; } EFI_PXE_BASE_CODE_MTFTP_INFO; -/* - * PXE Base Code Mode structure - */ +// +// PXE Base Code Mode structure +// #define EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES 8 #define EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES 8 @@ -252,9 +265,9 @@ typedef struct { EFI_PXE_BASE_CODE_TFTP_ERROR TftpError; } EFI_PXE_BASE_CODE_MODE; -/* - * PXE Base Code Interface Function definitions - */ +// +// PXE Base Code Interface Function definitions +// typedef EFI_STATUS @@ -293,7 +306,7 @@ EFI_STATUS IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation, IN OUT VOID *BufferPtr OPTIONAL, IN BOOLEAN Overwrite, - IN OUT UINTN *BufferSize, + IN OUT UINT64 *BufferSize, IN UINTN *BlockSize OPTIONAL, IN EFI_IP_ADDRESS *ServerIp, IN UINT8 *Filename, @@ -384,9 +397,9 @@ EFI_STATUS IN EFI_PXE_BASE_CODE_PACKET *NewPxeBisReply OPTIONAL ); -/* - * PXE Base Code Protocol structure - */ +// +// PXE Base Code Protocol structure +// #define EFI_PXE_BASE_CODE_INTERFACE_REVISION 0x00010000 @@ -407,16 +420,16 @@ typedef struct _EFI_PXE_BASE_CODE { EFI_PXE_BASE_CODE_MODE *Mode; } EFI_PXE_BASE_CODE; -/* - * Call Back Definitions - */ +// +// Call Back Definitions +// #define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL \ { 0x245dca21, 0xfb7b, 0x11d3, 0x8f, 0x01, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } -/* - * Revision Number - */ +// +// Revision Number +// #define EFI_PXE_BASE_CODE_CALLBACK_INTERFACE_REVISION 0x00010000 diff --git a/sys/boot/efi/include/efiser.h b/sys/boot/efi/include/efiser.h index e2d63bd..1f3fe4a 100644 --- a/sys/boot/efi/include/efiser.h +++ b/sys/boot/efi/include/efiser.h @@ -4,7 +4,14 @@ /*++ -Copyright (c) 1998 Intel Corporation +Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved +This software and associated documentation (if any) is furnished +under a license and may only be used or copied in accordance +with the terms of the license. Except as permitted by such +license, no part of this software or documentation may be +reproduced, stored in a retrieval system, or transmitted in any +form or by any means without the express written consent of +Intel Corporation. Module Name: @@ -18,9 +25,9 @@ Revision History --*/ -/* - * Serial protocol - */ +// +// Serial protocol +// #define SERIAL_IO_PROTOCOL \ { 0xBB25CF6F, 0xF1D4, 0x11D2, 0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD } @@ -37,23 +44,23 @@ typedef enum { } EFI_PARITY_TYPE; typedef enum { - DefaultStopBits, - OneStopBit, - OneFiveStopBits, - TwoStopBits + DefaultStopBits, + OneStopBit, // 1 stop bit + OneFiveStopBits, // 1.5 stop bits + TwoStopBits // 2 stop bits } EFI_STOP_BITS_TYPE; -#define EFI_SERIAL_CLEAR_TO_SEND 0x0010 -#define EFI_SERIAL_DATA_SET_READY 0x0020 -#define EFI_SERIAL_RING_INDICATE 0x0040 -#define EFI_SERIAL_CARRIER_DETECT 0x0080 -#define EFI_SERIAL_REQUEST_TO_SEND 0x0002 -#define EFI_SERIAL_DATA_TERMINAL_READY 0x0001 -#define EFI_SERIAL_INPUT_BUFFER_EMPTY 0x0100 -#define EFI_SERIAL_OUTPUT_BUFFER_EMPTY 0x0200 -#define EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE 0x1000 -#define EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE 0x2000 -#define EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE 0x4000 +#define EFI_SERIAL_CLEAR_TO_SEND 0x0010 // RO +#define EFI_SERIAL_DATA_SET_READY 0x0020 // RO +#define EFI_SERIAL_RING_INDICATE 0x0040 // RO +#define EFI_SERIAL_CARRIER_DETECT 0x0080 // RO +#define EFI_SERIAL_REQUEST_TO_SEND 0x0002 // WO +#define EFI_SERIAL_DATA_TERMINAL_READY 0x0001 // WO +#define EFI_SERIAL_INPUT_BUFFER_EMPTY 0x0100 // RO +#define EFI_SERIAL_OUTPUT_BUFFER_EMPTY 0x0200 // RO +#define EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE 0x1000 // RW +#define EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE 0x2000 // RW +#define EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE 0x4000 // RW typedef EFI_STATUS @@ -106,7 +113,7 @@ EFI_STATUS typedef struct { UINT32 ControlMask; - /* current Attributes. */ + // current Attributes UINT32 Timeout; UINT64 BaudRate; UINT32 ReceiveFifoDepth; diff --git a/sys/boot/efi/include/efistdarg.h b/sys/boot/efi/include/efistdarg.h index 68c2221..25f5569 100644 --- a/sys/boot/efi/include/efistdarg.h +++ b/sys/boot/efi/include/efistdarg.h @@ -4,7 +4,14 @@ /*++ -Copyright (c) 1998 Intel Corporation +Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved +This software and associated documentation (if any) is furnished +under a license and may only be used or copied in accordance +with the terms of the license. Except as permitted by such +license, no part of this software or documentation may be +reproduced, stored in a retrieval system, or transmitted in any +form or by any means without the express written consent of +Intel Corporation. Module Name: diff --git a/sys/boot/efi/include/i386/efibind.h b/sys/boot/efi/include/i386/efibind.h index 1c62eb6..f28057b 100644 --- a/sys/boot/efi/include/i386/efibind.h +++ b/sys/boot/efi/include/i386/efibind.h @@ -1,7 +1,14 @@ /* $FreeBSD$ */ /*++ -Copyright (c) 1998 Intel Corporation +Copyright (c) 1999 - 2003 Intel Corporation. All rights reserved +This software and associated documentation (if any) is furnished +under a license and may only be used or copied in accordance +with the terms of the license. Except as permitted by such +license, no part of this software or documentation may be +reproduced, stored in a retrieval system, or transmitted in any +form or by any means without the express written consent of +Intel Corporation. Module Name: @@ -21,17 +28,20 @@ Revision History #pragma pack() -/* - * Basic int types of various widths - */ +#ifdef __FreeBSD__ +#include <sys/stdint.h> +#else +// +// Basic int types of various widths +// #if (__STDC_VERSION__ < 199901L ) -/* No ANSI C 1999/2000 stdint.h integer width declarations */ + // No ANSI C 1999/2000 stdint.h integer width declarations #if _MSC_EXTENSIONS -/* Use Microsoft C compiler integer width declarations */ + // Use Microsoft C compiler integer width declarations typedef unsigned __int64 uint64_t; typedef __int64 int64_t; @@ -44,7 +54,7 @@ Revision History #else #ifdef UNIX_LP64 -/* Use LP64 programming model from C_FLAGS for integer width declarations */ + // Use LP64 programming model from C_FLAGS for integer width declarations typedef unsigned long uint64_t; typedef long int64_t; @@ -56,7 +66,7 @@ Revision History typedef char int8_t; #else -/* Assume P64 programming model from C_FLAGS for integer width declarations */ + // Assume P64 programming model from C_FLAGS for integer width declarations typedef unsigned long long uint64_t; typedef long long int64_t; @@ -69,10 +79,11 @@ Revision History #endif #endif #endif +#endif /* __FreeBSD__ */ -/* - * Basic EFI types of various widths - */ +// +// Basic EFI types of various widths +// typedef uint64_t UINT64; typedef int64_t INT64; @@ -113,15 +124,11 @@ typedef uint32_t UINTN; #define BAD_POINTER 0xFBFBFBFB #define MAX_ADDRESS 0xFFFFFFFF -#ifdef EFI_NT_EMULATOR - #define BREAKPOINT() __asm { int 3 } -#else - #define BREAKPOINT() while (TRUE); -#endif +#define BREAKPOINT() __asm { int 3 } -/* - * Pointers must be aligned to these address to function - */ +// +// Pointers must be aligned to these address to function +// #define MIN_ALIGNMENT_SIZE 4 @@ -132,108 +139,125 @@ typedef uint32_t UINTN; Value = (UINTN)Value + (UINTN)Adjustment -/* - * Define macros to build data structure signatures from characters. - */ +// +// Define macros to build data structure signatures from characters. +// #define EFI_SIGNATURE_16(A,B) ((A) | (B<<8)) #define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16)) #define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32)) -/* - * To export & import functions in the EFI emulator environment - */ - -#if EFI_NT_EMULATOR - #define EXPORTAPI __declspec( dllexport ) -#else - #define EXPORTAPI -#endif - +// +// EFIAPI - prototype calling convention for EFI function pointers +// BOOTSERVICE - prototype for implementation of a boot service interface +// RUNTIMESERVICE - prototype for implementation of a runtime service interface +// RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service +// RUNTIME_CODE - pragma macro for declaring runtime code +// -/* - * EFIAPI - prototype calling convention for EFI function pointers - * BOOTSERVICE - prototype for implementation of a boot service interface - * RUNTIMESERVICE - prototype for implementation of a runtime service interface - * RUNTIMEFUNCTION - prototype for implementation of a runtime function that - * is not a service - * RUNTIME_CODE - pragma macro for declaring runtime code - */ - -/* Forces EFI calling conventions reguardless of compiler options */ -#ifndef EFIAPI +#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options #if _MSC_EXTENSIONS - #define EFIAPI __cdecl + #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler #else - #define EFIAPI + #define EFIAPI // Substitute expresion to force C calling convention #endif #endif #define BOOTSERVICE +//#define RUNTIMESERVICE(proto,a) alloc_text("rtcode",a); proto a +//#define RUNTIMEFUNCTION(proto,a) alloc_text("rtcode",a); proto a #define RUNTIMESERVICE #define RUNTIMEFUNCTION #define RUNTIME_CODE(a) alloc_text("rtcode", a) #define BEGIN_RUNTIME_DATA() data_seg("rtdata") -#define END_RUNTIME_DATA() data_seg("") +#define END_RUNTIME_DATA() data_seg() #define VOLATILE volatile #define MEMORY_FENCE() +#ifdef EFI_NO_INTERFACE_DECL + #define EFI_FORWARD_DECLARATION(x) + #define EFI_INTERFACE_DECL(x) +#else + #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x + #define EFI_INTERFACE_DECL(x) typedef struct x +#endif + #ifdef EFI_NT_EMULATOR -/* - * To help ensure proper coding of integrated drivers, they are - * compiled as DLLs. In NT they require a dll init entry pointer. - * The macro puts a stub entry point into the DLL so it will load. - */ - -#define EFI_DRIVER_ENTRY_POINT(InitFunction) \ - UINTN \ - __stdcall \ - _DllMainCRTStartup ( \ - UINTN Inst, \ - UINTN reason_for_call, \ - VOID *rserved \ - ) \ - { \ - return 1; \ - } \ - \ - int \ - EXPORTAPI \ - __cdecl \ - InitializeDriver ( \ - void *ImageHandle, \ - void *SystemTable \ - ) \ - { \ - return InitFunction(ImageHandle, SystemTable); \ +// +// To help ensure proper coding of integrated drivers, they are +// compiled as DLLs. In NT they require a dll init entry pointer. +// The macro puts a stub entry point into the DLL so it will load. +// + +#define EFI_DRIVER_ENTRY_POINT(InitFunction) \ + EFI_STATUS \ + InitFunction ( \ + EFI_HANDLE ImageHandle, \ + EFI_SYSTEM_TABLE *SystemTable \ + ); \ + \ + UINTN \ + __stdcall \ + _DllMainCRTStartup ( \ + UINTN Inst, \ + UINTN reason_for_call, \ + VOID *rserved \ + ) \ + { \ + return 1; \ + } \ + \ + int \ + __declspec( dllexport ) \ + __cdecl \ + InitializeDriver ( \ + void *ImageHandle, \ + void *SystemTable \ + ) \ + { \ + return InitFunction(ImageHandle, SystemTable); \ } #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ (_if)->LoadInternal(type, name, NULL) -#else /* EFI_NT_EMULATOR */ +#else // EFI_NT_EMULATOR -/* - * When build similiar to FW, then link everything together as - * one big module. - */ +// +// When build similiar to FW, then link everything together as +// one big module. +// #define EFI_DRIVER_ENTRY_POINT(InitFunction) #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ (_if)->LoadInternal(type, name, entry) -#endif /* EFI_FW_NT */ +#endif // EFI_FW_NT +#ifdef __FreeBSD__ #define INTERFACE_DECL(x) struct x +#else +// +// Some compilers don't support the forward reference construct: +// typedef struct XXXXX +// +// The following macro provide a workaround for such cases. +// +#ifdef NO_INTERFACE_DECL +#define INTERFACE_DECL(x) +#else +#define INTERFACE_DECL(x) typedef struct x +#endif +#endif /* __FreeBSD__ */ #if _MSC_EXTENSIONS -#pragma warning ( disable : 4731 ) +#pragma warning ( disable : 4731 ) // Suppress warnings about modification of EBP #endif diff --git a/sys/boot/efi/include/i386/pe.h b/sys/boot/efi/include/i386/pe.h index 1120464..0381a44 100644 --- a/sys/boot/efi/include/i386/pe.h +++ b/sys/boot/efi/include/i386/pe.h @@ -589,4 +589,43 @@ typedef struct _IMAGE_IMPORT_DESCRIPTOR { PIMAGE_THUNK_DATA FirstThunk; } IMAGE_IMPORT_DESCRIPTOR, *PIMAGE_IMPORT_DESCRIPTOR; +#define IMAGE_DEBUG_TYPE_CODEVIEW 2 + +typedef struct { + UINT32 Characteristics; + UINT32 TimeDateStamp; + UINT16 MajorVersion; + UINT16 MinorVersion; + UINT32 Type; + UINT32 SizeOfData; + UINT32 RVA; + UINT32 FileOffset; +} IMAGE_DEBUG_DIRECTORY_ENTRY; + +#define CODEVIEW_SIGNATURE_NB10 0x3031424E // "NB10" + +typedef struct { + UINT32 Signature; // "NB10" + UINT32 Unknown; + UINT32 Unknown2; + UINT32 Unknown3; + // + // Filename of .PDB goes here + // +} EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY; + +#define CODEVIEW_SIGNATURE_RSDS 0x53445352 // "RSDS" + +typedef struct { + UINT32 Signature; // "RSDS" + UINT32 Unknown; + UINT32 Unknown2; + UINT32 Unknown3; + UINT32 Unknown4; + UINT32 Unknown5; + // + // Filename of .PDB goes here + // +} EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY; + #endif diff --git a/sys/boot/efi/include/ia64/efibind.h b/sys/boot/efi/include/ia64/efibind.h index 0c77dca..21f0d25 100644 --- a/sys/boot/efi/include/ia64/efibind.h +++ b/sys/boot/efi/include/ia64/efibind.h @@ -1,7 +1,14 @@ /* $FreeBSD$ */ /*++ -Copyright (c) 1998 Intel Corporation +Copyright (c) 1999 - 2003 Intel Corporation. All rights reserved +This software and associated documentation (if any) is furnished +under a license and may only be used or copied in accordance +with the terms of the license. Except as permitted by such +license, no part of this software or documentation may be +reproduced, stored in a retrieval system, or transmitted in any +form or by any means without the express written consent of +Intel Corporation. Module Name: @@ -18,9 +25,66 @@ Revision History --*/ +#pragma pack() + + +#ifdef __FreeBSD__ #include <sys/stdint.h> +#else +// +// Basic int types of various widths +// + +#if (__STDC_VERSION__ < 199901L ) + + // No ANSI C 1999/2000 stdint.h integer width declarations + + #if _MSC_EXTENSIONS + + // Use Microsoft C compiler integer width declarations + + typedef unsigned __int64 uint64_t; + typedef __int64 int64_t; + typedef unsigned __int32 uint32_t; + typedef __int32 int32_t; + typedef unsigned __int16 uint16_t; + typedef __int16 int16_t; + typedef unsigned __int8 uint8_t; + typedef __int8 int8_t; + #else + #ifdef UNIX_LP64 + + // Use LP64 programming model from C_FLAGS for integer width declarations + + typedef unsigned long uint64_t; + typedef long int64_t; + typedef unsigned int uint32_t; + typedef int int32_t; + typedef unsigned short uint16_t; + typedef short int16_t; + typedef unsigned char uint8_t; + typedef char int8_t; + #else + + // Assume P64 programming model from C_FLAGS for integer width declarations + + typedef unsigned long long uint64_t; + typedef long long int64_t; + typedef unsigned int uint32_t; + typedef int int32_t; + typedef unsigned short uint16_t; + typedef short int16_t; + typedef unsigned char uint8_t; + typedef char int8_t; + #endif + #endif +#endif +#endif /* __FreeBSD__ */ + +// +// Basic EFI types of various widths +// -/* Basic EFI types of various widths. */ typedef uint64_t UINT64; typedef int64_t INT64; @@ -39,17 +103,22 @@ typedef int8_t INT8; typedef int64_t INTN; typedef uint64_t UINTN; -/* - *XXX BugBug: Code to debug - */ +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// BugBug: Code to debug +// #define BIT63 0x8000000000000000 -#define PLATFORM_IOBASE_ADDRESS (0xffffc000000 | BIT63) +#define PLATFORM_IOBASE_ADDRESS (0xffffc000000 | BIT63) #define PORT_TO_MEMD(_Port) (PLATFORM_IOBASE_ADDRESS | ( ( ( (_Port) & 0xfffc) << 10 ) | ( (_Port) & 0x0fff) ) ) - -/* Macro's with casts make this much easier to use and read. */ + +// +// Macro's with casts make this much easier to use and read. +// #define PORT_TO_MEM8D(_Port) (*(UINT8 *)(PORT_TO_MEMD(_Port))) #define POST_CODE(_Data) (PORT_TO_MEM8D(0x80) = (_Data)) +// +// BugBug: End Debug Code!!! +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #define EFIERR(a) (0x8000000000000000 | a) #define EFI_ERROR_MASK 0x8000000000000000 @@ -58,12 +127,13 @@ typedef uint64_t UINTN; #define BAD_POINTER 0xFBFBFBFBFBFBFBFB #define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF -#define BREAKPOINT() while (TRUE) +#pragma intrinsic (__break) +#define BREAKPOINT() __break(0) -/* - * Pointers must be aligned to these address to function - * you will get an alignment fault if this value is less than 8 - */ +// +// Pointers must be aligned to these address to function +// you will get an alignment fault if this value is less than 8 +// #define MIN_ALIGNMENT_SIZE 8 #define ALIGN_VARIABLE(Value , Adjustment) \ @@ -72,34 +142,28 @@ typedef uint64_t UINTN; (UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \ Value = (UINTN)Value + (UINTN)Adjustment -/* - * Define macros to create data structure signatures. - */ +// +// Define macros to create data structure signatures. +// #define EFI_SIGNATURE_16(A,B) ((A) | (B<<8)) #define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16)) #define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32)) -/* - * To export & import functions in the EFI emulator environment - */ - -#define EXPORTAPI - -/* - * EFIAPI - prototype calling convention for EFI function pointers - * BOOTSERVICE - prototype for implementation of a boot service interface - * RUNTIMESERVICE - prototype for implementation of a runtime service interface - * RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service - * RUNTIME_CODE - pragma macro for declaring runtime code - */ - -#ifndef EFIAPI /* Forces EFI calling conventions reguardless of compiler options */ -#if _MSC_EXTENSIONS -#define EFIAPI __cdecl -#else -#define EFIAPI -#endif +// +// EFIAPI - prototype calling convention for EFI function pointers +// BOOTSERVICE - prototype for implementation of a boot service interface +// RUNTIMESERVICE - prototype for implementation of a runtime service interface +// RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service +// RUNTIME_CODE - pragma macro for declaring runtime code +// + +#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options + #if _MSC_EXTENSIONS + #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler + #else + #define EFIAPI // Substitute expresion to force C calling convention + #endif #endif #define BOOTSERVICE @@ -108,27 +172,48 @@ typedef uint64_t UINTN; #define RUNTIME_CODE(a) alloc_text("rtcode", a) #define BEGIN_RUNTIME_DATA() data_seg("rtdata") -#define END_RUNTIME_DATA() data_seg("") +#define END_RUNTIME_DATA() data_seg() #define VOLATILE volatile -/* - * XXX Need to find out if this is portable across compilers. - */ -void __mf (void); -#ifndef __GNUC__ -#pragma intrinsic (__mf) +// +// BugBug: Need to find out if this is portable accross compliers. +// +void __mfa (void); +#pragma intrinsic (__mfa) +#define MEMORY_FENCE() __mfa() + +#ifdef EFI_NO_INTERFACE_DECL + #define EFI_FORWARD_DECLARATION(x) + #define EFI_INTERFACE_DECL(x) +#else + #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x + #define EFI_INTERFACE_DECL(x) typedef struct x #endif -#define MEMORY_FENCE() __mf() -/* - * When build similiar to FW, then link everything together as - * one big module. - */ +// +// When build similiar to FW, then link everything together as +// one big module. +// #define EFI_DRIVER_ENTRY_POINT(InitFunction) #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ - (_if)->LoadInternal(type, name, entry) + (_if)->LoadInternal(type, name, entry) +// entry(NULL, ST) +#ifdef __FreeBSD__ #define INTERFACE_DECL(x) struct x +#else +// +// Some compilers don't support the forward reference construct: +// typedef struct XXXXX +// +// The following macro provide a workaround for such cases. +// +#ifdef NO_INTERFACE_DECL +#define INTERFACE_DECL(x) +#else +#define INTERFACE_DECL(x) typedef struct x +#endif +#endif diff --git a/sys/boot/efi/include/ia64/pe.h b/sys/boot/efi/include/ia64/pe.h index 59839d2..24480a5 100644 --- a/sys/boot/efi/include/ia64/pe.h +++ b/sys/boot/efi/include/ia64/pe.h @@ -595,4 +595,43 @@ typedef struct _IMAGE_IMPORT_DESCRIPTOR { PIMAGE_THUNK_DATA FirstThunk; } IMAGE_IMPORT_DESCRIPTOR, *PIMAGE_IMPORT_DESCRIPTOR; +#define IMAGE_DEBUG_TYPE_CODEVIEW 2 + +typedef struct { + UINT32 Characteristics; + UINT32 TimeDateStamp; + UINT16 MajorVersion; + UINT16 MinorVersion; + UINT32 Type; + UINT32 SizeOfData; + UINT32 RVA; + UINT32 FileOffset; +} IMAGE_DEBUG_DIRECTORY_ENTRY; + +#define CODEVIEW_SIGNATURE_NB10 0x3031424E // "NB10" + +typedef struct { + UINT32 Signature; // "NB10" + UINT32 Unknown; + UINT32 Unknown2; + UINT32 Unknown3; + // + // Filename of .PDB goes here + // +} EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY; + +#define CODEVIEW_SIGNATURE_RSDS 0x53445352 // "RSDS" + +typedef struct { + UINT32 Signature; // "RSDS" + UINT32 Unknown; + UINT32 Unknown2; + UINT32 Unknown3; + UINT32 Unknown4; + UINT32 Unknown5; + // + // Filename of .PDB goes here + // +} EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY; + #endif |