libefi: import efichar.c for ucs2 support
[unleashed.git] / usr / src / boot / sys / boot / efi / include / efifs.h
blob58febb66eb75192af2b885c1e79c31f5ad35167a
1 /* $FreeBSD$ */
2 #ifndef _EFI_FS_H
3 #define _EFI_FS_H
5 /*++
7 Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved
8 This software and associated documentation (if any) is furnished
9 under a license and may only be used or copied in accordance
10 with the terms of the license. Except as permitted by such
11 license, no part of this software or documentation may be
12 reproduced, stored in a retrieval system, or transmitted in any
13 form or by any means without the express written consent of
14 Intel Corporation.
16 Module Name:
18 efifs.h
20 Abstract:
22 EFI File System structures
26 Revision History
28 --*/
32 // EFI Partition header (normaly starts in LBA 1)
35 #define EFI_PARTITION_SIGNATURE 0x5053595320494249
36 #define EFI_PARTITION_REVISION 0x00010001
37 #define MIN_EFI_PARTITION_BLOCK_SIZE 512
38 #define EFI_PARTITION_LBA 1
40 typedef struct _EFI_PARTITION_HEADER {
41 EFI_TABLE_HEADER Hdr;
42 UINT32 DirectoryAllocationNumber;
43 UINT32 BlockSize;
44 EFI_LBA FirstUsableLba;
45 EFI_LBA LastUsableLba;
46 EFI_LBA UnusableSpace;
47 EFI_LBA FreeSpace;
48 EFI_LBA RootFile;
49 EFI_LBA SecutiryFile;
50 } EFI_PARTITION_HEADER;
54 // File header
57 #define EFI_FILE_HEADER_SIGNATURE 0x454c494620494249
58 #define EFI_FILE_HEADER_REVISION 0x00010000
59 #define EFI_FILE_STRING_SIZE 260
61 typedef struct _EFI_FILE_HEADER {
62 EFI_TABLE_HEADER Hdr;
63 UINT32 Class;
64 UINT32 LBALOffset;
65 EFI_LBA Parent;
66 UINT64 FileSize;
67 UINT64 FileAttributes;
68 EFI_TIME FileCreateTime;
69 EFI_TIME FileModificationTime;
70 EFI_GUID VendorGuid;
71 CHAR16 FileString[EFI_FILE_STRING_SIZE];
72 } EFI_FILE_HEADER;
76 // Return the file's first LBAL which is in the same
77 // logical block as the file header
80 #define EFI_FILE_LBAL(a) ((EFI_LBAL *) (((CHAR8 *) (a)) + (a)->LBALOffset))
82 #define EFI_FILE_CLASS_FREE_SPACE 1
83 #define EFI_FILE_CLASS_EMPTY 2
84 #define EFI_FILE_CLASS_NORMAL 3
88 // Logical Block Address List - the fundemental block
89 // description structure
92 #define EFI_LBAL_SIGNATURE 0x4c41424c20494249
93 #define EFI_LBAL_REVISION 0x00010000
95 typedef struct _EFI_LBAL {
96 EFI_TABLE_HEADER Hdr;
97 UINT32 Class;
98 EFI_LBA Parent;
99 EFI_LBA Next;
100 UINT32 ArraySize;
101 UINT32 ArrayCount;
102 } EFI_LBAL;
104 // Array size
105 #define EFI_LBAL_ARRAY_SIZE(lbal,offs,blks) \
106 (((blks) - (offs) - (lbal)->Hdr.HeaderSize) / sizeof(EFI_RL))
109 // Logical Block run-length
112 typedef struct {
113 EFI_LBA Start;
114 UINT64 Length;
115 } EFI_RL;
118 // Return the run-length structure from an LBAL header
121 #define EFI_LBAL_RL(a) ((EFI_RL*) (((CHAR8 *) (a)) + (a)->Hdr.HeaderSize))
123 #endif