Home | History | Annotate | Line # | Download | only in inc
efidef.h revision 1.3
      1 /*	$NetBSD: efidef.h,v 1.3 2018/08/16 18:22:05 jmcneill Exp $	*/
      2 
      3 #ifndef _EFI_DEF_H
      4 #define _EFI_DEF_H
      5 
      6 /*++
      7 
      8 Copyright (c) 1998  Intel Corporation
      9 
     10 Module Name:
     11 
     12     efidef.h
     13 
     14 Abstract:
     15 
     16     EFI definitions
     17 
     18 
     19 
     20 
     21 Revision History
     22 
     23 --*/
     24 
     25 typedef UINT16          CHAR16;
     26 typedef UINT8           CHAR8;
     27 typedef UINT8           BOOLEAN;
     28 #ifndef CONST
     29    #define CONST const
     30 #endif
     31 #ifndef TRUE
     32     #define TRUE    ((BOOLEAN) 1)
     33     #define FALSE   ((BOOLEAN) 0)
     34 #endif
     35 
     36 #ifndef NULL
     37     #define NULL    ((VOID *) 0)
     38 #endif
     39 
     40 typedef UINTN           EFI_STATUS;
     41 typedef UINT64          EFI_LBA;
     42 typedef UINTN           EFI_TPL;
     43 typedef VOID            *EFI_HANDLE;
     44 typedef VOID            *EFI_EVENT;
     45 
     46 
     47 //
     48 // Prototype argument decoration for EFI parameters to indicate
     49 // their direction
     50 //
     51 // IN - argument is passed into the function
     52 // OUT - argument (pointer) is returned from the function
     53 // OPTIONAL - argument is optional
     54 //
     55 
     56 #ifndef IN
     57     #define IN
     58     #define OUT
     59     #define OPTIONAL
     60 #endif
     61 
     62 
     63 //
     64 // A GUID
     65 //
     66 
     67 typedef struct {
     68     UINT32  Data1;
     69     UINT16  Data2;
     70     UINT16  Data3;
     71     UINT8   Data4[8];
     72 } EFI_GUID;
     73 
     74 
     75 //
     76 // Time
     77 //
     78 
     79 typedef struct {
     80     UINT16      Year;       // 1998 - 20XX
     81     UINT8       Month;      // 1 - 12
     82     UINT8       Day;        // 1 - 31
     83     UINT8       Hour;       // 0 - 23
     84     UINT8       Minute;     // 0 - 59
     85     UINT8       Second;     // 0 - 59
     86     UINT8       Pad1;
     87     UINT32      Nanosecond; // 0 - 999,999,999
     88     INT16       TimeZone;   // -1440 to 1440 or 2047
     89     UINT8       Daylight;
     90     UINT8       Pad2;
     91 } EFI_TIME;
     92 
     93 // Bit definitions for EFI_TIME.Daylight
     94 #define EFI_TIME_ADJUST_DAYLIGHT    0x01
     95 #define EFI_TIME_IN_DAYLIGHT        0x02
     96 
     97 // Value definition for EFI_TIME.TimeZone
     98 #define EFI_UNSPECIFIED_TIMEZONE    0x07FF
     99 
    100 
    101 
    102 //
    103 // Networking
    104 //
    105 
    106 typedef struct {
    107     UINT8                   Addr[4];
    108 } EFI_IPv4_ADDRESS;
    109 
    110 typedef struct {
    111     UINT8                   Addr[16];
    112 } EFI_IPv6_ADDRESS;
    113 
    114 typedef struct {
    115     UINT8                   Addr[32];
    116 } EFI_MAC_ADDRESS;
    117 
    118 typedef struct {
    119     UINT32 ReceivedQueueTimeoutValue;
    120     UINT32 TransmitQueueTimeoutValue;
    121     UINT16 ProtocolTypeFilter;
    122     BOOLEAN EnableUnicastReceive;
    123     BOOLEAN EnableMulticastReceive;
    124     BOOLEAN EnableBroadcastReceive;
    125     BOOLEAN EnablePromiscuousReceive;
    126     BOOLEAN FlushQueuesOnReset;
    127     BOOLEAN EnableReceiveTimestamps;
    128     BOOLEAN DisableBackgroundPolling;
    129 } EFI_MANAGED_NETWORK_CONFIG_DATA;
    130 
    131 //
    132 // Memory
    133 //
    134 
    135 typedef UINT64          EFI_PHYSICAL_ADDRESS;
    136 typedef UINT64          EFI_VIRTUAL_ADDRESS;
    137 
    138 typedef enum {
    139     AllocateAnyPages,
    140     AllocateMaxAddress,
    141     AllocateAddress,
    142     MaxAllocateType
    143 } EFI_ALLOCATE_TYPE;
    144 
    145 //Preseve the attr on any range supplied.
    146 //ConventialMemory must have WB,SR,SW when supplied.
    147 //When allocating from ConventialMemory always make it WB,SR,SW
    148 //When returning to ConventialMemory always make it WB,SR,SW
    149 //When getting the memory map, or on RT for runtime types
    150 
    151 
    152 typedef enum {
    153     EfiReservedMemoryType,
    154     EfiLoaderCode,
    155     EfiLoaderData,
    156     EfiBootServicesCode,
    157     EfiBootServicesData,
    158     EfiRuntimeServicesCode,
    159     EfiRuntimeServicesData,
    160     EfiConventionalMemory,
    161     EfiUnusableMemory,
    162     EfiACPIReclaimMemory,
    163     EfiACPIMemoryNVS,
    164     EfiMemoryMappedIO,
    165     EfiMemoryMappedIOPortSpace,
    166     EfiPalCode,
    167     EfiPersistentMemory,
    168     EfiMaxMemoryType
    169 } EFI_MEMORY_TYPE;
    170 
    171 // possible caching types for the memory range
    172 #define EFI_MEMORY_UC           0x0000000000000001
    173 #define EFI_MEMORY_WC           0x0000000000000002
    174 #define EFI_MEMORY_WT           0x0000000000000004
    175 #define EFI_MEMORY_WB           0x0000000000000008
    176 #define EFI_MEMORY_UCE          0x0000000000000010
    177 
    178 // physical memory protection on range
    179 #define EFI_MEMORY_WP           0x0000000000001000
    180 #define EFI_MEMORY_RP           0x0000000000002000
    181 #define EFI_MEMORY_XP           0x0000000000004000
    182 
    183 // range requires a runtime mapping
    184 #define EFI_MEMORY_RUNTIME      0x8000000000000000
    185 
    186 #define EFI_MEMORY_DESCRIPTOR_VERSION  1
    187 typedef struct {
    188     UINT32                          Type;           // Field size is 32 bits followed by 32 bit pad
    189     UINT32                          Pad;
    190     EFI_PHYSICAL_ADDRESS            PhysicalStart;  // Field size is 64 bits
    191     EFI_VIRTUAL_ADDRESS             VirtualStart;   // Field size is 64 bits
    192     UINT64                          NumberOfPages;  // Field size is 64 bits
    193     UINT64                          Attribute;      // Field size is 64 bits
    194 } EFI_MEMORY_DESCRIPTOR;
    195 
    196 //
    197 // International Language
    198 //
    199 
    200 typedef UINT8   ISO_639_2;
    201 #define ISO_639_2_ENTRY_SIZE    3
    202 
    203 //
    204 //
    205 //
    206 
    207 #define EFI_PAGE_SIZE   4096
    208 #define EFI_PAGE_MASK   0xFFF
    209 #define EFI_PAGE_SHIFT  12
    210 
    211 #define EFI_SIZE_TO_PAGES(a)  \
    212     ( ((a) >> EFI_PAGE_SHIFT) + ((a) & EFI_PAGE_MASK ? 1 : 0) )
    213 
    214 #define EFI_OS_INDICATIONS_BOOT_TO_FW_UI        0x0000000000000001
    215 #define EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION 0x0000000000000002
    216 #define EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED \
    217                                                 0x0000000000000004
    218 #define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED \
    219                                                 0x0000000000000008
    220 #define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED \
    221                                                 0x0000000000000010
    222 
    223 #endif
    224