diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2010-02-15 22:48:28 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2010-02-15 22:48:28 -0500 |
commit | d7e998fdd0ea1cacbc83e9add182c49917bf35e6 (patch) | |
tree | f9ef70f06a3ba914abff8ad6531be34d5ec3dc28 /src/ata.c | |
parent | 525be697f95eaa6a037b924afc99c971c0444db6 (diff) | |
download | seabios-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.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -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); |