X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FInclude%2FUefi%2FUefiBaseType.h;h=d14215619f83bf706d006271555f94739c630da3;hp=e0e25e155a2f7d4ea4bf5f2115cc8f9b3c279eb2;hb=6a9eeabb657279fe9efe7ef27630b06919bbd556;hpb=959ccb23c6a14797ecaf5990bd5906b4b05a9b75 diff --git a/MdePkg/Include/Uefi/UefiBaseType.h b/MdePkg/Include/Uefi/UefiBaseType.h index e0e25e155a..d14215619f 100644 --- a/MdePkg/Include/Uefi/UefiBaseType.h +++ b/MdePkg/Include/Uefi/UefiBaseType.h @@ -1,56 +1,72 @@ - -/* @file - +/** @file Defines data types and constants introduced in UEFI. -Copyright (c) 2006 - 2007, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + Copyright (c) 2006 - 2008, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #ifndef __UEFI_BASETYPE_H__ #define __UEFI_BASETYPE_H__ -#include "Base.h" +#include // // Basical data type definitions introduced in UEFI. -// -typedef GUID EFI_GUID; -typedef RETURN_STATUS EFI_STATUS; -typedef VOID *EFI_HANDLE; - -typedef VOID *EFI_EVENT; - -typedef UINTN EFI_TPL; - - -typedef UINT64 EFI_LBA; - - -typedef UINT16 EFI_HII_HANDLE; -typedef UINT16 STRING_REF; - -typedef UINT64 EFI_PHYSICAL_ADDRESS; -typedef UINT64 EFI_VIRTUAL_ADDRESS; - -// -// EFI Time Abstraction: -// Year: 2000 - 20XX -// Month: 1 - 12 -// Day: 1 - 31 -// Hour: 0 - 23 -// Minute: 0 - 59 -// Second: 0 - 59 -// Nanosecond: 0 - 999,999,999 -// TimeZone: -1440 to 1440 or 2047 // + +/// +/// 128-bit buffer containing a unique identifier value. +/// +typedef GUID EFI_GUID; +/// +/// Function return status for EFI API +/// +typedef RETURN_STATUS EFI_STATUS; +/// +/// A collection of related interfaces. +/// +typedef VOID *EFI_HANDLE; +/// +/// Handle to an event structure. +/// +typedef VOID *EFI_EVENT; +/// +/// Task priority level. +/// +typedef UINTN EFI_TPL; +/// +/// Logical block address. +/// +typedef UINT64 EFI_LBA; + +/// +/// 64-bit physical memory address. +/// +typedef UINT64 EFI_PHYSICAL_ADDRESS; + +/// +/// 64-bit virtual memory address. +/// +typedef UINT64 EFI_VIRTUAL_ADDRESS; + +/// +/// EFI Time Abstraction: +/// Year: 1998 - 20XX +/// Month: 1 - 12 +/// Day: 1 - 31 +/// Hour: 0 - 23 +/// Minute: 0 - 59 +/// Second: 0 - 59 +/// Nanosecond: 0 - 999,999,999 +/// TimeZone: -1440 to 1440 or 2047 +/// typedef struct { UINT16 Year; UINT8 Month; @@ -65,6 +81,39 @@ typedef struct { UINT8 Pad2; } EFI_TIME; + +/// +/// 4-byte buffer. An IPv4 internet protocol address. +/// +typedef struct { + UINT8 Addr[4]; +} EFI_IPv4_ADDRESS; + +/// +/// 16-byte buffer. An IPv6 internet protocol address +/// +typedef struct { + UINT8 Addr[16]; +} EFI_IPv6_ADDRESS; + +/// +/// 32-byte buffer containing a network Media Access Control address. +/// +typedef struct { + UINT8 Addr[32]; +} EFI_MAC_ADDRESS; + +/// +/// 16-byte buffer aligned on a 4-byte boundary. +/// An IPv4 or IPv6 internet protocol address. +/// +typedef union { + UINT32 Addr[4]; + EFI_IPv4_ADDRESS v4; + EFI_IPv6_ADDRESS v6; +} EFI_IP_ADDRESS; + + // // Enumeration of EFI_STATUS. // @@ -98,6 +147,7 @@ typedef struct { #define EFI_CRC_ERROR RETURN_CRC_ERROR #define EFI_END_OF_MEDIA RETURN_END_OF_MEDIA #define EFI_END_OF_FILE RETURN_END_OF_FILE +#define EFI_INVALID_LANGUAGE RETURN_INVALID_LANGUAGE #define EFI_WARN_UNKNOWN_GLYPH RETURN_WARN_UNKNOWN_GLYPH #define EFI_WARN_DELETE_FAILURE RETURN_WARN_DELETE_FAILURE @@ -105,27 +155,24 @@ typedef struct { #define EFI_WARN_BUFFER_TOO_SMALL RETURN_WARN_BUFFER_TOO_SMALL -#define NULL_HANDLE ((VOID *) 0) - // // Define macro to encode the status code. // -#define EFIERR(_a) ENCODE_ERROR(_a) +#define EFIERR(_a) ENCODE_ERROR(_a) #define EFI_ERROR(A) RETURN_ERROR(A) // // 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)) - - -// -// Returns the byte offset to a field within a structure -// +#define EFI_SIGNATURE_16(A, B) SIGNATURE_16 (A, B) +#define EFI_SIGNATURE_32(A, B, C, D) SIGNATURE_32 (A, B, C, D) +#define EFI_SIGNATURE_64(A, B, C, D, E, F, G, H) SIGNATURE_64 (A, B, C, D, E, F, G, H) + + +/// +/// Returns the byte offset to a field within a structure +/// #define EFI_FIELD_OFFSET(TYPE,Field) ((UINTN)(&(((TYPE *) 0)->Field))) // @@ -133,9 +180,29 @@ typedef struct { // 4K. This should in no way be confused with the page size of the processor. // An EFI_PAGE is just the quanta of memory in EFI. // -#define EFI_PAGE_SIZE 0x1000 -#define EFI_PAGE_MASK 0xFFF -#define EFI_PAGE_SHIFT 12 +#define EFI_PAGE_SIZE 0x1000 +#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)) + +#define EFI_PAGES_TO_SIZE(a) ( (a) << EFI_PAGE_SHIFT) + + +#define EFI_MAX_BIT MAX_BIT +#define EFI_MAX_ADDRESS MAX_ADDRESS + + +/// +/// Limited buffer size for a language code recommended by RFC3066 +/// (42 characters plus a NULL terminator) +/// +#define RFC_3066_ENTRY_SIZE (42 + 1) + +/// +/// The size of a 3 character ISO639 language code. +/// +#define ISO_639_2_ENTRY_SIZE 3 #endif