Changeset 39355 in vbox
- Timestamp:
- Nov 17, 2011 5:25:25 PM (13 years ago)
- Location:
- trunk/src/VBox/Devices/PC/BIOS-new
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS-new/ahci.c
r39340 r39355 766 766 767 767 // Set nb of sector transferred 768 SET_AL(read_word(ebda_seg, (uint16_t)&EbdaData->bdisk. trsfsectors));768 SET_AL(read_word(ebda_seg, (uint16_t)&EbdaData->bdisk.drqp.trsfsectors)); 769 769 770 770 if (status != 0) … … 882 882 } 883 883 884 count=read_word(ebda_seg, &EbdaData->bdisk. trsfsectors);884 count=read_word(ebda_seg, &EbdaData->bdisk.drqp.trsfsectors); 885 885 write_word(DS, SI+(uint16_t)&Int13Ext->count, count); 886 886 -
trunk/src/VBox/Devices/PC/BIOS-new/ata.c
r39340 r39355 267 267 } 268 268 269 // Reset count of transferred data270 AtaData->trsfsectors = 0;271 AtaData->trsfbytes = 0;272 269 current = 0; 273 270 … … 322 319 } 323 320 current += mult_blk_cnt; 324 AtaData-> trsfsectors = current;321 AtaData->drqp.trsfsectors = current; 325 322 count--; 326 323 while (1) { … … 746 743 } 747 744 748 // Reset count of transferred data749 AtaData->trsfsectors = 0;750 AtaData->trsfbytes = 0;751 745 current = 0; 752 746 … … 795 789 796 790 current++; 797 AtaData-> trsfsectors = current;791 AtaData->drqp.trsfsectors = current; 798 792 count--; 799 793 while (1) { … … 877 871 878 872 // Reset count of transferred data 879 AtaData->trsfsectors = 0; 880 AtaData->trsfbytes = 0; 873 // @todo: clear in calling code? 874 AtaData->drqp.trsfsectors = 0; 875 AtaData->drqp.trsfbytes = 0; 881 876 882 877 status = inb(iobase1 + ATA_CB_STAT); … … 1039 1034 // Save transferred bytes count 1040 1035 transfer += count; 1041 AtaData-> trsfbytes = transfer;1036 AtaData->drqp.trsfbytes = transfer; 1042 1037 } 1043 1038 } -
trunk/src/VBox/Devices/PC/BIOS-new/disk.c
r39347 r39355 157 157 } 158 158 159 /* Reset the count of transferred sectors/bytes. */ 160 bios_dsk->drqp.trsfsectors = 0; 161 bios_dsk->drqp.trsfbytes = 0; 162 159 163 if ( GET_AH() == 0x02 ) 160 164 { … … 179 183 180 184 // Set nb of sector transferred 181 SET_AL(bios_dsk-> trsfsectors);185 SET_AL(bios_dsk->drqp.trsfsectors); 182 186 183 187 if (status != 0) { … … 352 356 if (( GET_AH() == 0x44 ) || ( GET_AH() == 0x47 )) 353 357 goto int13x_success; 354 358 359 /* Reset the count of transferred sectors/bytes. */ 360 bios_dsk->drqp.trsfsectors = 0; 361 bios_dsk->drqp.trsfbytes = 0; 362 355 363 // Execute the command 356 364 if ( GET_AH() == 0x42 ) { … … 381 389 } 382 390 383 count = bios_dsk-> trsfsectors;391 count = bios_dsk->drqp.trsfsectors; 384 392 i13_ext->count = count; 385 393 … … 467 475 468 476 checksum = 0; 469 for (i =0; i<15; i++)477 for (i = 0; i < 15; ++i) 470 478 checksum += read_byte(ebda_seg, (uint16_t)&EbdaData->bdisk.dpte + i); 471 479 checksum = -checksum; -
trunk/src/VBox/Devices/PC/BIOS-new/ebda.h
r39346 r39355 161 161 } disk_dev_t; 162 162 163 /* A structure for passing disk request information around. This structure 164 * is designed for saving stack space. As BIOS requests cannot be overlapped, 165 * one such structure is sufficient. 166 */ 167 typedef struct { 168 uint32_t lba; /* Starting LBA. */ 169 void __far *buffer; /* Read/write data buffer pointer. */ 170 uint16_t count; /* Count of sectors to be transferred. */ 171 uint16_t cylinder; /* Starting cylinder (CHS only). */ 172 uint16_t head; /* Starting head (CHS only). */ 173 uint16_t sector; /* Starting sector (CHS only). */ 174 uint16_t trsfsectors; /* Actual sectors transferred. */ 175 uint32_t trsfbytes; /* Actual bytes transferred. */ 176 } disk_req_t; 177 178 /* All BIOS disk information. Disk-related code in the BIOS should not need 179 * anything outside of this structure. 180 */ 163 181 typedef struct { 164 182 /* ATA bus-specific device information. */ … … 183 201 184 202 dpte_t dpte; /* Buffer for building a DPTE. */ 185 uint16_t trsfsectors; /* Count of sectors transferred. */ 186 uint32_t trsfbytes; /* Count of bytes transferred. */ 203 disk_req_t drqp; /* Disk request packet. */ 187 204 } bio_dsk_t; 188 205 -
trunk/src/VBox/Devices/PC/BIOS-new/eltorito.c
r39340 r39355 672 672 status = ata_cmd_packet(device, 12, &atacmd, 0, count*2048L, ATA_DATA_IN, MK_FP(segment,offset)); 673 673 674 count = (uint16_t)(ata-> trsfbytes >> 11);674 count = (uint16_t)(ata->drqp.trsfbytes >> 11); 675 675 write_word(DS, SI+(uint16_t)&Int13Ext->count, count); 676 676 -
trunk/src/VBox/Devices/PC/BIOS-new/inlines.h
r38851 r39355 87 87 #pragma aux rep_outsd = ".386" "rep outs dx,dword ptr es:[si]" parm [es si] [cx] [dx] value [es si] modify exact [cx si]; 88 88 89 uint16_t __far swap_16(uint16_t val); 90 #pragma aux swap_16 = "xchg ah,al" parm [ax] value [ax] modify exact [ax] nomemory; 91 92 uint32_t __far swap_32(uint32_t val); 93 #pragma aux swap_32 = \ 94 "xchg ah, al" \ 95 "xchg dh, dl" \ 96 "xchg ax, dx" \ 97 parm [dx ax] value [dx ax] modify exact [dx ax] nomemory; -
trunk/src/VBox/Devices/PC/BIOS-new/scsi.c
r39347 r39355 24 24 25 25 26 //#define VBOX_SCSI_DEBUG 1 /* temporary */ 27 28 #ifdef VBOX_SCSI_DEBUG 29 # define VBSCSI_DEBUG(...) BX_INFO(__VA_ARGS__) 30 #else 31 # define VBSCSI_DEBUG(...) 32 #endif 33 34 #define VBSCSI_BUSY (1 << 0) 35 26 36 /* The I/O port of the BusLogic SCSI adapter. */ 27 37 #define BUSLOGIC_ISA_IO_PORT 0x330 … … 49 59 #define SCSI_TXDIR_TO_DEVICE 1 50 60 51 #define VBSCSI_BUSY (1 << 0) 52 53 //#define VBOX_SCSI_DEBUG 1 /* temporary */ 54 55 #ifdef VBOX_SCSI_DEBUG 56 # define VBSCSI_DEBUG(...) BX_INFO(__VA_ARGS__) 57 #else 58 # define VBSCSI_DEBUG(...) 59 #endif 61 #pragma pack(1) 62 63 /* READ_10/WRITE_10 CDB layout. */ 64 typedef struct { 65 uint16_t command; /* Command. */ 66 uint32_t lba; /* LBA, MSB first! */ 67 uint8_t pad1; /* Unused. */ 68 uint16_t nsect; /* Sector count, MSB first! */ 69 uint8_t pad2; /* Unused. */ 70 } cdb_rw10; 71 72 #pragma pack() 73 74 ct_assert(sizeof(cdb_rw10) == 10); 60 75 61 76 int scsi_cmd_data_in(uint16_t io_base, uint8_t device_id, uint8_t __far *aCDB, … … 146 161 { 147 162 uint8_t rc; 148 uint8_t aCDB[10];163 cdb_rw10 cdb; 149 164 uint16_t io_base; 150 165 uint8_t target_id; … … 154 169 BX_PANIC("scsi_read_sectors: device_id out of range %d\n", device_id); 155 170 171 /* Prepare a CDB. */ 172 cdb.command = SCSI_READ_10; 173 cdb.lba = swap_32(lba); 174 cdb.pad1 = 0; 175 cdb.nsect = swap_16(count); 176 cdb.pad2 = 0; 177 156 178 bios_dsk = read_word(0x0040, 0x000E) :> &EbdaData->bdisk; 157 158 /* Reset the count of transferred sectors/bytes. */159 bios_dsk->trsfsectors = 0;160 bios_dsk->trsfbytes = 0;161 162 /* Prepare CDB */163 //@todo: make CDB a struct, this is stupid164 aCDB[0] = SCSI_READ_10;165 aCDB[1] = 0;166 aCDB[2] = (uint8_t)(lba >> 24);167 aCDB[3] = (uint8_t)(lba >> 16);168 aCDB[4] = (uint8_t)(lba >> 8);169 aCDB[5] = (uint8_t)(lba);170 aCDB[6] = 0;171 aCDB[7] = (uint8_t)(count >> 8);172 aCDB[8] = (uint8_t)(count);173 aCDB[9] = 0;174 179 175 180 io_base = bios_dsk->scsidev[device_id].io_base; 176 181 target_id = bios_dsk->scsidev[device_id].target_id; 177 182 178 rc = scsi_cmd_data_in(io_base, target_id, aCDB, 10, buffer, (count * 512));183 rc = scsi_cmd_data_in(io_base, target_id, (void __far *)&cdb, 10, buffer, (count * 512)); 179 184 180 185 if (!rc) 181 186 { 182 bios_dsk-> trsfsectors = count;183 bios_dsk-> trsfbytes = count * 512;187 bios_dsk->drqp.trsfsectors = count; 188 bios_dsk->drqp.trsfbytes = count * 512; 184 189 } 185 190 … … 199 204 { 200 205 uint8_t rc; 201 uint8_t aCDB[10];206 cdb_rw10 cdb; 202 207 uint16_t io_base; 203 208 uint8_t target_id; … … 207 212 BX_PANIC("scsi_write_sectors: device_id out of range %d\n", device_id); 208 213 214 /* Prepare a CDB. */ 215 cdb.command = SCSI_WRITE_10; 216 cdb.lba = swap_32(lba); 217 cdb.pad1 = 0; 218 cdb.nsect = swap_16(count); 219 cdb.pad2 = 0; 220 209 221 bios_dsk = read_word(0x0040, 0x000E) :> &EbdaData->bdisk; 210 211 // Reset count of transferred data212 bios_dsk->trsfsectors = 0;213 bios_dsk->trsfbytes = 0;214 215 /* Prepare CDB */216 //@todo: make CDB a struct, this is stupid217 aCDB[0] = SCSI_WRITE_10;218 aCDB[1] = 0;219 aCDB[2] = (uint8_t)(lba >> 24);220 aCDB[3] = (uint8_t)(lba >> 16);221 aCDB[4] = (uint8_t)(lba >> 8);222 aCDB[5] = (uint8_t)(lba);223 aCDB[6] = 0;224 aCDB[7] = (uint8_t)(count >> 8);225 aCDB[8] = (uint8_t)(count);226 aCDB[9] = 0;227 222 228 223 io_base = bios_dsk->scsidev[device_id].io_base; 229 224 target_id = bios_dsk->scsidev[device_id].target_id; 230 225 231 rc = scsi_cmd_data_out(io_base, target_id, aCDB, 10, buffer, (count * 512));226 rc = scsi_cmd_data_out(io_base, target_id, (void __far *)&cdb, 10, buffer, (count * 512)); 232 227 233 228 if (!rc) 234 229 { 235 bios_dsk-> trsfsectors = count;236 bios_dsk-> trsfbytes = (count * 512);230 bios_dsk->drqp.trsfsectors = count; 231 bios_dsk->drqp.trsfbytes = (count * 512); 237 232 } 238 233
Note:
See TracChangeset
for help on using the changeset viewer.