Replace UNPACK_CB64 macro with inline
[coreboot.git] / payloads / libpayload / arch / i386 / coreboot.c
index 8441903e7caebeafda8819e72fd1e01d38674064..a77144b2c4d07f91db4489cfaf94f05bf13706c9 100644 (file)
@@ -57,16 +57,16 @@ static void cb_parse_memory(unsigned char *ptr, struct sysinfo_t *info)
                struct cb_memory_range *range =
                    (struct cb_memory_range *)MEM_RANGE_PTR(mem, i);
 
-#if MEMMAP_RAM_ONLY
+#ifdef CONFIG_MEMMAP_RAM_ONLY
                if (range->type != CB_MEM_RAM)
                        continue;
 #endif
 
                info->memrange[info->n_memranges].base =
-                   UNPACK_CB64(range->start);
+                   cb_unpack64(range->start);
 
                info->memrange[info->n_memranges].size =
-                   UNPACK_CB64(range->size);
+                   cb_unpack64(range->size);
 
                info->memrange[info->n_memranges].type = range->type;
 
@@ -77,7 +77,15 @@ static void cb_parse_memory(unsigned char *ptr, struct sysinfo_t *info)
 static void cb_parse_serial(unsigned char *ptr, struct sysinfo_t *info)
 {
        struct cb_serial *ser = (struct cb_serial *)ptr;
-       info->ser_ioport = ser->ioport;
+       if (ser->type != CB_SERIAL_TYPE_IO_MAPPED)
+               return;
+       info->ser_ioport = ser->baseaddr;
+}
+
+static void cb_parse_version(unsigned char *ptr, struct sysinfo_t *info)
+{
+       struct cb_string *ver = (struct cb_string *)ptr;
+       info->cb_version = (char *)ver->string;
 }
 
 #ifdef CONFIG_NVRAM
@@ -146,6 +154,9 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
                case CB_TAG_SERIAL:
                        cb_parse_serial(ptr, info);
                        break;
+               case CB_TAG_VERSION:
+                       cb_parse_version(ptr, info);
+                       break;
 #ifdef CONFIG_NVRAM
                case CB_TAG_CMOS_OPTION_TABLE:
                        cb_parse_optiontable(ptr, info);