131d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson/* Copyright 2010 The Chromium OS Authors. All rights reserved.
231d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson * Use of this source code is governed by a BSD-style license that can be
331d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson * found in the LICENSE file.
431d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson *
531d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson * Constants describing the kernel blob content.
631d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson */
7f5db4b86fa5569285dfc8373fd8977e1998b8066Bill Richardson#ifndef VBOOT_REFERENCE_KERNEL_BLOB_H_
8f5db4b86fa5569285dfc8373fd8977e1998b8066Bill Richardson#define VBOOT_REFERENCE_KERNEL_BLOB_H_
9f5db4b86fa5569285dfc8373fd8977e1998b8066Bill Richardson
1031d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson/* Maximum kernel command-line size */
11f5db4b86fa5569285dfc8373fd8977e1998b8066Bill Richardson#define CROS_CONFIG_SIZE 4096
12f5db4b86fa5569285dfc8373fd8977e1998b8066Bill Richardson
1331d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson/* Size of the x86 zeropage table */
14f5db4b86fa5569285dfc8373fd8977e1998b8066Bill Richardson#define CROS_PARAMS_SIZE 4096
15f5db4b86fa5569285dfc8373fd8977e1998b8066Bill Richardson
1631d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson/* Alignment of various chunks within the kernel blob */
17f5db4b86fa5569285dfc8373fd8977e1998b8066Bill Richardson#define CROS_ALIGN 4096
18f5db4b86fa5569285dfc8373fd8977e1998b8066Bill Richardson
1931d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson/* Sentinel RAM address indicating that no entry address is specified */
20036922ed8a2a7f2b7de4d5d8e0fc8aff072dce3dChe-Liang Chiou#define CROS_NO_ENTRY_ADDR     (~0)
21036922ed8a2a7f2b7de4d5d8e0fc8aff072dce3dChe-Liang Chiou
2231d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson/* RAM address where the 32-bit kernel expects to be started */
23f5db4b86fa5569285dfc8373fd8977e1998b8066Bill Richardson#define CROS_32BIT_ENTRY_ADDR  0x100000
24f5db4b86fa5569285dfc8373fd8977e1998b8066Bill Richardson
2531d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson/* Simplified version of x86 kernel e820 memory map entries */
26475bf447ccab91e11ddfc3445606d7debb3c71edChe-Liang Chiou#define E820_ENTRY_MAX 128
27475bf447ccab91e11ddfc3445606d7debb3c71edChe-Liang Chiou#define E820_TYPE_RAM      1
28475bf447ccab91e11ddfc3445606d7debb3c71edChe-Liang Chiou#define E820_TYPE_RESERVED 2
29475bf447ccab91e11ddfc3445606d7debb3c71edChe-Liang Chiou
30475bf447ccab91e11ddfc3445606d7debb3c71edChe-Liang Chioustruct linux_kernel_e820entry {
3131d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint64_t start_addr;
3231d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint64_t segment_size;
3331d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint32_t segment_type;
34f5db4b86fa5569285dfc8373fd8977e1998b8066Bill Richardson} __attribute__ ((packed));
35f5db4b86fa5569285dfc8373fd8977e1998b8066Bill Richardson
3631d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson/* Simplified version of the x86 kernel zeropage table */
3731d95c2386df8d3d5ec619a077960645d052fa38Bill Richardsonstruct linux_kernel_params {
3831d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint8_t pad0[0x1e8 - 0x0];
3931d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint8_t n_e820_entry;			/* 1e8 */
4031d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint8_t pad1[0x1f1 - 0x1e9];
4131d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint8_t setup_sects;			/* 1f1 */
4231d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint8_t pad2[0x1fe - 0x1f2];
4331d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint16_t boot_flag;			/* 1fe */
4431d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint16_t jump;				/* 200 */
4531d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint32_t header;			/* 202 */
4631d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint16_t version;			/* 206 */
4731d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint8_t pad3[0x210 - 0x208];
4831d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint8_t type_of_loader;			/* 210 */
4931d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint8_t pad4[0x218 - 0x211];
5031d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint32_t ramdisk_image;			/* 218 */
5131d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint32_t ramdisk_size;			/* 21c */
5231d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint8_t pad5[0x228 - 0x220];
5331d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint32_t cmd_line_ptr;			/* 228 */
5431d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint32_t ramdisk_max;			/* 22c */
5531d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint32_t kernel_alignment;		/* 230 */
5631d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint8_t relocatable_kernel;		/* 234 */
5731d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint8_t min_alignment;			/* 235 */
5831d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson	uint8_t pad6[0x2d0 - 0x236];
59779796f57e1e0236ea502248ede2cbea986fca21Bill Richardson	struct linux_kernel_e820entry
60779796f57e1e0236ea502248ede2cbea986fca21Bill Richardson		e820_entries[E820_ENTRY_MAX];	/* 2d0-cd0 */
6131d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson} __attribute__ ((packed));
62f5db4b86fa5569285dfc8373fd8977e1998b8066Bill Richardson
6331d95c2386df8d3d5ec619a077960645d052fa38Bill Richardson#endif /* VBOOT_REFERENCE_KERNEL_BLOB_H_ */
64