Changeset 39340 in vbox
- Timestamp:
- Nov 16, 2011 5:59:23 PM (13 years ago)
- Location:
- trunk/src/VBox/Devices/PC/BIOS-new
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS-new/ahci.c
r38997 r39340 29 29 #include "vds.h" 30 30 31 #define VBOX_AHCI_DEBUG 031 #define VBOX_AHCI_DEBUG 1 32 32 #define VBOX_AHCI_INT13_DEBUG 0 33 33 … … 672 672 673 673 ebda_seg = read_word(0x0040, 0x000E); 674 ahci_seg 674 ahci_seg = read_word(ebda_seg, (uint16_t)&EbdaData->ahci_seg); 675 675 u16IoBase = read_word(ahci_seg, (uint16_t)&AhciData->iobase); 676 676 old_disks = read_byte(ahci_seg, (uint16_t)&AhciData->cHardDisksOld); … … 766 766 767 767 // Set nb of sector transferred 768 SET_AL(read_word(ebda_seg, (uint16_t)&EbdaData-> ata.trsfsectors));768 SET_AL(read_word(ebda_seg, (uint16_t)&EbdaData->bdisk.trsfsectors)); 769 769 770 770 if (status != 0) … … 869 869 else 870 870 { 871 write_word(ebda_seg,&EbdaData-> ata.devices[device].blksize,count * 0x200);871 write_word(ebda_seg,&EbdaData->bdisk.devices[device].blksize,count * 0x200); 872 872 status=ata_cmd_data_in(device, ATA_CMD_READ_MULTIPLE, count, 0, 0, 0, lba, segment, offset); 873 write_word(ebda_seg,&EbdaData-> ata.devices[device].blksize,0x200);873 write_word(ebda_seg,&EbdaData->bdisk.devices[device].blksize,0x200); 874 874 } 875 875 } … … 882 882 } 883 883 884 count=read_word(ebda_seg, &EbdaData-> ata.trsfsectors);884 count=read_word(ebda_seg, &EbdaData->bdisk.trsfsectors); 885 885 write_word(DS, SI+(uint16_t)&Int13Ext->count, count); 886 886 … … 943 943 944 944 write_word(DS, SI+(uint16_t)&Int13DPT->dpte_segment, ebda_seg); 945 write_word(DS, SI+(uint16_t)&Int13DPT->dpte_offset, &EbdaData-> ata.dpte);945 write_word(DS, SI+(uint16_t)&Int13DPT->dpte_offset, &EbdaData->bdisk.dpte); 946 946 947 947 // Fill in dpte 948 948 channel = device / 2; 949 iobase1 = read_word(ebda_seg, &EbdaData-> ata.channels[channel].iobase1);950 iobase2 = read_word(ebda_seg, &EbdaData-> ata.channels[channel].iobase2);951 irq = read_byte(ebda_seg, &EbdaData-> ata.channels[channel].irq);952 mode = read_byte(ebda_seg, &EbdaData-> ata.devices[device].mode);953 translation = read_byte(ebda_seg, &EbdaData-> ata.devices[device].translation);949 iobase1 = read_word(ebda_seg, &EbdaData->bdisk.channels[channel].iobase1); 950 iobase2 = read_word(ebda_seg, &EbdaData->bdisk.channels[channel].iobase2); 951 irq = read_byte(ebda_seg, &EbdaData->bdisk.channels[channel].irq); 952 mode = read_byte(ebda_seg, &EbdaData->bdisk.devices[device].mode); 953 translation = read_byte(ebda_seg, &EbdaData->bdisk.devices[device].translation); 954 954 955 955 options = (translation==ATA_TRANSLATION_NONE?0:1<<3); // chs translation … … 959 959 options |= (translation==ATA_TRANSLATION_RECHS?3:0<<9); 960 960 961 write_word(ebda_seg, &EbdaData-> ata.dpte.iobase1, iobase1);962 write_word(ebda_seg, &EbdaData-> ata.dpte.iobase2, iobase2);963 //write_byte(ebda_seg, &EbdaData-> ata.dpte.prefix, (0xe | /*(device % 2))<<4*/ );964 write_byte(ebda_seg, &EbdaData-> ata.dpte.unused, 0xcb );965 write_byte(ebda_seg, &EbdaData-> ata.dpte.irq, irq );966 write_byte(ebda_seg, &EbdaData-> ata.dpte.blkcount, 1 );967 write_byte(ebda_seg, &EbdaData-> ata.dpte.dma, 0 );968 write_byte(ebda_seg, &EbdaData-> ata.dpte.pio, 0 );969 write_word(ebda_seg, &EbdaData-> ata.dpte.options, options);970 write_word(ebda_seg, &EbdaData-> ata.dpte.reserved, 0);971 write_byte(ebda_seg, &EbdaData-> ata.dpte.revision, 0x11);961 write_word(ebda_seg, &EbdaData->bdisk.dpte.iobase1, iobase1); 962 write_word(ebda_seg, &EbdaData->bdisk.dpte.iobase2, iobase2); 963 //write_byte(ebda_seg, &EbdaData->bdisk.dpte.prefix, (0xe | /*(device % 2))<<4*/ ); 964 write_byte(ebda_seg, &EbdaData->bdisk.dpte.unused, 0xcb ); 965 write_byte(ebda_seg, &EbdaData->bdisk.dpte.irq, irq ); 966 write_byte(ebda_seg, &EbdaData->bdisk.dpte.blkcount, 1 ); 967 write_byte(ebda_seg, &EbdaData->bdisk.dpte.dma, 0 ); 968 write_byte(ebda_seg, &EbdaData->bdisk.dpte.pio, 0 ); 969 write_word(ebda_seg, &EbdaData->bdisk.dpte.options, options); 970 write_word(ebda_seg, &EbdaData->bdisk.dpte.reserved, 0); 971 write_byte(ebda_seg, &EbdaData->bdisk.dpte.revision, 0x11); 972 972 973 973 checksum=0; 974 974 for (i=0; i<15; i++) 975 checksum+=read_byte(ebda_seg, (&EbdaData-> ata.dpte) + i);975 checksum+=read_byte(ebda_seg, (&EbdaData->bdisk.dpte) + i); 976 976 977 977 checksum = -checksum; 978 write_byte(ebda_seg, &EbdaData-> ata.dpte.checksum, checksum);978 write_byte(ebda_seg, &EbdaData->bdisk.dpte.checksum, checksum); 979 979 } 980 980 … … 986 986 987 987 channel = device / 2; 988 iface = read_byte(ebda_seg, &EbdaData-> ata.channels[channel].iface);989 iobase1 = read_word(ebda_seg, &EbdaData-> ata.channels[channel].iobase1);988 iface = read_byte(ebda_seg, &EbdaData->bdisk.channels[channel].iface); 989 iobase1 = read_word(ebda_seg, &EbdaData->bdisk.channels[channel].iobase1); 990 990 991 991 write_word(DS, SI+(uint16_t)&Int13DPT->size, 0x42); -
trunk/src/VBox/Devices/PC/BIOS-new/ata.c
r38848 r39340 83 83 uint16_t ebda_seg=read_word(0x0040,0x000E); 84 84 uint8_t channel, device; 85 ata_t __far*AtaData;86 87 AtaData = ebda_seg :> &EbdaData-> ata;85 bio_dsk_t __far *AtaData; 86 87 AtaData = ebda_seg :> &EbdaData->bdisk; 88 88 89 89 // Channels info init. … … 136 136 uint16_t max; 137 137 uint16_t pdelay; 138 ata_t __far*AtaData;139 140 AtaData = ebda_seg :> &EbdaData-> ata;138 bio_dsk_t __far *AtaData; 139 140 AtaData = ebda_seg :> &EbdaData->bdisk; 141 141 channel = device / 2; 142 142 slave = device % 2; … … 214 214 uint8_t channel, slave; 215 215 uint8_t status, current, mode; 216 ata_t __far*AtaData;217 218 AtaData = ebda_seg :> &EbdaData-> ata;216 bio_dsk_t __far *AtaData; 217 218 AtaData = ebda_seg :> &EbdaData->bdisk; 219 219 220 220 channel = device / 2; … … 364 364 uint8_t hdcount, cdcount, device, type; 365 365 uint8_t buffer[0x0200]; 366 ata_t __far*AtaData;367 368 AtaData = ebda_seg :> &EbdaData-> ata;366 bio_dsk_t __far *AtaData; 367 368 AtaData = ebda_seg :> &EbdaData->bdisk; 369 369 370 370 #if BX_MAX_ATA_INTERFACES > 0 … … 697 697 uint16_t head, uint16_t sector, uint32_t lba, char __far *buffer) 698 698 { 699 uint16_t ebda_seg = read_word(0x0040,0x000E);700 uint16_t iobase1, iobase2, blksize;701 uint8_t channel, slave;702 uint8_t status, current, mode;703 ata_t __far *AtaData;704 705 AtaData = ebda_seg :> &EbdaData-> ata;699 uint16_t ebda_seg = read_word(0x0040,0x000E); 700 uint16_t iobase1, iobase2, blksize; 701 uint8_t channel, slave; 702 uint8_t status, current, mode; 703 bio_dsk_t __far *AtaData; 704 705 AtaData = ebda_seg :> &EbdaData->bdisk; 706 706 707 707 channel = device / 2; … … 840 840 uint16_t header, uint32_t length, uint8_t inout, char __far *buffer) 841 841 { 842 uint16_t ebda_seg = read_word(0x0040,0x000E);843 uint16_t iobase1, iobase2;844 uint16_t lcount, lbefore, lafter, count;845 uint8_t channel, slave;846 uint8_t status, mode, lmode;847 uint32_t transfer;848 ata_t __far *AtaData;849 850 AtaData = ebda_seg :> &EbdaData-> ata;842 uint16_t ebda_seg = read_word(0x0040,0x000E); 843 uint16_t iobase1, iobase2; 844 uint16_t lcount, lbefore, lafter, count; 845 uint8_t channel, slave; 846 uint8_t status, mode, lmode; 847 uint32_t transfer; 848 bio_dsk_t __far *AtaData; 849 850 AtaData = ebda_seg :> &EbdaData->bdisk; 851 851 852 852 channel = device / 2; … … 1065 1065 { 1066 1066 uint16_t ebda_seg = read_word(0x0040,0x000E); 1067 ata_t __far*AtaData;1068 1069 AtaData = ebda_seg :> &EbdaData-> ata;1067 bio_dsk_t __far *AtaData; 1068 1069 AtaData = ebda_seg :> &EbdaData->bdisk; 1070 1070 1071 1071 if (device >= BX_MAX_ATA_DEVICES) -
trunk/src/VBox/Devices/PC/BIOS-new/biosint.h
r38997 r39340 39 39 */ 40 40 41 42 /* Compile-time assertion macro. */ 43 #define ct_assert(a) extern int ct_ass_arr[!!(a) == 1]; 41 44 42 45 /* For functions called from assembly code. */ -
trunk/src/VBox/Devices/PC/BIOS-new/disk.c
r38808 r39340 88 88 89 89 // Get the ata channel 90 device = ebda_data-> ata.hdidmap[GET_ELDL()-0x80];90 device = ebda_data->bdisk.hdidmap[GET_ELDL()-0x80]; 91 91 92 92 // basic check : device has to be valid … … 136 136 #endif 137 137 { 138 nlc = ebda_data-> ata.devices[device].lchs.cylinders;139 nlh = ebda_data-> ata.devices[device].lchs.heads;140 nlspt = ebda_data-> ata.devices[device].lchs.spt;138 nlc = ebda_data->bdisk.devices[device].lchs.cylinders; 139 nlh = ebda_data->bdisk.devices[device].lchs.heads; 140 nlspt = ebda_data->bdisk.devices[device].lchs.spt; 141 141 } 142 142 #ifdef VBOX_WITH_SCSI … … 164 164 #endif 165 165 { 166 nph = ebda_data-> ata.devices[device].pchs.heads;167 npspt = ebda_data-> ata.devices[device].pchs.spt;166 nph = ebda_data->bdisk.devices[device].pchs.heads; 167 npspt = ebda_data->bdisk.devices[device].pchs.spt; 168 168 } 169 169 #ifdef VBOX_WITH_SCSI … … 196 196 #endif 197 197 { 198 ebda_data-> ata.devices[device].blksize = count * 0x200;198 ebda_data->bdisk.devices[device].blksize = count * 0x200; 199 199 status=ata_cmd_data_in(device, ATA_CMD_READ_MULTIPLE, count, cylinder, head, sector, lba, MK_FP(ES, BX)); 200 ebda_data-> ata.devices[device].blksize = 0x200;200 ebda_data->bdisk.devices[device].blksize = 0x200; 201 201 } 202 202 } else { … … 210 210 211 211 // Set nb of sector transferred 212 SET_AL(ebda_data-> ata.trsfsectors);212 SET_AL(ebda_data->bdisk.trsfsectors); 213 213 214 214 if (status != 0) { … … 234 234 #endif 235 235 { 236 nlc = ebda_data-> ata.devices[device].lchs.cylinders;237 nlh = ebda_data-> ata.devices[device].lchs.heads;238 nlspt = ebda_data-> ata.devices[device].lchs.spt;236 nlc = ebda_data->bdisk.devices[device].lchs.cylinders; 237 nlh = ebda_data->bdisk.devices[device].lchs.heads; 238 nlspt = ebda_data->bdisk.devices[device].lchs.spt; 239 239 } 240 240 #ifdef VBOX_WITH_SCSI … … 247 247 #endif 248 248 249 count = ebda_data-> ata.hdcount;249 count = ebda_data->bdisk.hdcount; 250 250 /* Maximum cylinder number is just one less than the number of cylinders. */ 251 251 nlc = nlc - 1; /* 0 based , last sector not used */ … … 266 266 267 267 // Read the status from controller 268 status = inb(ebda_data-> ata.channels[device/2].iobase1 + ATA_CB_STAT);268 status = inb(ebda_data->bdisk.channels[device/2].iobase1 + ATA_CB_STAT); 269 269 if ( (status & ( ATA_CB_STAT_BSY | ATA_CB_STAT_RDY )) == ATA_CB_STAT_RDY ) { 270 270 goto int13_success; … … 282 282 #endif 283 283 { 284 npc = ebda_data-> ata.devices[device].pchs.cylinders;285 nph = ebda_data-> ata.devices[device].pchs.heads;286 npspt = ebda_data-> ata.devices[device].pchs.spt;284 npc = ebda_data->bdisk.devices[device].pchs.cylinders; 285 nph = ebda_data->bdisk.devices[device].pchs.heads; 286 npspt = ebda_data->bdisk.devices[device].pchs.spt; 287 287 } 288 288 #ifdef VBOX_WITH_SCSI … … 364 364 365 365 // Get the ata channel 366 device = ebda_data-> ata.hdidmap[GET_ELDL()-0x80];366 device = ebda_data->bdisk.hdidmap[GET_ELDL()-0x80]; 367 367 368 368 // basic check : device has to be valid … … 412 412 else 413 413 #endif 414 if (lba >= ebda_data-> ata.devices[device].sectors) {414 if (lba >= ebda_data->bdisk.devices[device].sectors) { 415 415 BX_INFO("%s: function %02x. LBA out of range\n", __func__, GET_AH()); 416 416 goto int13x_fail; … … 431 431 status=ata_cmd_data_in(device, ATA_CMD_READ_SECTORS_EXT, count, 0, 0, 0, lba, MK_FP(segment, offset)); 432 432 else { 433 ebda_data-> ata.devices[device].blksize = count * 0x200;433 ebda_data->bdisk.devices[device].blksize = count * 0x200; 434 434 status=ata_cmd_data_in(device, ATA_CMD_READ_MULTIPLE, count, 0, 0, 0, lba, MK_FP(segment, offset)); 435 ebda_data-> ata.devices[device].blksize = 0x200;435 ebda_data->bdisk.devices[device].blksize = 0x200; 436 436 } 437 437 } … … 449 449 } 450 450 451 count = ebda_data-> ata.trsfsectors;451 count = ebda_data->bdisk.trsfsectors; 452 452 i13_ext->count = count; 453 453 … … 487 487 #endif 488 488 { 489 npc = ebda_data-> ata.devices[device].pchs.cylinders;490 nph = ebda_data-> ata.devices[device].pchs.heads;491 npspt = ebda_data-> ata.devices[device].pchs.spt;492 lba = ebda_data-> ata.devices[device].sectors;493 blksize = ebda_data-> ata.devices[device].blksize;489 npc = ebda_data->bdisk.devices[device].pchs.cylinders; 490 nph = ebda_data->bdisk.devices[device].pchs.heads; 491 npspt = ebda_data->bdisk.devices[device].pchs.spt; 492 lba = ebda_data->bdisk.devices[device].sectors; 493 blksize = ebda_data->bdisk.devices[device].blksize; 494 494 } 495 495 #ifdef VBOX_WITH_SCSI … … 520 520 dpt->size = 0x1e; 521 521 dpt->dpte_segment = ebda_seg; 522 dpt->dpte_offset = (uint16_t)&EbdaData-> ata.dpte;522 dpt->dpte_offset = (uint16_t)&EbdaData->bdisk.dpte; 523 523 524 524 // Fill in dpte 525 525 channel = device / 2; 526 iobase1 = ebda_data-> ata.channels[channel].iobase1;527 iobase2 = ebda_data-> ata.channels[channel].iobase2;528 irq = ebda_data-> ata.channels[channel].irq;529 mode = ebda_data-> ata.devices[device].mode;530 translation = ebda_data-> ata.devices[device].translation;526 iobase1 = ebda_data->bdisk.channels[channel].iobase1; 527 iobase2 = ebda_data->bdisk.channels[channel].iobase2; 528 irq = ebda_data->bdisk.channels[channel].irq; 529 mode = ebda_data->bdisk.devices[device].mode; 530 translation = ebda_data->bdisk.devices[device].translation; 531 531 532 532 options = (translation == ATA_TRANSLATION_NONE ? 0 : 1 << 3); // chs translation … … 536 536 options |= (translation==ATA_TRANSLATION_RECHS ? 3 : 0 << 9); 537 537 538 ebda_data-> ata.dpte.iobase1 = iobase1;539 ebda_data-> ata.dpte.iobase2 = iobase2;540 ebda_data-> ata.dpte.prefix = (0xe | (device % 2)) << 4;541 ebda_data-> ata.dpte.unused = 0xcb;542 ebda_data-> ata.dpte.irq = irq;543 ebda_data-> ata.dpte.blkcount = 1;544 ebda_data-> ata.dpte.dma = 0;545 ebda_data-> ata.dpte.pio = 0;546 ebda_data-> ata.dpte.options = options;547 ebda_data-> ata.dpte.reserved = 0;548 ebda_data-> ata.dpte.revision = 0x11;538 ebda_data->bdisk.dpte.iobase1 = iobase1; 539 ebda_data->bdisk.dpte.iobase2 = iobase2; 540 ebda_data->bdisk.dpte.prefix = (0xe | (device % 2)) << 4; 541 ebda_data->bdisk.dpte.unused = 0xcb; 542 ebda_data->bdisk.dpte.irq = irq; 543 ebda_data->bdisk.dpte.blkcount = 1; 544 ebda_data->bdisk.dpte.dma = 0; 545 ebda_data->bdisk.dpte.pio = 0; 546 ebda_data->bdisk.dpte.options = options; 547 ebda_data->bdisk.dpte.reserved = 0; 548 ebda_data->bdisk.dpte.revision = 0x11; 549 549 550 550 checksum = 0; 551 551 for (i=0; i<15; i++) 552 checksum += read_byte(ebda_seg, (uint16_t)&EbdaData-> ata.dpte + i);552 checksum += read_byte(ebda_seg, (uint16_t)&EbdaData->bdisk.dpte + i); 553 553 checksum = -checksum; 554 ebda_data-> ata.dpte.checksum = checksum;554 ebda_data->bdisk.dpte.checksum = checksum; 555 555 } 556 556 … … 561 561 562 562 channel = device / 2; 563 iface = ebda_data-> ata.channels[channel].iface;564 iobase1 = ebda_data-> ata.channels[channel].iobase1;563 iface = ebda_data->bdisk.channels[channel].iface; 564 iobase1 = ebda_data->bdisk.channels[channel].iobase1; 565 565 566 566 dpt->size = 0x42; -
trunk/src/VBox/Devices/PC/BIOS-new/ebda.h
r38848 r39340 63 63 64 64 /* Generic storage device types. Bit of a misnomer! */ 65 #define ATA_TYPE_NONE 0x0066 #define ATA_TYPE_UNKNOWN 0x0167 #define ATA_TYPE_ATA 0x0268 #define ATA_TYPE_ATAPI 0x0369 #define ATA_TYPE_SCSI 0x04 // SCSI disk70 71 #define ATA_DEVICE_NONE 0x0072 #define ATA_DEVICE_HD 0xFF73 #define ATA_DEVICE_CDROM 0x0565 #define ATA_TYPE_NONE 0x00 66 #define ATA_TYPE_UNKNOWN 0x01 67 #define ATA_TYPE_ATA 0x02 68 #define ATA_TYPE_ATAPI 0x03 69 #define ATA_TYPE_SCSI 0x04 // SCSI disk 70 71 #define ATA_DEVICE_NONE 0x00 72 #define ATA_DEVICE_HD 0xFF 73 #define ATA_DEVICE_CDROM 0x05 74 74 75 75 76 76 #if 1 //BX_USE_ATADRV 77 77 78 //@todo: does the struct really have to be misaligned? 79 #pragma pack(0) 80 81 typedef struct { 82 uint16_t heads; // # heads 83 uint16_t cylinders; // # cylinders 84 uint16_t spt; // # sectors / track 85 } chs_t; 86 87 // DPTE definition 78 /* Note: The DPTE and FDPT structures are industry standards and 79 * may not be modified. The other disk-related structures are 80 * internal to the BIOS. 81 */ 82 83 /* Translated DPT (Device Parameter Table). */ 88 84 typedef struct { 89 85 uint16_t iobase1; … … 101 97 } dpte_t; 102 98 103 typedef struct { 104 uint8_t iface; // ISA or PCI 105 uint16_t iobase1; // IO Base 1 106 uint16_t iobase2; // IO Base 2 107 uint8_t irq; // IRQ 108 } ata_channel_t; 109 110 typedef struct { 111 uint8_t type; // Detected type of ata (ata/atapi/none/unknown/scsi) 112 uint8_t device; // Detected type of attached devices (hd/cd/none) 113 uint8_t removable; // Removable device flag 114 uint8_t lock; // Locks for removable devices 115 uint8_t mode; // transfer mode : PIO 16/32 bits - IRQ - ISADMA - PCIDMA 116 uint16_t blksize; // block size 117 118 uint8_t translation; // type of translation 119 chs_t lchs; // Logical CHS 120 chs_t pchs; // Physical CHS 121 122 uint32_t sectors; // Total sectors count 123 } ata_device_t; 124 125 typedef struct { 126 // ATA channels info 127 ata_channel_t channels[BX_MAX_ATA_INTERFACES]; 128 129 // ATA devices info 130 ata_device_t devices[BX_MAX_ATA_DEVICES]; 131 // 132 // map between (bios hd id - 0x80) and ata channels and scsi disks. 133 uint8_t hdcount, hdidmap[BX_MAX_STORAGE_DEVICES]; 134 135 // map between (bios cd id - 0xE0) and ata channels 136 uint8_t cdcount, cdidmap[BX_MAX_STORAGE_DEVICES]; 137 138 // Buffer for DPTE table 139 dpte_t dpte; 140 141 // Count of transferred sectors and bytes 142 uint16_t trsfsectors; 143 uint32_t trsfbytes; 144 } ata_t; 145 146 #if BX_ELTORITO_BOOT 147 // ElTorito Device Emulation data 148 typedef struct { 149 uint8_t active; 150 uint8_t media; 151 uint8_t emulated_drive; 152 uint8_t controller_index; 153 uint16_t device_spec; 154 uint32_t ilba; 155 uint16_t buffer_segment; 156 uint16_t load_segment; 157 uint16_t sector_count; 158 159 // Virtual device 160 chs_t vdevice; 161 } cdemu_t; 162 #endif // BX_ELTORITO_BOOT 163 164 #ifdef VBOX_WITH_SCSI 165 typedef struct { 166 // I/O port this device is attached to. 167 uint16_t io_base; 168 // Target Id. 169 uint8_t target_id; 170 // SCSI devices info 171 ata_device_t device_info; 172 } scsi_device_t; 173 174 typedef struct { 175 // SCSI device info 176 scsi_device_t devices[BX_MAX_SCSI_DEVICES]; 177 // Number of scsi disks. 178 uint8_t hdcount; 179 } scsi_t; 180 #endif 181 182 #ifdef VBOX_WITH_BIOS_AHCI 183 //typedef struct { 184 // uint16_t iobase; 185 //} ahci_t; 186 #endif 187 99 ct_assert(sizeof(dpte_t) == 16); /* Ensure correct size. */ 100 101 #pragma pack(0) 102 103 /* FDPT - Fixed Disk Parameter Table. PC/AT compatible; note 104 * that this structure is slightly misaligned. 105 */ 188 106 typedef struct { 189 107 uint16_t lcyl; … … 199 117 } fdpt_t; 200 118 119 #pragma pack() 120 121 ct_assert(sizeof(fdpt_t) == 16); /* Ensure correct size. */ 122 123 124 /* C/H/S geometry information. */ 125 typedef struct { 126 uint16_t heads; /* Number of heads. */ 127 uint16_t cylinders; /* Number of cylinders. */ 128 uint16_t spt; /* Number of sectors per track. */ 129 } chs_t; 130 131 typedef struct { 132 uint8_t iface; // ISA or PCI 133 uint8_t irq; // IRQ 134 uint16_t iobase1; // IO Base 1 135 uint16_t iobase2; // IO Base 2 136 } ata_chan_t; 137 138 typedef struct { 139 uint8_t type; // Detected type of disk (ata/atapi/none/unknown/scsi) 140 uint8_t device; // Detected type of attached devices (hd/cd/none) 141 uint8_t removable; // Removable device flag 142 uint8_t lock; // Locks for removable devices 143 uint8_t mode; // transfer mode : PIO 16/32 bits - IRQ - ISADMA - PCIDMA 144 uint8_t translation; // type of translation 145 uint16_t blksize; // block size 146 chs_t lchs; // Logical CHS 147 chs_t pchs; // Physical CHS 148 uint32_t sectors; // Total sectors count 149 } ata_dev_t; 150 151 typedef struct { 152 // ATA channels info 153 ata_chan_t channels[BX_MAX_ATA_INTERFACES]; 154 155 // ATA devices info 156 ata_dev_t devices[BX_MAX_ATA_DEVICES]; 157 // 158 // map between (bios hd id - 0x80) and ata channels and scsi disks. 159 uint8_t hdcount, hdidmap[BX_MAX_STORAGE_DEVICES]; 160 161 // map between (bios cd id - 0xE0) and ata channels 162 uint8_t cdcount, cdidmap[BX_MAX_STORAGE_DEVICES]; 163 164 // Buffer for DPTE table 165 dpte_t dpte; 166 167 // Count of transferred sectors and bytes 168 uint16_t trsfsectors; 169 uint32_t trsfbytes; 170 } bio_dsk_t; 171 172 #if BX_ELTORITO_BOOT 173 // ElTorito Device Emulation data 174 typedef struct { 175 uint8_t active; 176 uint8_t media; 177 uint8_t emulated_drive; 178 uint8_t controller_index; 179 uint16_t device_spec; 180 uint16_t buffer_segment; 181 uint32_t ilba; 182 uint16_t load_segment; 183 uint16_t sector_count; 184 chs_t vdevice; /* Virtual device geometry. */ 185 } cdemu_t; 186 #endif 187 188 #ifdef VBOX_WITH_SCSI 189 typedef struct { 190 // I/O port this device is attached to. 191 uint16_t io_base; 192 // Target Id. 193 uint8_t target_id; 194 // SCSI devices info 195 ata_dev_t device_info; 196 } scsi_dev_t; 197 198 typedef struct { 199 // SCSI device info 200 scsi_dev_t devices[BX_MAX_SCSI_DEVICES]; 201 // Number of scsi disks. 202 uint8_t hdcount; 203 } scsi_t; 204 #endif 205 201 206 // for access to EBDA area 202 207 // The EBDA structure should conform to 203 208 // http://www.frontiernet.net/~fys/rombios.htm document 204 209 // I made the ata and cdemu structs begin at 0x121 in the EBDA seg 205 /* MS-DOS KEYB.COM may overwrite the word at offset 0x117 in the EBDA. */ 210 /* MS-DOS KEYB.COM may overwrite the word at offset 0x117 in the EBDA 211 * which contains the keyboard ID for PS/2 BIOSes. 212 */ 206 213 typedef struct { 207 214 unsigned char filler1[0x3D]; … … 218 225 #endif 219 226 220 // ATA Driver data 221 ata_t ata; 227 bio_dsk_t bdisk; /* Disk driver data (ATA/SCSI/AHCI). */ 222 228 223 229 #if BX_ELTORITO_BOOT 224 // El Torito Emulation data 225 cdemu_t cdemu; 226 #endif // BX_ELTORITO_BOOT 230 cdemu_t cdemu; /* El Torito floppy/HD emulation data. */ 231 #endif 227 232 228 233 #ifdef VBOX_WITH_SCSI 229 234 // SCSI Driver data 230 235 scsi_t scsi; 231 # 236 #endif 232 237 233 238 #ifdef VBOX_WITH_BIOS_AHCI … … 240 245 } ebda_data_t; 241 246 242 #pragma pack() 247 ct_assert(sizeof(ebda_data_t) < 0x400); /* Must be under 1K in size. */ 243 248 244 249 // the last 16 bytes of the EBDA segment are used for the MPS floating -
trunk/src/VBox/Devices/PC/BIOS-new/eltorito.c
r38699 r39340 346 346 write_byte(0x40,0x10,read_byte(0x40,0x10)|0x41); 347 347 else 348 write_byte(ebda_seg,(uint16_t)&EbdaData-> ata.hdcount, read_byte(ebda_seg, (uint16_t)&EbdaData->ata.hdcount) + 1);348 write_byte(ebda_seg,(uint16_t)&EbdaData->bdisk.hdcount, read_byte(ebda_seg, (uint16_t)&EbdaData->bdisk.hdcount) + 1); 349 349 } 350 350 … … 572 572 uint32_t lba; 573 573 uint16_t count, segment, offset, size; 574 ata_t __far*ata;575 576 ata = ebda_seg :> &EbdaData-> ata;574 bio_dsk_t __far *ata; 575 576 ata = ebda_seg :> &EbdaData->bdisk; 577 577 578 578 … … 780 780 781 781 write_word(DS, SI+(uint16_t)&Int13DPT->dpte_segment, ebda_seg); 782 write_word(DS, SI+(uint16_t)&Int13DPT->dpte_offset, (uint16_t)&EbdaData-> ata.dpte);782 write_word(DS, SI+(uint16_t)&Int13DPT->dpte_offset, (uint16_t)&EbdaData->bdisk.dpte); 783 783 784 784 // Fill in dpte … … 808 808 809 809 checksum=0; 810 for (i=0; i<15; i++) checksum += read_byte(ebda_seg, (uint16_t)&EbdaData->ata.dpte + i); 810 for (i=0; i<15; i++) 811 checksum += read_byte(ebda_seg, (uint16_t)&EbdaData->bdisk.dpte + i); 811 812 checksum = -checksum; 812 813 ata->dpte.checksum = checksum; -
trunk/src/VBox/Devices/PC/BIOS-new/notes.txt
r38899 r39340 29 29 horribly. DOS 6.x with EMM386 is a good testcase (esp. loading drivers 30 30 into UMBs). 31 32 - Many older OSes (especially UNIX based) require the FDPT to contain 33 physical ATA disk geometry; for that reason, disks smaller than ~500MB are 34 easiest to use. Otherwise a "large" BIOS disk option would be required. 35 36 - Some really old OSes (Xenix circa 1986-7) do not understand the EBDA idea 37 and clear the memory. For those, the FDPT must be in the BIOS ROM area, or 38 the OS will destroy it (even when it's at 0:300 in the IVT). 31 39 32 40 -
trunk/src/VBox/Devices/PC/BIOS-new/scsi.c
r38699 r39340 158 158 159 159 // Reset count of transferred data 160 ebda_data-> ata.trsfsectors = 0;161 ebda_data-> ata.trsfbytes = 0;160 ebda_data->bdisk.trsfsectors = 0; 161 ebda_data->bdisk.trsfbytes = 0; 162 162 163 163 /* Prepare CDB */ … … 181 181 if (!rc) 182 182 { 183 ebda_data-> ata.trsfsectors = count;184 ebda_data-> ata.trsfbytes = count * 512;183 ebda_data->bdisk.trsfsectors = count; 184 ebda_data->bdisk.trsfbytes = count * 512; 185 185 } 186 186 … … 212 212 213 213 // Reset count of transferred data 214 ebda_data-> ata.trsfsectors = 0;215 ebda_data-> ata.trsfbytes = 0;214 ebda_data->bdisk.trsfsectors = 0; 215 ebda_data->bdisk.trsfbytes = 0; 216 216 217 217 /* Prepare CDB */ … … 235 235 if (!rc) 236 236 { 237 ebda_data-> ata.trsfsectors = count;238 ebda_data-> ata.trsfbytes = (count * 512);237 ebda_data->bdisk.trsfsectors = count; 238 ebda_data->bdisk.trsfbytes = (count * 512); 239 239 } 240 240 … … 366 366 367 367 /* Store the id of the disk in the ata hdidmap. */ 368 hdcount = ebda_data-> ata.hdcount;369 ebda_data-> ata.hdidmap[hdcount] = hdcount_scsi + BX_MAX_ATA_DEVICES;368 hdcount = ebda_data->bdisk.hdcount; 369 ebda_data->bdisk.hdidmap[hdcount] = hdcount_scsi + BX_MAX_ATA_DEVICES; 370 370 hdcount++; 371 ebda_data-> ata.hdcount = hdcount;371 ebda_data->bdisk.hdcount = hdcount; 372 372 373 373 /* Update hdcount in the BDA. */
Note:
See TracChangeset
for help on using the changeset viewer.