From ef3d882557dd3cd0d1fe90329653c23f9741bf29 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Thu, 5 Feb 2009 19:51:12 -0500 Subject: Make sure to clear global variables before use. On reset, the global variables may not be zero - so zero them explicitly. --- src/ata.c | 2 ++ src/coreboot.c | 6 ++++++ src/post.c | 2 ++ 3 files changed, 10 insertions(+) (limited to 'src') diff --git a/src/ata.c b/src/ata.c index 17bfda0..cab1eda 100644 --- a/src/ata.c +++ b/src/ata.c @@ -861,6 +861,8 @@ ata_detect() static void ata_init() { + memset(&ATA, 0, sizeof(ATA)); + // hdidmap and cdidmap init. u8 device; for (device=0; device < CONFIG_MAX_ATA_DEVICES; device++) { diff --git a/src/coreboot.c b/src/coreboot.c index 051cd80..99bf570 100644 --- a/src/coreboot.c +++ b/src/coreboot.c @@ -192,6 +192,12 @@ void coreboot_fill_map() { dprintf(3, "Attempting to find coreboot table\n"); + + // Init variables set in coreboot table memory scan. + PirOffset = 0; + RsdpAddr = 0; + + // Find coreboot table. struct cb_header *cbh = find_cb_header(0, 0x1000); if (!cbh) goto fail; diff --git a/src/post.c b/src/post.c index 8ae5fcc..5f3cfaa 100644 --- a/src/post.c +++ b/src/post.c @@ -156,6 +156,8 @@ init_boot_vectors() return; dprintf(3, "init boot device ordering\n"); + memset(&IPL, 0, sizeof(IPL)); + // Floppy drive struct ipl_entry_s *ip = &IPL.table[0]; ip->type = IPL_TYPE_FLOPPY; -- cgit v1.1