Eliminate magic numbers
[coreboot.git] / payloads / coreinfo / coreboot_module.c
index dd589acee2b823a1b458b61cb393103d287deee7..77a4bb2d8b65200ae2c13548e6b5e8b4c18064d2 100644 (file)
@@ -17,8 +17,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#include <coreboot_tables.h>
 #include "coreinfo.h"
+#include <coreboot_tables.h>
 
 #ifdef CONFIG_MODULE_COREBOOT
 
@@ -112,9 +112,9 @@ int coreboot_module_redraw(WINDOW *win)
                }
 
                wprintw(win, "%16.16llx - %16.16llx",
-                       UNPACK_CB64(cb_info.range[i].start),
-                       UNPACK_CB64(cb_info.range[i].start) +
-                       UNPACK_CB64(cb_info.range[i].size) - 1);
+                       cb_unpack64(cb_info.range[i].start),
+                       cb_unpack64(cb_info.range[i].start) +
+                       cb_unpack64(cb_info.range[i].size) - 1);
        }
 
        return 0;
@@ -142,8 +142,8 @@ static void parse_mainboard(unsigned char *ptr)
 {
        struct cb_mainboard *mb = (struct cb_mainboard *)ptr;
 
-       strncpy(cb_info.vendor, (const char *)MB_VENDOR_STRING(mb), 31);
-       strncpy(cb_info.part, (const char *)MB_PART_STRING(mb), 31);
+       strncpy(cb_info.vendor, cb_mb_vendor_part(mb), sizeof(cb_info.vendor) - 1);
+       strncpy(cb_info.part, cb_mb_part_string(mb), sizeof(cb_info.part) - 1);
 }
 
 static void parse_strings(unsigned char *ptr)
@@ -189,10 +189,10 @@ static int parse_header(void *addr, int len)
 
        /* FIXME: Check the checksum. */
 
-       if (ipchksum((uint16_t *) header, sizeof(*header)))
+       if (cb_checksum(header, sizeof(*header)))
                return -1;
 
-       if (ipchksum((uint16_t *) (ptr + sizeof(*header)), header->table_bytes)
+       if (cb_checksum((ptr + sizeof(*header)), header->table_bytes)
            != header->table_checksum)
                return -1;