diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2009-10-22 21:48:39 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2009-10-22 21:48:39 -0400 |
commit | 77d227b650c50a7dd0dbaf0ff2ec8681084ddc5f (patch) | |
tree | d8a9944c41e922f2c88269066230bc2effd1d425 /src/ramdisk.c | |
parent | 9db772a3e6f609ff2969aa644785c7cb66fbd988 (diff) | |
download | seabios-77d227b650c50a7dd0dbaf0ff2ec8681084ddc5f.tar.gz |
Pass 'drive_s' pointer instead of driveid.
Pass a pointer to the drive_s struct instead of a driveid array offset.
Don't allocate ata drive's until a real drive found.
Introduce getDrive() and allocDrive() functions.
Diffstat (limited to 'src/ramdisk.c')
-rw-r--r-- | src/ramdisk.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/ramdisk.c b/src/ramdisk.c index 36b9f226..c1e0b8af 100644 --- a/src/ramdisk.c +++ b/src/ramdisk.c @@ -11,9 +11,9 @@ #include "bregs.h" // struct bregs void -describe_ramdisk(int driveid) +describe_ramdisk(struct drive_s *drive_g) { - printf("%s", Drives.drives[driveid].model); + printf("%s", drive_g->model); } void @@ -47,16 +47,15 @@ ramdisk_setup() // Setup driver. dprintf(1, "Mapping CBFS floppy %s to addr %p\n", cbfs_filename(file), pos); - int driveid = addFloppy((u32)pos, ftype, DTYPE_RAMDISK); - if (driveid >= 0) - strtcpy(Drives.drives[driveid].model, cbfs_filename(file) - , ARRAY_SIZE(Drives.drives[driveid].model)); + struct drive_s *drive_g = addFloppy((u32)pos, ftype, DTYPE_RAMDISK); + if (drive_g) + strtcpy(drive_g->model, cbfs_filename(file), ARRAY_SIZE(drive_g->model)); } static int ramdisk_copy(struct disk_op_s *op, int iswrite) { - u32 offset = GET_GLOBAL(Drives.drives[op->driveid].cntl_id); + u32 offset = GET_GLOBAL(op->drive_g->cntl_id); offset += (u32)op->lba * DISK_SECTOR_SIZE; u64 opd = GDT_DATA | GDT_LIMIT(0xfffff) | GDT_BASE((u32)op->buf_fl); u64 ramd = GDT_DATA | GDT_LIMIT(0xfffff) | GDT_BASE(offset); |