Browse Source

Enable all coreboot table types except MTRR

Change-Id: Ifd6027a511fcf12e9b63c80b60697f44a3b88b9b
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Ronald G. Minnich 8 years ago
parent
commit
65be21fdcb
2 changed files with 61 additions and 90 deletions
  1. 58 68
      sys/include/coreboot.h
  2. 3 22
      sys/src/9/port/devcoreboot.c

+ 58 - 68
sys/include/coreboot.h

@@ -32,74 +32,6 @@
 /* Allow a maximum of 8 GPIOs */
 #define SYSINFO_MAX_GPIOS 8
 
-struct cb_serial;
-
-struct sysinfo_t {
-	unsigned int cpu_khz;
-	struct cb_serial *serial;
-	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;
-	uint32_t cmos_range_start;
-	uint32_t cmos_range_end;
-	uint32_t cmos_checksum_location;
-#ifdef CONFIG_CHROMEOS
-	uint32_t vbnv_start;
-	uint32_t vbnv_size;
-#endif
-
-	char *version;
-	char *extra_version;
-	char *build;
-	char *compile_time;
-	char *compile_by;
-	char *compile_host;
-	char *compile_domain;
-	char *compiler;
-	char *linker;
-	char *assembler;
-
-	char *cb_version;
-
-	struct cb_framebuffer *framebuffer;
-
-#ifdef CONFIG_CHROMEOS
-	int num_gpios;
-	struct cb_gpio gpios[SYSINFO_MAX_GPIOS];
-#endif
-
-	unsigned long *mbtable; /** Pointer to the multiboot table */
-
-	struct cb_header *header;
-	struct cb_mainboard *mainboard;
-
-	/* these are chromeos specific and may or may not be valid. */
-	void	*vboot_handoff;
-	uint32_t	vboot_handoff_size;
-	void	*vdat_addr;
-	uint32_t	vdat_size;
-
-#ifdef CONFIG_X86
-	int x86_rom_var_mtrr_index;
-#endif
-
-	void	*tstamp_table;
-	void	*cbmem_cons;
-	void	*mrc_cache;
-	void	*acpi_gnvs;
-};
-
-extern struct sysinfo_t lib_sysinfo;
-
 struct cbuint64 {
 	uint32_t lo;
 	uint32_t hi;
@@ -359,6 +291,64 @@ static inline const char *cb_mb_part_string(const struct cb_mainboard *cbm)
 	return (char *)(cbm->strings + cbm->part_number_idx);
 }
 
+struct sysinfo_t {
+	unsigned int cpu_khz;
+	struct cb_serial *serial;
+	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;
+	uint32_t cmos_range_start;
+	uint32_t cmos_range_end;
+	uint32_t cmos_checksum_location;
+	uint32_t vbnv_start;
+	uint32_t vbnv_size;
+
+	char *version;
+	char *extra_version;
+	char *build;
+	char *compile_time;
+	char *compile_by;
+	char *compile_host;
+	char *compile_domain;
+	char *compiler;
+	char *linker;
+	char *assembler;
+
+	char *cb_version;
+
+	struct cb_framebuffer *framebuffer;
+
+	int num_gpios;
+	struct cb_gpio gpios[SYSINFO_MAX_GPIOS];
+
+	unsigned long *mbtable; /** Pointer to the multiboot table */
+
+	struct cb_header *header;
+	struct cb_mainboard *mainboard;
+
+	/* these are chromeos specific and may or may not be valid. */
+	void	*vboot_handoff;
+	uint32_t	vboot_handoff_size;
+	void	*vdat_addr;
+	uint32_t	vdat_size;
+
+	void	*tstamp_table;
+	void	*cbmem_cons;
+	void	*mrc_cache;
+	void	*acpi_gnvs;
+};
+
+extern struct sysinfo_t lib_sysinfo;
+
 /* Helpful macros */
 
 #define MEM_RANGE_COUNT(_rec) \

+ 3 - 22
sys/src/9/port/devcoreboot.c

