aboutsummaryrefslogtreecommitdiffstats
path: root/src/block.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2010-02-28 01:28:11 -0500
committerKevin O'Connor <kevin@koconnor.net>2010-02-28 01:28:11 -0500
commit8f469b9676127ba6bb52609d89ec774e61db0ee1 (patch)
treedfb521bc0905ff1419c77dcc1a63943a856f6296 /src/block.c
parent575ffc8fd1127e3cb8fbb7f587cadfa85eb9b73d (diff)
downloadseabios-8f469b9676127ba6bb52609d89ec774e61db0ee1.tar.gz
Dynamically allocate ata_channel info; introduce custom atadrive_s struct.
Don't limit the number of ATA controllers supported - just dynamically allocate the structs. Create an atadrive_s struct that extends the standard 'struct drive_s' and have the new struct store a pointer to the ata channel info. Also, prefer storing drive_s pointers as 32bit "flat" pointers - adjust them as needed in the 16bit code.
Diffstat (limited to 'src/block.c')
-rw-r--r--src/block.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/block.c b/src/block.c
index 05301207..d485c41e 100644
--- a/src/block.c
+++ b/src/block.c
@@ -19,7 +19,10 @@ getDrive(u8 exttype, u8 extdriveoffset)
{
if (extdriveoffset >= ARRAY_SIZE(Drives.idmap[0]))
return NULL;
- return RETRIEVE_GLOBAL_PTR(GET_GLOBAL(Drives.idmap[exttype][extdriveoffset]));
+ struct drive_s *drive_gf = GET_GLOBAL(Drives.idmap[exttype][extdriveoffset]);
+ if (!drive_gf)
+ return NULL;
+ return GLOBALFLAT2GLOBAL(drive_gf);
}
@@ -196,7 +199,7 @@ map_hd_drive(struct drive_s *drive_g)
return;
}
dprintf(3, "Mapping hd drive %p to %d\n", drive_g, hdcount);
- Drives.idmap[EXTTYPE_HD][hdcount] = STORE_GLOBAL_PTR(drive_g);
+ Drives.idmap[EXTTYPE_HD][hdcount] = drive_g;
SET_BDA(hdcount, hdcount + 1);
// Fill "fdpt" structure.
@@ -230,7 +233,7 @@ add_ordered_drive(struct drive_s **idmap, u8 *count, struct drive_s *drive_g)
if (pos != end)
memmove(pos+1, pos, (void*)end-(void*)pos);
}
- *pos = STORE_GLOBAL_PTR(drive_g);
+ *pos = drive_g;
}
// Map a cd