aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2009-02-05 19:51:12 -0500
committerKevin O'Connor <kevin@koconnor.net>2009-02-05 19:51:12 -0500
commitef3d882557dd3cd0d1fe90329653c23f9741bf29 (patch)
tree92e0000196db51011b5b5252b326492bd70dd5e5
parentb62d1aeaf8c2ae2535187db99eb3cbe186f67c29 (diff)
downloadseabios-ef3d882557dd3cd0d1fe90329653c23f9741bf29.tar.gz
Make sure to clear global variables before use.
On reset, the global variables may not be zero - so zero them explicitly.
-rw-r--r--src/ata.c2
-rw-r--r--src/coreboot.c6
-rw-r--r--src/post.c2
3 files changed, 10 insertions, 0 deletions
diff --git a/src/ata.c b/src/ata.c
index 17bfda04..cab1eda7 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 051cd805..99bf5700 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 8ae5fcc0..5f3cfaad 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;