1 1.1.1.1.4.2 rmind /* $NetBSD: efifs.h,v 1.1.1.1.4.2 2014/05/18 17:46:02 rmind Exp $ */ 2 1.1.1.1.4.2 rmind 3 1.1.1.1.4.2 rmind #ifndef _EFI_FS_H 4 1.1.1.1.4.2 rmind #define _EFI_FS_H 5 1.1.1.1.4.2 rmind 6 1.1.1.1.4.2 rmind /*++ 7 1.1.1.1.4.2 rmind 8 1.1.1.1.4.2 rmind Copyright (c) 1998 Intel Corporation 9 1.1.1.1.4.2 rmind 10 1.1.1.1.4.2 rmind Module Name: 11 1.1.1.1.4.2 rmind 12 1.1.1.1.4.2 rmind efifs.h 13 1.1.1.1.4.2 rmind 14 1.1.1.1.4.2 rmind Abstract: 15 1.1.1.1.4.2 rmind 16 1.1.1.1.4.2 rmind EFI File System structures 17 1.1.1.1.4.2 rmind 18 1.1.1.1.4.2 rmind 19 1.1.1.1.4.2 rmind 20 1.1.1.1.4.2 rmind Revision History 21 1.1.1.1.4.2 rmind 22 1.1.1.1.4.2 rmind --*/ 23 1.1.1.1.4.2 rmind 24 1.1.1.1.4.2 rmind 25 1.1.1.1.4.2 rmind // 26 1.1.1.1.4.2 rmind // EFI Partition header (normaly starts in LBA 1) 27 1.1.1.1.4.2 rmind // 28 1.1.1.1.4.2 rmind 29 1.1.1.1.4.2 rmind #define EFI_PARTITION_SIGNATURE 0x5053595320494249 30 1.1.1.1.4.2 rmind #define EFI_PARTITION_REVISION 0x00010001 31 1.1.1.1.4.2 rmind #define MIN_EFI_PARTITION_BLOCK_SIZE 512 32 1.1.1.1.4.2 rmind #define EFI_PARTITION_LBA 1 33 1.1.1.1.4.2 rmind 34 1.1.1.1.4.2 rmind typedef struct _EFI_PARTITION_HEADER { 35 1.1.1.1.4.2 rmind EFI_TABLE_HEADER Hdr; 36 1.1.1.1.4.2 rmind UINT32 DirectoryAllocationNumber; 37 1.1.1.1.4.2 rmind UINT32 BlockSize; 38 1.1.1.1.4.2 rmind EFI_LBA FirstUsableLba; 39 1.1.1.1.4.2 rmind EFI_LBA LastUsableLba; 40 1.1.1.1.4.2 rmind EFI_LBA UnusableSpace; 41 1.1.1.1.4.2 rmind EFI_LBA FreeSpace; 42 1.1.1.1.4.2 rmind EFI_LBA RootFile; 43 1.1.1.1.4.2 rmind EFI_LBA SecutiryFile; 44 1.1.1.1.4.2 rmind } EFI_PARTITION_HEADER; 45 1.1.1.1.4.2 rmind 46 1.1.1.1.4.2 rmind 47 1.1.1.1.4.2 rmind // 48 1.1.1.1.4.2 rmind // File header 49 1.1.1.1.4.2 rmind // 50 1.1.1.1.4.2 rmind 51 1.1.1.1.4.2 rmind #define EFI_FILE_HEADER_SIGNATURE 0x454c494620494249 52 1.1.1.1.4.2 rmind #define EFI_FILE_HEADER_REVISION 0x00010000 53 1.1.1.1.4.2 rmind #define EFI_FILE_STRING_SIZE 260 54 1.1.1.1.4.2 rmind 55 1.1.1.1.4.2 rmind typedef struct _EFI_FILE_HEADER { 56 1.1.1.1.4.2 rmind EFI_TABLE_HEADER Hdr; 57 1.1.1.1.4.2 rmind UINT32 Class; 58 1.1.1.1.4.2 rmind UINT32 LBALOffset; 59 1.1.1.1.4.2 rmind EFI_LBA Parent; 60 1.1.1.1.4.2 rmind UINT64 FileSize; 61 1.1.1.1.4.2 rmind UINT64 FileAttributes; 62 1.1.1.1.4.2 rmind EFI_TIME FileCreateTime; 63 1.1.1.1.4.2 rmind EFI_TIME FileModificationTime; 64 1.1.1.1.4.2 rmind EFI_GUID VendorGuid; 65 1.1.1.1.4.2 rmind CHAR16 FileString[EFI_FILE_STRING_SIZE]; 66 1.1.1.1.4.2 rmind } EFI_FILE_HEADER; 67 1.1.1.1.4.2 rmind 68 1.1.1.1.4.2 rmind 69 1.1.1.1.4.2 rmind // 70 1.1.1.1.4.2 rmind // Return the file's first LBAL which is in the same 71 1.1.1.1.4.2 rmind // logical block as the file header 72 1.1.1.1.4.2 rmind // 73 1.1.1.1.4.2 rmind 74 1.1.1.1.4.2 rmind #define EFI_FILE_LBAL(a) ((EFI_LBAL *) (((CHAR8 *) (a)) + (a)->LBALOffset)) 75 1.1.1.1.4.2 rmind 76 1.1.1.1.4.2 rmind #define EFI_FILE_CLASS_FREE_SPACE 1 77 1.1.1.1.4.2 rmind #define EFI_FILE_CLASS_EMPTY 2 78 1.1.1.1.4.2 rmind #define EFI_FILE_CLASS_NORMAL 3 79 1.1.1.1.4.2 rmind 80 1.1.1.1.4.2 rmind 81 1.1.1.1.4.2 rmind // 82 1.1.1.1.4.2 rmind // Logical Block Address List - the fundemental block 83 1.1.1.1.4.2 rmind // description structure 84 1.1.1.1.4.2 rmind // 85 1.1.1.1.4.2 rmind 86 1.1.1.1.4.2 rmind #define EFI_LBAL_SIGNATURE 0x4c41424c20494249 87 1.1.1.1.4.2 rmind #define EFI_LBAL_REVISION 0x00010000 88 1.1.1.1.4.2 rmind 89 1.1.1.1.4.2 rmind typedef struct _EFI_LBAL { 90 1.1.1.1.4.2 rmind EFI_TABLE_HEADER Hdr; 91 1.1.1.1.4.2 rmind UINT32 Class; 92 1.1.1.1.4.2 rmind EFI_LBA Parent; 93 1.1.1.1.4.2 rmind EFI_LBA Next; 94 1.1.1.1.4.2 rmind UINT32 ArraySize; 95 1.1.1.1.4.2 rmind UINT32 ArrayCount; 96 1.1.1.1.4.2 rmind } EFI_LBAL; 97 1.1.1.1.4.2 rmind 98 1.1.1.1.4.2 rmind // Array size 99 1.1.1.1.4.2 rmind #define EFI_LBAL_ARRAY_SIZE(lbal,offs,blks) \ 100 1.1.1.1.4.2 rmind (((blks) - (offs) - (lbal)->Hdr.HeaderSize) / sizeof(EFI_RL)) 101 1.1.1.1.4.2 rmind 102 1.1.1.1.4.2 rmind // 103 1.1.1.1.4.2 rmind // Logical Block run-length 104 1.1.1.1.4.2 rmind // 105 1.1.1.1.4.2 rmind 106 1.1.1.1.4.2 rmind typedef struct { 107 1.1.1.1.4.2 rmind EFI_LBA Start; 108 1.1.1.1.4.2 rmind UINT64 Length; 109 1.1.1.1.4.2 rmind } EFI_RL; 110 1.1.1.1.4.2 rmind 111 1.1.1.1.4.2 rmind // 112 1.1.1.1.4.2 rmind // Return the run-length structure from an LBAL header 113 1.1.1.1.4.2 rmind // 114 1.1.1.1.4.2 rmind 115 1.1.1.1.4.2 rmind #define EFI_LBAL_RL(a) ((EFI_RL*) (((CHAR8 *) (a)) + (a)->Hdr.HeaderSize)) 116 1.1.1.1.4.2 rmind 117 1.1.1.1.4.2 rmind #endif 118 1.1.1.1.4.2 rmind 119