aboutsummaryrefslogtreecommitdiff
path: root/src/ata.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2010-02-15 22:48:28 -0500
committerKevin O'Connor <kevin@koconnor.net>2010-02-15 22:48:28 -0500
commitd7e998fdd0ea1cacbc83e9add182c49917bf35e6 (patch)
treef9ef70f06a3ba914abff8ad6531be34d5ec3dc28 /src/ata.c
parent525be697f95eaa6a037b924afc99c971c0444db6 (diff)
downloadseabios-hppa-d7e998fdd0ea1cacbc83e9add182c49917bf35e6.zip
seabios-hppa-d7e998fdd0ea1cacbc83e9add182c49917bf35e6.tar.gz
seabios-hppa-d7e998fdd0ea1cacbc83e9add182c49917bf35e6.tar.bz2
Dynamically allocate each drive_g with malloc_fseg().
This eliminates the limit on the number of available drives. It also allows for each driver to allocate additional custom fields.
Diffstat (limited to 'src/ata.c')
-rw-r--r--src/ata.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/ata.c b/src/ata.c
index a27da56..f935e1f 100644
--- a/src/ata.c
+++ b/src/ata.c
@@ -775,9 +775,12 @@ init_drive_atapi(struct drive_s *dummy, u16 *buffer)
return NULL;
// Success - setup as ATAPI.
- struct drive_s *drive_g = allocDrive();
- if (! drive_g)
+ struct drive_s *drive_g = malloc_fseg(sizeof(*drive_g));
+ if (! drive_g) {
+ warn_noalloc();
return NULL;
+ }
+ memset(drive_g, 0, sizeof(*drive_g));
SET_GLOBAL(drive_g->cntl_id, dummy->cntl_id);
extract_identify(drive_g, buffer);
SET_GLOBAL(drive_g->type, DTYPE_ATAPI);
@@ -821,9 +824,12 @@ init_drive_ata(struct drive_s *dummy, u16 *buffer)
return NULL;
// Success - setup as ATA.
- struct drive_s *drive_g = allocDrive();
- if (! drive_g)
+ struct drive_s *drive_g = malloc_fseg(sizeof(*drive_g));
+ if (! drive_g) {
+ warn_noalloc();
return NULL;
+ }
+ memset(drive_g, 0, sizeof(*drive_g));
SET_GLOBAL(drive_g->cntl_id, dummy->cntl_id);
extract_identify(drive_g, buffer);
SET_GLOBAL(drive_g->type, DTYPE_ATA);