diff options
| author | Wolfgang Denk <wd@denx.de> | 2011-12-23 20:53:58 +0100 | 
|---|---|---|
| committer | Wolfgang Denk <wd@denx.de> | 2011-12-23 20:53:58 +0100 | 
| commit | bfcc40bb09b05c90cc3b1496abb270eb8aa72134 (patch) | |
| tree | c551fbe329411533b80f0298f6f0ff5afb48cee7 /arch/x86/include | |
| parent | cba9a894fdb1cb49b60fcd1d1d6919cbd7995dd5 (diff) | |
| parent | 1895420b2ef7358014b355aa4f4f2c348267a6d9 (diff) | |
| download | olio-uboot-2014.01-bfcc40bb09b05c90cc3b1496abb270eb8aa72134.tar.xz olio-uboot-2014.01-bfcc40bb09b05c90cc3b1496abb270eb8aa72134.zip | |
Merge branch 'next' of ../next
* 'next' of ../next:
  mkenvimage: Add version info switch (-V)
  mkenvimage: Fix getopt() error handling
  mkenvimage: Fix some typos
  phy: add Micrel KS8721BL phy definition
  net: introduce per device index
  mvgbe: remove setting of ethaddr within the driver
  x86: Add support for specifying an initrd with the zboot command
  x86: Refactor the zboot innards so they can be reused with a vboot image
  x86: Add infrastructure to extract an e820 table from the coreboot tables
  x86: Add support for booting Linux using the 32 bit boot protocol
  x86: Clean up the x86 zimage code in preparation to extend it
  x86: Import code from coreboot's libpayload to parse the coreboot table
  x86: Initial commit for running as a coreboot payload
  CHECKPATCH: ./board/esd/hh405/logo_320_240_8bpp.c
  CHECKPATCH: ./board/esd/hh405/logo_1024_768_8bpp.c
  CHECKPATCH: ./board/esd/hh405/logo_320_240_4bpp.c
  CHECKPATCH: ./board/esd/hh405/logo_640_480_24bpp.c
  CHECKPATCH: ./board/esd/apc405/logo_640_480_24bpp.c
  CHECKPATCH: ./board/esd/voh405/logo_320_240_4bpp.c
  CHECKPATCH: ./board/esd/voh405/logo_640_480_24bpp.c
  CHECKPATCH: ./board/esd/hh405/fpgadata.c
  CHECKPATCH: ./board/esd/pci405/fpgadata.c
  CHECKPATCH: ./board/esd/tasreg/fpgadata.c
  CHECKPATCH: ./board/esd/apc405/fpgadata.c
  CHECKPATCH: ./board/esd/voh405/fpgadata.c
  CHECKPATCH: ./board/esd/ash405/fpgadata.c
  CHECKPATCH: ./board/esd/dasa_sim/fpgadata.c
  CHECKPATCH: ./board/esd/ar405/fpgadata_xl30.c
  CHECKPATCH: ./board/esd/ar405/fpgadata.c
  CHECKPATCH: ./board/esd/plu405/fpgadata.c
  CHECKPATCH: ./board/esd/wuh405/fpgadata.c
  CHECKPATCH: ./board/esd/cpci405/fpgadata_cpci405.c
  CHECKPATCH: ./board/esd/cpci405/fpgadata_cpci405ab.c
  CHECKPATCH: ./board/esd/cpci405/fpgadata_cpci4052.c
  CHECKPATCH: ./board/esd/canbt/fpgadata.c
  CHECKPATCH: ./board/esd/du405/fpgadata.c
  CHECKPATCH: ./board/esd/cpciiser4/fpgadata.c
  CHECKPATCH: ./board/dave/PPChameleonEVB/fpgadata.c
  avr32:mmu.c: fix printf() length modifier
  fat.c: fix printf() length modifier
  cmd_sf.c: fix printf() length modifier
  Make printf and vprintf safe from buffer overruns
  vsprintf: Move function documentation into header file
  Add safe vsnprintf and snprintf library functions
  Move vsprintf functions into their own header
