Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef _ASM_X86_BOOTPARAM_H
0003 #define _ASM_X86_BOOTPARAM_H
0004 
0005 /* setup_data/setup_indirect types */
0006 #define SETUP_NONE          0
0007 #define SETUP_E820_EXT          1
0008 #define SETUP_DTB           2
0009 #define SETUP_PCI           3
0010 #define SETUP_EFI           4
0011 #define SETUP_APPLE_PROPERTIES      5
0012 #define SETUP_JAILHOUSE         6
0013 #define SETUP_CC_BLOB           7
0014 #define SETUP_IMA           8
0015 #define SETUP_RNG_SEED          9
0016 #define SETUP_ENUM_MAX          SETUP_RNG_SEED
0017 
0018 #define SETUP_INDIRECT          (1<<31)
0019 #define SETUP_TYPE_MAX          (SETUP_ENUM_MAX | SETUP_INDIRECT)
0020 
0021 /* ram_size flags */
0022 #define RAMDISK_IMAGE_START_MASK    0x07FF
0023 #define RAMDISK_PROMPT_FLAG     0x8000
0024 #define RAMDISK_LOAD_FLAG       0x4000
0025 
0026 /* loadflags */
0027 #define LOADED_HIGH (1<<0)
0028 #define KASLR_FLAG  (1<<1)
0029 #define QUIET_FLAG  (1<<5)
0030 #define KEEP_SEGMENTS   (1<<6)
0031 #define CAN_USE_HEAP    (1<<7)
0032 
0033 /* xloadflags */
0034 #define XLF_KERNEL_64           (1<<0)
0035 #define XLF_CAN_BE_LOADED_ABOVE_4G  (1<<1)
0036 #define XLF_EFI_HANDOVER_32     (1<<2)
0037 #define XLF_EFI_HANDOVER_64     (1<<3)
0038 #define XLF_EFI_KEXEC           (1<<4)
0039 #define XLF_5LEVEL          (1<<5)
0040 #define XLF_5LEVEL_ENABLED      (1<<6)
0041 
0042 #ifndef __ASSEMBLY__
0043 
0044 #include <linux/types.h>
0045 #include <linux/screen_info.h>
0046 #include <linux/apm_bios.h>
0047 #include <linux/edd.h>
0048 #include <asm/ist.h>
0049 #include <video/edid.h>
0050 
0051 /* extensible setup data list node */
0052 struct setup_data {
0053     __u64 next;
0054     __u32 type;
0055     __u32 len;
0056     __u8 data[];
0057 };
0058 
0059 /* extensible setup indirect data node */
0060 struct setup_indirect {
0061     __u32 type;
0062     __u32 reserved;  /* Reserved, must be set to zero. */
0063     __u64 len;
0064     __u64 addr;
0065 };
0066 
0067 struct setup_header {
0068     __u8    setup_sects;
0069     __u16   root_flags;
0070     __u32   syssize;
0071     __u16   ram_size;
0072     __u16   vid_mode;
0073     __u16   root_dev;
0074     __u16   boot_flag;
0075     __u16   jump;
0076     __u32   header;
0077     __u16   version;
0078     __u32   realmode_swtch;
0079     __u16   start_sys_seg;
0080     __u16   kernel_version;
0081     __u8    type_of_loader;
0082     __u8    loadflags;
0083     __u16   setup_move_size;
0084     __u32   code32_start;
0085     __u32   ramdisk_image;
0086     __u32   ramdisk_size;
0087     __u32   bootsect_kludge;
0088     __u16   heap_end_ptr;
0089     __u8    ext_loader_ver;
0090     __u8    ext_loader_type;
0091     __u32   cmd_line_ptr;
0092     __u32   initrd_addr_max;
0093     __u32   kernel_alignment;
0094     __u8    relocatable_kernel;
0095     __u8    min_alignment;
0096     __u16   xloadflags;
0097     __u32   cmdline_size;
0098     __u32   hardware_subarch;
0099     __u64   hardware_subarch_data;
0100     __u32   payload_offset;
0101     __u32   payload_length;
0102     __u64   setup_data;
0103     __u64   pref_address;
0104     __u32   init_size;
0105     __u32   handover_offset;
0106     __u32   kernel_info_offset;
0107 } __attribute__((packed));
0108 
0109 struct sys_desc_table {
0110     __u16 length;
0111     __u8  table[14];
0112 };
0113 
0114 /* Gleaned from OFW's set-parameters in cpu/x86/pc/linux.fth */
0115 struct olpc_ofw_header {
0116     __u32 ofw_magic;    /* OFW signature */
0117     __u32 ofw_version;
0118     __u32 cif_handler;  /* callback into OFW */
0119     __u32 irq_desc_table;
0120 } __attribute__((packed));
0121 
0122 struct efi_info {
0123     __u32 efi_loader_signature;
0124     __u32 efi_systab;
0125     __u32 efi_memdesc_size;
0126     __u32 efi_memdesc_version;
0127     __u32 efi_memmap;
0128     __u32 efi_memmap_size;
0129     __u32 efi_systab_hi;
0130     __u32 efi_memmap_hi;
0131 };
0132 
0133 /*
0134  * This is the maximum number of entries in struct boot_params::e820_table
0135  * (the zeropage), which is part of the x86 boot protocol ABI:
0136  */
0137 #define E820_MAX_ENTRIES_ZEROPAGE 128
0138 
0139 /*
0140  * The E820 memory region entry of the boot protocol ABI:
0141  */
0142 struct boot_e820_entry {
0143     __u64 addr;
0144     __u64 size;
0145     __u32 type;
0146 } __attribute__((packed));
0147 
0148 /*
0149  * Smallest compatible version of jailhouse_setup_data required by this kernel.
0150  */
0151 #define JAILHOUSE_SETUP_REQUIRED_VERSION    1
0152 
0153 /*
0154  * The boot loader is passing platform information via this Jailhouse-specific
0155  * setup data structure.
0156  */
0157 struct jailhouse_setup_data {
0158     struct {
0159         __u16   version;
0160         __u16   compatible_version;
0161     } __attribute__((packed)) hdr;
0162     struct {
0163         __u16   pm_timer_address;
0164         __u16   num_cpus;
0165         __u64   pci_mmconfig_base;
0166         __u32   tsc_khz;
0167         __u32   apic_khz;
0168         __u8    standard_ioapic;
0169         __u8    cpu_ids[255];
0170     } __attribute__((packed)) v1;
0171     struct {
0172         __u32   flags;
0173     } __attribute__((packed)) v2;
0174 } __attribute__((packed));
0175 
0176 /*
0177  * IMA buffer setup data information from the previous kernel during kexec
0178  */
0179 struct ima_setup_data {
0180     __u64 addr;
0181     __u64 size;
0182 } __attribute__((packed));
0183 
0184 /* The so-called "zeropage" */
0185 struct boot_params {
0186     struct screen_info screen_info;         /* 0x000 */
0187     struct apm_bios_info apm_bios_info;     /* 0x040 */
0188     __u8  _pad2[4];                 /* 0x054 */
0189     __u64  tboot_addr;              /* 0x058 */
0190     struct ist_info ist_info;           /* 0x060 */
0191     __u64 acpi_rsdp_addr;               /* 0x070 */
0192     __u8  _pad3[8];                 /* 0x078 */
0193     __u8  hd0_info[16]; /* obsolete! */     /* 0x080 */
0194     __u8  hd1_info[16]; /* obsolete! */     /* 0x090 */
0195     struct sys_desc_table sys_desc_table; /* obsolete! */   /* 0x0a0 */
0196     struct olpc_ofw_header olpc_ofw_header;     /* 0x0b0 */
0197     __u32 ext_ramdisk_image;            /* 0x0c0 */
0198     __u32 ext_ramdisk_size;             /* 0x0c4 */
0199     __u32 ext_cmd_line_ptr;             /* 0x0c8 */
0200     __u8  _pad4[112];               /* 0x0cc */
0201     __u32 cc_blob_address;              /* 0x13c */
0202     struct edid_info edid_info;         /* 0x140 */
0203     struct efi_info efi_info;           /* 0x1c0 */
0204     __u32 alt_mem_k;                /* 0x1e0 */
0205     __u32 scratch;      /* Scratch field! */    /* 0x1e4 */
0206     __u8  e820_entries;             /* 0x1e8 */
0207     __u8  eddbuf_entries;               /* 0x1e9 */
0208     __u8  edd_mbr_sig_buf_entries;          /* 0x1ea */
0209     __u8  kbd_status;               /* 0x1eb */
0210     __u8  secure_boot;              /* 0x1ec */
0211     __u8  _pad5[2];                 /* 0x1ed */
0212     /*
0213      * The sentinel is set to a nonzero value (0xff) in header.S.
0214      *
0215      * A bootloader is supposed to only take setup_header and put
0216      * it into a clean boot_params buffer. If it turns out that
0217      * it is clumsy or too generous with the buffer, it most
0218      * probably will pick up the sentinel variable too. The fact
0219      * that this variable then is still 0xff will let kernel
0220      * know that some variables in boot_params are invalid and
0221      * kernel should zero out certain portions of boot_params.
0222      */
0223     __u8  sentinel;                 /* 0x1ef */
0224     __u8  _pad6[1];                 /* 0x1f0 */
0225     struct setup_header hdr;    /* setup header */  /* 0x1f1 */
0226     __u8  _pad7[0x290-0x1f1-sizeof(struct setup_header)];
0227     __u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX];  /* 0x290 */
0228     struct boot_e820_entry e820_table[E820_MAX_ENTRIES_ZEROPAGE]; /* 0x2d0 */
0229     __u8  _pad8[48];                /* 0xcd0 */
0230     struct edd_info eddbuf[EDDMAXNR];       /* 0xd00 */
0231     __u8  _pad9[276];               /* 0xeec */
0232 } __attribute__((packed));
0233 
0234 /**
0235  * enum x86_hardware_subarch - x86 hardware subarchitecture
0236  *
0237  * The x86 hardware_subarch and hardware_subarch_data were added as of the x86
0238  * boot protocol 2.07 to help distinguish and support custom x86 boot
0239  * sequences. This enum represents accepted values for the x86
0240  * hardware_subarch.  Custom x86 boot sequences (not X86_SUBARCH_PC) do not
0241  * have or simply *cannot* make use of natural stubs like BIOS or EFI, the
0242  * hardware_subarch can be used on the Linux entry path to revector to a
0243  * subarchitecture stub when needed. This subarchitecture stub can be used to
0244  * set up Linux boot parameters or for special care to account for nonstandard
0245  * handling of page tables.
0246  *
0247  * These enums should only ever be used by x86 code, and the code that uses
0248  * it should be well contained and compartmentalized.
0249  *
0250  * KVM and Xen HVM do not have a subarch as these are expected to follow
0251  * standard x86 boot entries. If there is a genuine need for "hypervisor" type
0252  * that should be considered separately in the future. Future guest types
0253  * should seriously consider working with standard x86 boot stubs such as
0254  * the BIOS or EFI boot stubs.
0255  *
0256  * WARNING: this enum is only used for legacy hacks, for platform features that
0257  *      are not easily enumerated or discoverable. You should not ever use
0258  *      this for new features.
0259  *
0260  * @X86_SUBARCH_PC: Should be used if the hardware is enumerable using standard
0261  *  PC mechanisms (PCI, ACPI) and doesn't need a special boot flow.
0262  * @X86_SUBARCH_LGUEST: Used for x86 hypervisor demo, lguest, deprecated
0263  * @X86_SUBARCH_XEN: Used for Xen guest types which follow the PV boot path,
0264  *  which start at asm startup_xen() entry point and later jump to the C
0265  *  xen_start_kernel() entry point. Both domU and dom0 type of guests are
0266  *  currently supported through this PV boot path.
0267  * @X86_SUBARCH_INTEL_MID: Used for Intel MID (Mobile Internet Device) platform
0268  *  systems which do not have the PCI legacy interfaces.
0269  * @X86_SUBARCH_CE4100: Used for Intel CE media processor (CE4100) SoC
0270  *  for settop boxes and media devices, the use of a subarch for CE4100
0271  *  is more of a hack...
0272  */
0273 enum x86_hardware_subarch {
0274     X86_SUBARCH_PC = 0,
0275     X86_SUBARCH_LGUEST,
0276     X86_SUBARCH_XEN,
0277     X86_SUBARCH_INTEL_MID,
0278     X86_SUBARCH_CE4100,
0279     X86_NR_SUBARCHS,
0280 };
0281 
0282 #endif /* __ASSEMBLY__ */
0283 
0284 #endif /* _ASM_X86_BOOTPARAM_H */