Home | History | Annotate | Download | only in bootstub
      1 /* define bootstub constrains here, like memory map etc.
      2  */
      3 
      4 #ifndef _BOOT_STUB_HEAD
      5 #define _BOOT_STUB_HEAD
      6 
      7 #define CPUID_MASK		0xffff0
      8 #define PENWELL_FAMILY		0x20670
      9 #define CLOVERVIEW_FAMILY	0x30650
     10 #define VALLEYVIEW2_FAMILY	0x30670
     11 #define TANGIER_FAMILY		0x406A0
     12 #define ANNIEDALE_FAMILY	0x506A0
     13 
     14 #define MID_CPU_CHIP_LINCROFT	1
     15 #define MID_CPU_CHIP_PENWELL	2
     16 #define MID_CPU_CHIP_CLOVERVIEW 3
     17 #define MID_CPU_CHIP_VALLEYVIEW2 4
     18 #define MID_CPU_CHIP_TANGIER	5
     19 #define MID_CPU_CHIP_ANNIEDALE	6
     20 #define MID_CPU_CHIP_OTHER		0xFF
     21 
     22 #define BASE_ADDRESS		0x01100000
     23 
     24 #define CMDLINE_OFFSET		BASE_ADDRESS
     25 #define BZIMAGE_SIZE_OFFSET	(CMDLINE_OFFSET + CMDLINE_SIZE)
     26 #define INITRD_SIZE_OFFSET	(BZIMAGE_SIZE_OFFSET + 4)
     27 #define SPI_UART_SUPPRESSION	(INITRD_SIZE_OFFSET + 4)
     28 
     29 #define SPI_TYPE		(SPI_UART_SUPPRESSION + 4) /*0:SPI0  1:SPI1*/
     30 #define SPI_0		0
     31 #define SPI_1		1
     32 #define SPI_2		2
     33 
     34 #define FLAGS_RESERVED_0	(SPI_TYPE + 4)
     35 #define FLAGS_RESERVED_1	(FLAGS_RESERVED_0 + 4)
     36 #define VXE_FW_SIZE_OFFSET		(FLAGS_RESERVED_1 + 4)
     37 #define SEC_PLAT_SVCS_SIZE_OFFSET	(VXE_FW_SIZE_OFFSET + 4)
     38 #define XEN_SIZE_OFFSET		(SEC_PLAT_SVCS_SIZE_OFFSET + 4)
     39 
     40 #define BOOTSTUB_OFFSET		(BASE_ADDRESS + 0x1000)
     41 
     42 #define BZIMAGE_OFFSET		(BASE_ADDRESS + 0x3000)
     43 
     44 #define SETUP_HEADER_OFFSET (BZIMAGE_OFFSET + 0x1F1)
     45 #define SETUP_HEADER_SIZE (0x0202 + *(unsigned char*)(0x0201+BZIMAGE_OFFSET))
     46 #define BOOT_PARAMS_OFFSET 0x8000
     47 #define BOOT_CMDLINE_OFFSET 0x10000
     48 #define SETUP_SIGNATURE 0x5a5aaa55
     49 
     50 #define GDT_ENTRY_BOOT_CS       2
     51 #define __BOOT_CS               (GDT_ENTRY_BOOT_CS * 8)
     52 
     53 #define GDT_ENTRY_BOOT_DS       (GDT_ENTRY_BOOT_CS + 1)
     54 #define __BOOT_DS               (GDT_ENTRY_BOOT_DS * 8)
     55 
     56 #ifdef __ASSEMBLY__
     57 #define GDT_ENTRY(flags, base, limit)			\
     58 	((((base)  & 0xff000000) << (56-24)) |	\
     59 	 (((flags) & 0x0000f0ff) << 40) |	\
     60 	 (((limit) & 0x000f0000) << (48-16)) |	\
     61 	 (((base)  & 0x00ffffff) << 16) |	\
     62 	 (((limit) & 0x0000ffff)))
     63 #else
     64 #define GDT_ENTRY(flags, base, limit)           \
     65         (((u64)(base & 0xff000000) << 32) |     \
     66          ((u64)flags << 40) |                   \
     67          ((u64)(limit & 0x00ff0000) << 32) |    \
     68          ((u64)(base & 0x00ffffff) << 16) |     \
     69          ((u64)(limit & 0x0000ffff)))
     70 int get_e820_by_bios(void *e820_buf);
     71 int mid_identify_cpu(void);
     72 void bs_printk(const char *str);
     73 #endif
     74 
     75 #endif
     76