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