Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:05

0001 /* $FreeBSD$ */
0002 #ifndef _EFI_DEF_H
0003 #define _EFI_DEF_H
0004 
0005 /*++
0006 
0007 Copyright (c)  1999 - 2002 Intel Corporation. All rights reserved
0008 This software and associated documentation (if any) is furnished
0009 under a license and may only be used or copied in accordance
0010 with the terms of the license. Except as permitted by such
0011 license, no part of this software or documentation may be
0012 reproduced, stored in a retrieval system, or transmitted in any
0013 form or by any means without the express written consent of
0014 Intel Corporation.
0015 
0016 Module Name:
0017 
0018     efidef.h
0019 
0020 Abstract:
0021 
0022     EFI definitions
0023 
0024 
0025 
0026 
0027 Revision History
0028 
0029 --*/
0030 
0031 typedef UINT16          CHAR16;
0032 typedef UINT8           CHAR8;
0033 #ifndef ACPI_THREAD_ID      /* ACPI's definitions are fine */
0034 typedef UINT8           BOOLEAN;
0035 #endif
0036 
0037 #ifndef TRUE
0038     #define TRUE    ((BOOLEAN) 1)
0039     #define FALSE   ((BOOLEAN) 0)
0040 #endif
0041 
0042 #ifndef NULL
0043     #define NULL    ((VOID *) 0)
0044 #endif
0045 
0046 typedef UINTN           EFI_STATUS;
0047 typedef UINT64          EFI_LBA;
0048 typedef UINTN           EFI_TPL;
0049 typedef VOID            *EFI_HANDLE;
0050 typedef VOID            *EFI_EVENT;
0051 
0052 
0053 //
0054 // Prototype argument decoration for EFI parameters to indicate
0055 // their direction
0056 //
0057 // IN - argument is passed into the function
0058 // OUT - argument (pointer) is returned from the function
0059 // OPTIONAL - argument is optional
0060 //
0061 
0062 #ifndef IN
0063     #define IN
0064     #define OUT
0065     #define OPTIONAL
0066     #define CONST const
0067 #endif
0068 
0069 
0070 //
0071 // A GUID
0072 //
0073 
0074 typedef struct {          
0075     UINT32  Data1;
0076     UINT16  Data2;
0077     UINT16  Data3;
0078     UINT8   Data4[8]; 
0079 } EFI_GUID;
0080 
0081 
0082 //
0083 // Time
0084 //
0085 
0086 typedef struct {          
0087     UINT16      Year;       // 1998 - 20XX
0088     UINT8       Month;      // 1 - 12
0089     UINT8       Day;        // 1 - 31
0090     UINT8       Hour;       // 0 - 23
0091     UINT8       Minute;     // 0 - 59
0092     UINT8       Second;     // 0 - 59
0093     UINT8       Pad1;
0094     UINT32      Nanosecond; // 0 - 999,999,999
0095     INT16       TimeZone;   // -1440 to 1440 or 2047
0096     UINT8       Daylight;
0097     UINT8       Pad2;
0098 } EFI_TIME;
0099 
0100 // Bit definitions for EFI_TIME.Daylight
0101 #define EFI_TIME_ADJUST_DAYLIGHT    0x01
0102 #define EFI_TIME_IN_DAYLIGHT        0x02
0103 
0104 // Value definition for EFI_TIME.TimeZone
0105 #define EFI_UNSPECIFIED_TIMEZONE    0x07FF
0106 
0107 
0108 
0109 //
0110 // Networking
0111 //
0112 
0113 typedef struct {
0114     UINT8                   Addr[4];
0115 } EFI_IPv4_ADDRESS;
0116 
0117 typedef struct {
0118     UINT8                   Addr[16];
0119 } EFI_IPv6_ADDRESS;
0120 
0121 typedef struct {
0122     UINT8                   Addr[32];
0123 } EFI_MAC_ADDRESS;
0124 
0125 typedef struct {
0126     UINT32 ReceivedQueueTimeoutValue;
0127     UINT32 TransmitQueueTimeoutValue;
0128     UINT16 ProtocolTypeFilter;
0129     BOOLEAN EnableUnicastReceive;
0130     BOOLEAN EnableMulticastReceive;
0131     BOOLEAN EnableBroadcastReceive;
0132     BOOLEAN EnablePromiscuousReceive;
0133     BOOLEAN FlushQueuesOnReset;
0134     BOOLEAN EnableReceiveTimestamps;
0135     BOOLEAN DisableBackgroundPolling;
0136 } EFI_MANAGED_NETWORK_CONFIG_DATA;
0137 
0138 //
0139 // Memory
0140 //
0141 
0142 typedef UINT64          EFI_PHYSICAL_ADDRESS;
0143 typedef UINT64          EFI_VIRTUAL_ADDRESS;
0144 
0145 typedef enum {
0146     AllocateAnyPages,
0147     AllocateMaxAddress,
0148     AllocateAddress,
0149     MaxAllocateType
0150 } EFI_ALLOCATE_TYPE;
0151 
0152 //Preseve the attr on any range supplied.
0153 //ConventialMemory must have WB,SR,SW when supplied.
0154 //When allocating from ConventialMemory always make it WB,SR,SW
0155 //When returning to ConventialMemory always make it WB,SR,SW
0156 //When getting the memory map, or on RT for runtime types
0157 
0158 
0159 typedef enum {
0160     EfiReservedMemoryType,
0161     EfiLoaderCode,
0162     EfiLoaderData,
0163     EfiBootServicesCode,
0164     EfiBootServicesData,
0165     EfiRuntimeServicesCode,
0166     EfiRuntimeServicesData,
0167     EfiConventionalMemory,
0168     EfiUnusableMemory,
0169     EfiACPIReclaimMemory,
0170     EfiACPIMemoryNVS,
0171     EfiMemoryMappedIO,
0172     EfiMemoryMappedIOPortSpace,
0173     EfiPalCode,
0174     EfiPersistentMemory,
0175     EfiMaxMemoryType
0176 } EFI_MEMORY_TYPE;
0177 
0178 // possible caching types for the memory range
0179 #define EFI_MEMORY_UC           0x0000000000000001
0180 #define EFI_MEMORY_WC           0x0000000000000002
0181 #define EFI_MEMORY_WT           0x0000000000000004
0182 #define EFI_MEMORY_WB           0x0000000000000008
0183 #define EFI_MEMORY_UCE          0x0000000000000010  
0184 
0185 // physical memory protection on range 
0186 #define EFI_MEMORY_WP           0x0000000000001000
0187 #define EFI_MEMORY_RP           0x0000000000002000
0188 #define EFI_MEMORY_XP           0x0000000000004000
0189 #define EFI_MEMORY_NV           0x0000000000008000
0190 #define EFI_MEMORY_MORE_RELIABLE    0x0000000000010000
0191 #define EFI_MEMORY_RO           0x0000000000020000
0192 
0193 // range requires a runtime mapping
0194 #define EFI_MEMORY_RUNTIME      0x8000000000000000
0195 
0196 #define EFI_MEMORY_DESCRIPTOR_VERSION  1
0197 typedef struct {
0198     UINT32                          Type;           // Field size is 32 bits followed by 32 bit pad
0199     UINT32                          Pad;
0200     EFI_PHYSICAL_ADDRESS            PhysicalStart;  // Field size is 64 bits
0201     EFI_VIRTUAL_ADDRESS             VirtualStart;   // Field size is 64 bits
0202     UINT64                          NumberOfPages;  // Field size is 64 bits
0203     UINT64                          Attribute;      // Field size is 64 bits
0204 } EFI_MEMORY_DESCRIPTOR;
0205 
0206 //
0207 // International Language
0208 //
0209 
0210 typedef UINT8   ISO_639_2;
0211 #define ISO_639_2_ENTRY_SIZE    3
0212 
0213 //
0214 //
0215 //
0216 
0217 #define EFI_PAGE_SIZE   4096
0218 #define EFI_PAGE_MASK   0xFFF
0219 #define EFI_PAGE_SHIFT  12
0220 
0221 #define EFI_SIZE_TO_PAGES(a)  \
0222     ( ((a) >> EFI_PAGE_SHIFT) + (((a) & EFI_PAGE_MASK) ? 1 : 0) )
0223 
0224 #endif