Conflicts:
	tools/mkenvimage.c
Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'arch/x86/include')
| -rw-r--r-- | arch/x86/include/asm/arch-coreboot/ipchecksum.h | 37 | ||||
| -rw-r--r-- | arch/x86/include/asm/arch-coreboot/sysinfo.h | 63 | ||||
| -rw-r--r-- | arch/x86/include/asm/arch-coreboot/tables.h | 241 | ||||
| -rw-r--r-- | arch/x86/include/asm/zimage.h | 36 | 
4 files changed, 352 insertions, 25 deletions
| diff --git a/arch/x86/include/asm/arch-coreboot/ipchecksum.h b/arch/x86/include/asm/arch-coreboot/ipchecksum.h new file mode 100644 index 000000000..1d73b4d91 --- /dev/null +++ b/arch/x86/include/asm/arch-coreboot/ipchecksum.h @@ -0,0 +1,37 @@ +/* + * This file is part of the libpayload project. + * + * It has originally been taken from the FreeBSD project. + * + * Copyright (c) 2001 Charles Mott <cm@linktel.net> + * Copyright (c) 2008 coresystems GmbH + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *    notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *    notice, this list of conditions and the following disclaimer in the + *    documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _COREBOOT_IPCHECKSUM_H +#define _COREBOOT_IPCHECKSUM_H + +unsigned short ipchksum(const void *vptr, unsigned long nbytes); + +#endif diff --git a/arch/x86/include/asm/arch-coreboot/sysinfo.h b/arch/x86/include/asm/arch-coreboot/sysinfo.h new file mode 100644 index 000000000..5c44e1a47 --- /dev/null +++ b/arch/x86/include/asm/arch-coreboot/sysinfo.h @@ -0,0 +1,63 @@ +/* + * This file is part of the libpayload project. + * + * Copyright (C) 2008 Advanced Micro Devices, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *    notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *    notice, this list of conditions and the following disclaimer in the + *    documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + *    derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _COREBOOT_SYSINFO_H +#define _COREBOOT_SYSINFO_H + +#include <compiler.h> + +/* Allow a maximum of 16 memory range definitions. */ +#define SYSINFO_MAX_MEM_RANGES 16 + +struct sysinfo_t { +	unsigned int cpu_khz; +	unsigned short ser_ioport; +	unsigned long ser_base; /* for mmapped serial */ + +	int n_memranges; + +	struct memrange { +		unsigned long long base; +		unsigned long long size; +		unsigned int type; +	} memrange[SYSINFO_MAX_MEM_RANGES]; + +	struct cb_cmos_option_table *option_table; +	u32 cmos_range_start; +	u32 cmos_range_end; +	u32 cmos_checksum_location; + +	struct cb_framebuffer *framebuffer; + +	unsigned long *mbtable; /** Pointer to the multiboot table */ +}; + +extern struct sysinfo_t lib_sysinfo; + +#endif diff --git a/arch/x86/include/asm/arch-coreboot/tables.h b/arch/x86/include/asm/arch-coreboot/tables.h new file mode 100644 index 000000000..c28697375 --- /dev/null +++ b/arch/x86/include/asm/arch-coreboot/tables.h @@ -0,0 +1,241 @@ +/* + * This file is part of the libpayload project. + * + * Copyright (C) 2008 Advanced Micro Devices, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *    notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *    notice, this list of conditions and the following disclaimer in the + *    documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + *    derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _COREBOOT_TABLES_H +#define _COREBOOT_TABLES_H + +#include <compiler.h> + +struct cbuint64 { +	u32 lo; +	u32 hi; +}; + +struct cb_header { +	u8 signature[4]; +	u32 header_bytes; +	u32 header_checksum; +	u32 table_bytes; +	u32 table_checksum; +	u32 table_entries; +}; + +struct cb_record { +	u32 tag; +	u32 size; +}; + +#define CB_TAG_UNUSED     0x0000 +#define CB_TAG_MEMORY     0x0001 + +struct cb_memory_range { +	struct cbuint64 start; +	struct cbuint64 size; +	u32 type; +}; + +#define CB_MEM_RAM          1 +#define CB_MEM_RESERVED     2 +#define CB_MEM_ACPI         3 +#define CB_MEM_NVS          4 +#define CB_MEM_UNUSABLE     5 +#define CB_MEM_VENDOR_RSVD  6 +#define CB_MEM_TABLE       16 + +struct cb_memory { +	u32 tag; +	u32 size; +	struct cb_memory_range map[0]; +}; + +#define CB_TAG_HWRPB      0x0002 + +struct cb_hwrpb { +	u32 tag; +	u32 size; +	u64 hwrpb; +}; + +#define CB_TAG_MAINBOARD  0x0003 + +struct cb_mainboard { +	u32 tag; +	u32 size; +	u8 vendor_idx; +	u8 part_number_idx; +	u8 strings[0]; +}; + +#define CB_TAG_VERSION        0x0004 +#define CB_TAG_EXTRA_VERSION  0x0005 +#define CB_TAG_BUILD          0x0006 +#define CB_TAG_COMPILE_TIME   0x0007 +#define CB_TAG_COMPILE_BY     0x0008 +#define CB_TAG_COMPILE_HOST   0x0009 +#define CB_TAG_COMPILE_DOMAIN 0x000a +#define CB_TAG_COMPILER       0x000b +#define CB_TAG_LINKER         0x000c +#define CB_TAG_ASSEMBLER      0x000d + +struct cb_string { +	u32 tag; +	u32 size; +	u8 string[0]; +}; + +#define CB_TAG_SERIAL         0x000f + +struct cb_serial { +	u32 tag; +	u32 size; +#define CB_SERIAL_TYPE_IO_MAPPED     1 +#define CB_SERIAL_TYPE_MEMORY_MAPPED 2 +	u32 type; +	u32 baseaddr; +	u32 baud; +}; + +#define CB_TAG_CONSOLE       0x00010 + +struct cb_console { +	u32 tag; +	u32 size; +	u16 type; +}; + +#define CB_TAG_CONSOLE_SERIAL8250 0 +#define CB_TAG_CONSOLE_VGA        1 /* OBSOLETE */ +#define CB_TAG_CONSOLE_BTEXT      2 /* OBSOLETE */ +#define CB_TAG_CONSOLE_LOGBUF     3 +#define CB_TAG_CONSOLE_SROM       4 /* OBSOLETE */ +#define CB_TAG_CONSOLE_EHCI       5 + +#define CB_TAG_FORWARD       0x00011 + +struct cb_forward { +	u32 tag; +	u32 size; +	u64 forward; +}; + +#define CB_TAG_FRAMEBUFFER      0x0012 +struct cb_framebuffer { +	u32 tag; +	u32 size; + +	u64 physical_address; +	u32 x_resolution; +	u32 y_resolution; +	u32 bytes_per_line; +	u8 bits_per_pixel; +	u8 red_mask_pos; +	u8 red_mask_size; +	u8 green_mask_pos; +	u8 green_mask_size; +	u8 blue_mask_pos; +	u8 blue_mask_size; +	u8 reserved_mask_pos; +	u8 reserved_mask_size; +}; + +#define CB_TAG_CMOS_OPTION_TABLE 0x00c8 +struct cb_cmos_option_table { +	u32 tag; +	u32 size; +	u32 header_length; +}; + +#define CB_TAG_OPTION         0x00c9 +#define CMOS_MAX_NAME_LENGTH    32 +struct cb_cmos_entries { +	u32 tag; +	u32 size; +	u32 bit; +	u32 length; +	u32 config; +	u32 config_id; +	u8 name[CMOS_MAX_NAME_LENGTH]; +}; + + +#define CB_TAG_OPTION_ENUM    0x00ca +#define CMOS_MAX_TEXT_LENGTH 32 +struct cb_cmos_enums { +	u32 tag; +	u32 size; +	u32 config_id; +	u32 value; +	u8 text[CMOS_MAX_TEXT_LENGTH]; +}; + +#define CB_TAG_OPTION_DEFAULTS 0x00cb +#define CMOS_IMAGE_BUFFER_SIZE 128 +struct cb_cmos_defaults { +	u32 tag; +	u32 size; +	u32 name_length; +	u8 name[CMOS_MAX_NAME_LENGTH]; +	u8 default_set[CMOS_IMAGE_BUFFER_SIZE]; +}; + +#define CB_TAG_OPTION_CHECKSUM 0x00cc +#define CHECKSUM_NONE	0 +#define CHECKSUM_PCBIOS	1 +struct	cb_cmos_checksum { +	u32 tag; +	u32 size; +	u32 range_start; +	u32 range_end; +	u32 location; +	u32 type; +}; + +/* Helpful macros */ + +#define MEM_RANGE_COUNT(_rec) \ +	(((_rec)->size - sizeof(*(_rec))) / sizeof((_rec)->map[0])) + +#define MEM_RANGE_PTR(_rec, _idx) \ +	(((u8 *) (_rec)) + sizeof(*(_rec)) \ +	+ (sizeof((_rec)->map[0]) * (_idx))) + +#define MB_VENDOR_STRING(_mb) \ +	(((unsigned char *) ((_mb)->strings)) + (_mb)->vendor_idx) + +#define MB_PART_STRING(_mb) \ +	(((unsigned char *) ((_mb)->strings)) + (_mb)->part_number_idx) + +#define UNPACK_CB64(_in) \ +	((((u64) _in.hi) << 32) | _in.lo) + +struct sysinfo_t; + +int get_coreboot_info(struct sysinfo_t *info); + +#endif diff --git a/arch/x86/include/asm/zimage.h b/arch/x86/include/asm/zimage.h index a02637ff6..f03ea809a 100644 --- a/arch/x86/include/asm/zimage.h +++ b/arch/x86/include/asm/zimage.h @@ -24,30 +24,12 @@  #ifndef _ASM_ZIMAGE_H_  #define _ASM_ZIMAGE_H_ +#include <asm/bootparam.h> +#include <asm/e820.h> +  /* linux i386 zImage/bzImage header. Offsets relative to   * the start of the image */ -#define CMD_LINE_MAGIC_OFF  0x020 /* Magic 0xa33f if the offset below is valid */ -#define CMD_LINE_OFFSET_OFF 0x022 /* Offset to comandline */ -#define SETUP_SECTS_OFF     0x1F1 /* The size of the setup in sectors */ -#define ROOT_FLAGS_OFF      0x1F2 /* If set, the root is mounted readonly */ -#define VID_MODE_OFF        0x1FA /* Video mode control */ -#define ROOT_DEV_OFF        0x1FC /* Default root device number */ -#define BOOT_FLAG_OFF       0x1FE /* 0xAA55 magic number */ -#define HEADER_OFF          0x202 /* Magic signature "HdrS" */ -#define VERSION_OFF         0x206 /* Boot protocol version supported */ -#define REALMODE_SWTCH_OFF  0x208 /* Boot loader hook (see below) */ -#define START_SYS_OFF       0x20C /* Points to kernel version string */ -#define TYPE_OF_LOADER_OFF  0x210 /* Boot loader identifier */ -#define LOADFLAGS_OFF       0x211 /* Boot protocol option flags */ -#define SETUP_MOVE_SIZE_OFF 0x212 /* Move to high memory size (used with hooks) */ -#define CODE32_START_OFF    0x214 /* Boot loader hook (see below) */ -#define RAMDISK_IMAGE_OFF   0x218 /* initrd load address (set by boot loader) */ -#define RAMDISK_SIZE_OFF    0x21C /* initrd size (set by boot loader) */ -#define HEAP_END_PTR_OFF    0x224 /* Free memory after setup end */ -#define CMD_LINE_PTR_OFF    0x228 /* 32-bit pointer to the kernel command line */ - -  #define HEAP_FLAG           0x80  #define BIG_KERNEL_FLAG     0x01 @@ -65,10 +47,14 @@  #define BZIMAGE_LOAD_ADDR  0x100000  #define ZIMAGE_LOAD_ADDR   0x10000 -void *load_zimage(char *image, unsigned long kernel_size, -		  unsigned long initrd_addr, unsigned long initrd_size, -		  int auto_boot); +/* Implementation defined function to install an e820 map. */ +unsigned install_e820_map(unsigned max_entries, struct e820entry *); + +struct boot_params *load_zimage(char *image, unsigned long kernel_size, +				void **load_address); +int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot, +		 unsigned long initrd_addr, unsigned long initrd_size); -void boot_zimage(void *setup_base); +void boot_zimage(void *setup_base, void *load_address);  #endif |