Home | History | Annotate | Download | only in bootstub
      1 #ifndef _SFI_H
      2 #define _SFI_H
      3 
      4 /* Memory type definitions */
      5 enum sfi_mem_type {
      6 	SFI_MEM_RESERVED,
      7 	SFI_LOADER_CODE,
      8 	SFI_LOADER_DATA,
      9 	SFI_BOOT_SERVICE_CODE,
     10 	SFI_BOOT_SERVICE_DATA,
     11 	SFI_RUNTIME_SERVICE_CODE,
     12 	SFI_RUNTIME_SERVICE_DATA,
     13 	SFI_MEM_CONV,
     14 	SFI_MEM_UNUSABLE,
     15 	SFI_ACPI_RECLAIM,
     16 	SFI_ACPI_NVS,
     17 	SFI_MEM_MMIO,
     18 	SFI_MEM_IOPORT,
     19 	SFI_PAL_CODE,
     20 	SFI_MEM_TYPEMAX,
     21 };
     22 
     23 struct sfi_mem_entry {
     24 	enum sfi_mem_type type;
     25 	u64 phy_start;
     26 	u64 vir_start;
     27 	u64 pages;
     28 	u64 attrib;
     29 }__attribute__((packed));
     30 
     31 struct sfi_table_header {
     32 	char signature[4];
     33 	u32 length;
     34 	u8 revision;
     35 	u8 checksum;
     36 	char oem_id[6];
     37 	char oem_table_id[8];
     38 }__attribute__((packed));
     39 
     40 struct sfi_table {
     41 	struct sfi_table_header header;
     42 	u64 pentry[1];
     43 }__attribute__((packed));
     44 
     45 #define SFI_TBL_HEADER_LEN      24
     46 
     47 #define SFI_GET_ENTRY_NUM(ptable, entry) \
     48 	((ptable->header.length - SFI_TBL_HEADER_LEN) / \
     49 	(sizeof(struct entry)))
     50 
     51 #define E820_RAM	1
     52 #define E820_RESERVED	2
     53 #define E820_ACPI	3
     54 #define E820_NVS	4
     55 #define E820_UNUSABLE	5
     56 
     57 extern void sfi_setup_mmap(struct boot_params *bp, memory_map_t *mb_mmap);
     58 extern int sfi_add_e820_entry(struct boot_params *bp, memory_map_t *mb_mmap, u64 start, u64 size, int type);
     59 
     60 #endif /* _SFI_H */
     61