@@ -60,11 +60,6 @@ static void cb_parse_memory(void *ptr, struct sysinfo_t *info)
 	for (i = 0; i < count; i++) {
 		struct cb_memory_range *range = MEM_RANGE_PTR(mem, i);
 
-#ifdef CONFIG_LP_MEMMAP_RAM_ONLY
-		if (range->type != CB_MEM_RAM)
-			continue;
-#endif
-
 		info->memrange[info->n_memranges].base =
 		    cb_unpack64(range->start);
 
@@ -82,7 +77,6 @@ static void cb_parse_serial(void *ptr, struct sysinfo_t *info)
 	info->serial = ((struct cb_serial *)ptr);
 }
 
-#ifdef CONFIG_LP_CHROMEOS
 static void cb_parse_vboot_handoff(unsigned char *ptr, struct sysinfo_t *info)
 { print("%s\n", __func__);
 	struct cb_range *vbho = (struct cb_range *)ptr;
@@ -115,10 +109,9 @@ static void cb_parse_vdat(unsigned char *ptr, struct sysinfo_t *info)
 { print("%s\n", __func__);
 	struct cb_range *vdat = (struct cb_range *) ptr;
 
-	info->vdat_addr = phys_to_virt(vdat->range_start);
+	info->vdat_addr = KADDR(vdat->range_start);
 	info->vdat_size = vdat->range_size;
 }
-#endif
 
 static void cb_parse_tstamp(unsigned char *ptr, struct sysinfo_t *info)
 { print("%s\n", __func__);
@@ -144,7 +137,6 @@ static void cb_parse_acpi_gnvs(unsigned char *ptr, struct sysinfo_t *info)
 	info->acpi_gnvs = KADDR(cbmem->cbmem_tab);
 }
 
-#ifdef CONFIG_LP_NVRAM
 static void cb_parse_optiontable(void *ptr, struct sysinfo_t *info)
 { print("%s\n", __func__);
 	/* ptr points to a coreboot table entry and is already virtual */
@@ -158,20 +150,15 @@ static void cb_parse_checksum(void *ptr, struct sysinfo_t *info)
 	info->cmos_range_end = cmos_cksum->range_end;
 	info->cmos_checksum_location = cmos_cksum->location;
 }
-#endif
-
-#ifdef CONFIG_LP_COREBOOT_VIDEO_CONSOLE
 static void cb_parse_framebuffer(void *ptr, struct sysinfo_t *info)
 { print("%s\n", __func__);
 	/* ptr points to a coreboot table entry and is already virtual */
 	info->framebuffer = ptr;
 }
-#endif
 
 static void cb_parse_x86_rom_var_mtrr(void *ptr, struct sysinfo_t *info)
-{ print("%s\n", __func__);
-	//struct cb_x86_rom_mtrr *rom_mtrr = ptr;
-	//info->x86_rom_var_mtrr_index = rom_mtrr->index;
+{ 
+	print("%s, ignoring MTRR information.\n", __func__);
 }
 
 static void cb_parse_string(unsigned char *ptr, char **info)
@@ -267,24 +254,19 @@ int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
 		case CB_TAG_ASSEMBLER:
 			cb_parse_string(ptr, &info->assembler);
 			break;
-#ifdef CONFIG_LP_NVRAM
 		case CB_TAG_CMOS_OPTION_TABLE:
 			cb_parse_optiontable(ptr, info);
 			break;
 		case CB_TAG_OPTION_CHECKSUM:
 			cb_parse_checksum(ptr, info);
 			break;
-#endif
-#ifdef CONFIG_LP_COREBOOT_VIDEO_CONSOLE
 		// FIXME we should warn on serial if coreboot set up a
 		// framebuffer buf the payload does not know about it.
 		case CB_TAG_FRAMEBUFFER:
 			cb_parse_framebuffer(ptr, info);
 			break;
-#endif
 		case CB_TAG_MAINBOARD:
 			info->mainboard = (struct cb_mainboard *)ptr;
-#ifdef CONFIG_LP_CHROMEOS
 		case CB_TAG_GPIO:
 			cb_parse_gpios(ptr, info);
 			break;
@@ -297,7 +279,6 @@ int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
 		case CB_TAG_VBOOT_HANDOFF:
 			cb_parse_vboot_handoff(ptr, info);
 			break;
-#endif
 		case CB_TAG_TIMESTAMPS:
 			cb_parse_tstamp(ptr, info);
 			break;