* SUCH DAMAGE.
*/
+#include <libpayload-config.h>
#include <libpayload.h>
-#include <sysinfo.h>
#include <coreboot_tables.h>
/*
info->ser_ioport = ser->ioport;
}
+#ifdef CONFIG_NVRAM
+static void cb_parse_optiontable(unsigned char *ptr, struct sysinfo_t *info)
+{
+ info->option_table = (struct cb_cmos_option_table *)ptr;
+}
+
+static void cb_parse_checksum(unsigned char *ptr, struct sysinfo_t *info)
+{
+ struct cb_cmos_checksum *cmos_cksum = (struct cb_cmos_checksum *)ptr;
+ info->cmos_range_start = cmos_cksum->range_start;
+ info->cmos_range_end = cmos_cksum->range_end;
+ info->cmos_checksum_location = cmos_cksum->location;
+}
+#endif
+
static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
{
struct cb_header *header;
return 0;
/* Make sure the checksums match. */
- if (ipchksum((uint16_t *) header, sizeof(*header)) != 0)
+ if (ipchksum((u16 *) header, sizeof(*header)) != 0)
return -1;
- if (ipchksum((uint16_t *) (ptr + sizeof(*header)),
+ if (ipchksum((u16 *) (ptr + sizeof(*header)),
header->table_bytes) != header->table_checksum)
return -1;
case CB_TAG_SERIAL:
cb_parse_serial(ptr, info);
break;
+#ifdef CONFIG_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
}
ptr += rec->size;
int get_coreboot_info(struct sysinfo_t *info)
{
- int ret = cb_parse_header((void *)0x0, 0x1000, info);
+ int ret = cb_parse_header(phys_to_virt(0x00000000), 0x1000, info);
if (ret != 1)
- ret = cb_parse_header((void *)0xf0000, 0x1000, info);
+ ret = cb_parse_header(phys_to_virt(0x000f0000), 0x1000, info);
return (ret == 1) ? 0 : -1;
}