- Timestamp:
- Sep 18, 2008 11:29:49 AM (16 years ago)
- Location:
- trunk/src/VBox/Devices/PC/BIOS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS/Makefile.kmk
r12269 r12560 67 67 68 68 # 1. precompile rombios.c 69 $$(PATH_PcBiosBin)/_rombios_.c: $(PATH_SUB_CURRENT)/rombios.c $(PATH_SUB_CURRENT)/logo.c $(PATH_SUB_CURRENT)/apmbios.S \69 $$(PATH_PcBiosBin)/_rombios_.c: $(PATH_SUB_CURRENT)/rombios.c $(PATH_SUB_CURRENT)/logo.c $(PATH_SUB_CURRENT)/apmbios.S $(PATH_SUB_CURRENT)/scsi.c \ 70 70 $(PATH_SUB_CURRENT)/../DevPcBios.h $(PATH_ROOT)/include/VBox/bioslogo.h | $$(dir $$@) 71 71 $(call MSG_TOOL,cpp,PcBiosBin,$<,$@) -
trunk/src/VBox/Devices/PC/BIOS/rombios.c
r12494 r12560 219 219 #endif 220 220 221 #if defined(VBOX) && (defined(VBOX_WITH_BUSLOGIC) || defined(VBOX_WITH_LSILOGIC))222 # define BX_MAX_SCSI_DEVICES 1 6221 #ifdef VBOX_WITH_SCSI 222 # define BX_MAX_SCSI_DEVICES 1 223 223 #endif 224 224 … … 720 720 ata_device_t devices[BX_MAX_ATA_DEVICES]; 721 721 // 722 // map between (bios hd id - 0x80) and ata channels 722 // map between (bios hd id - 0x80) and ata channels and scsi disks. 723 #ifdef VBOX_WITH_SCSI 724 Bit8u hdcount, hdidmap[BX_MAX_ATA_DEVICES+BX_MAX_SCSI_DEVICES]; 725 #else 723 726 Bit8u hdcount, hdidmap[BX_MAX_ATA_DEVICES]; 727 #endif 724 728 725 729 // map between (bios cd id - 0xE0) and ata channels … … 753 757 #endif // BX_ELTORITO_BOOT 754 758 755 #ifdef VBOX 756 # if defined(VBOX_WITH_BUSLOGIC) || defined(VBOX_WITH_LSILOGIC) 759 #ifdef VBOX_WITH_SCSI 757 760 typedef struct { 758 761 // I/O port this device is attached to. … … 767 770 // SCSi device info 768 771 scsi_device_t devices[BX_MAX_SCSI_DEVICES]; 769 // map between (bios hd id - 0x80) and scsi devices770 Bit8u hdcount , hdidmap[BX_MAX_SCSI_DEVICES];772 // Number of scsi disks. 773 Bit8u hdcount; 771 774 } scsi_t; 772 # endif773 775 #endif 774 776 … … 793 795 cdemu_t cdemu; 794 796 #endif // BX_ELTORITO_BOOT 797 795 798 #ifdef VBOX 796 # if defined(VBOX_WITH_BUSLOGIC) || defined(VBOX_WITH_LSILOGIC) 799 800 #ifdef VBOX_WITH_SCSI 797 801 // SCSI Driver data 798 //scsi_t scsi;802 scsi_t scsi; 799 803 # endif 800 804 … … 2139 2143 } 2140 2144 2141 #if VBOX2142 # if VBOX_WITH_BUSLOGIC || VBOX_WITH_LSILOGIC2143 # include "scsi.c"2144 # endif2145 #endif2146 2147 2145 #if BX_USE_ATADRV 2148 2146 … … 3777 3775 // --------------------------------------------------------------------------- 3778 3776 #endif // BX_ELTORITO_BOOT 3777 3778 #ifdef VBOX_WITH_SCSI 3779 # include "scsi.c" 3780 #endif 3779 3781 3780 3782 void … … 5371 5373 write_byte(0x0040, 0x008e, 0); // clear completion flag 5372 5374 5375 #ifdef VBOX_WITH_SCSI 5376 // basic check : device has to be defined 5377 if ( (GET_ELDL() < 0x80) || (GET_ELDL() >= 0x80 + BX_MAX_ATA_DEVICES + BX_MAX_SCSI_DEVICES) ) { 5378 BX_INFO("int13_harddisk: function %02x, ELDL out of range %02x\n", GET_AH(), GET_ELDL()); 5379 goto int13_fail; 5380 } 5381 #else 5373 5382 // basic check : device has to be defined 5374 5383 if ( (GET_ELDL() < 0x80) || (GET_ELDL() >= 0x80 + BX_MAX_ATA_DEVICES) ) { … … 5376 5385 goto int13_fail; 5377 5386 } 5387 #endif 5378 5388 5379 5389 // Get the ata channel 5380 5390 device=read_byte(ebda_seg,&EbdaData->ata.hdidmap[GET_ELDL()-0x80]); 5381 5391 5392 #ifdef VBOX_WITH_SCSI 5393 // basic check : device has to be valid 5394 if (device >= BX_MAX_ATA_DEVICES + BX_MAX_SCSI_DEVICES) { 5395 BX_INFO("int13_harddisk: function %02x, unmapped device for ELDL=%02x\n", GET_AH(), GET_ELDL()); 5396 goto int13_fail; 5397 } 5398 #else 5382 5399 // basic check : device has to be valid 5383 5400 if (device >= BX_MAX_ATA_DEVICES) { … … 5385 5402 goto int13_fail; 5386 5403 } 5404 #endif 5387 5405 5388 5406 switch (GET_AH()) { 5389 5407 5390 5408 case 0x00: /* disk controller reset */ 5391 ata_reset (device); 5409 #ifdef VBOX_WITH_SCSI 5410 /* SCSI controller does not need a reset. */ 5411 if (!VBOX_IS_SCSI_DEVICE(device)) 5412 #endif 5413 ata_reset (device); 5392 5414 goto int13_success; 5393 5415 break; … … 5420 5442 } 5421 5443 5422 nlc = read_word(ebda_seg, &EbdaData->ata.devices[device].lchs.cylinders); 5423 nlh = read_word(ebda_seg, &EbdaData->ata.devices[device].lchs.heads); 5424 nlspt = read_word(ebda_seg, &EbdaData->ata.devices[device].lchs.spt); 5444 #ifdef VBOX_WITH_SCSI 5445 if (!VBOX_IS_SCSI_DEVICE(device)) 5446 #endif 5447 { 5448 nlc = read_word(ebda_seg, &EbdaData->ata.devices[device].lchs.cylinders); 5449 nlh = read_word(ebda_seg, &EbdaData->ata.devices[device].lchs.heads); 5450 nlspt = read_word(ebda_seg, &EbdaData->ata.devices[device].lchs.spt); 5451 } 5452 #ifdef VBOX_WITH_SCSI 5453 else 5454 { 5455 Bit8u scsi_device = VBOX_GET_SCSI_DEVICE(device); 5456 5457 nlc = read_word(ebda_seg, &EbdaData->scsi.devices[scsi_device].device_info.lchs.cylinders); 5458 nlh = read_word(ebda_seg, &EbdaData->scsi.devices[scsi_device].device_info.lchs.heads); 5459 nlspt = read_word(ebda_seg, &EbdaData->scsi.devices[scsi_device].device_info.lchs.spt); 5460 } 5461 #endif 5425 5462 5426 5463 // sanity check on cyl heads, sec … … 5433 5470 if ( GET_AH() == 0x04 ) goto int13_success; 5434 5471 5435 nph = read_word(ebda_seg, &EbdaData->ata.devices[device].pchs.heads); 5436 npspt = read_word(ebda_seg, &EbdaData->ata.devices[device].pchs.spt); 5472 #ifdef VBOX_WITH_SCSI 5473 if (!VBOX_IS_SCSI_DEVICE(device)) 5474 #endif 5475 { 5476 nph = read_word(ebda_seg, &EbdaData->ata.devices[device].pchs.heads); 5477 npspt = read_word(ebda_seg, &EbdaData->ata.devices[device].pchs.spt); 5478 } 5479 #ifdef VBOX_WITH_SCSI 5480 else 5481 { 5482 Bit8u scsi_device = VBOX_GET_SCSI_DEVICE(device); 5483 nph = read_word(ebda_seg, &EbdaData->scsi.devices[scsi_device].device_info.pchs.heads); 5484 npspt = read_word(ebda_seg, &EbdaData->scsi.devices[scsi_device].device_info.pchs.spt); 5485 } 5486 #endif 5437 5487 5438 5488 // if needed, translate lchs to lba, and execute command 5439 if ( (nph != nlh) || (npspt != nlspt)) { 5489 #ifdef VBOX_WITH_SCSI 5490 if (( (nph != nlh) || (npspt != nlspt)) || VBOX_IS_SCSI_DEVICE(device)) { 5440 5491 lba = ((((Bit32u)cylinder * (Bit32u)nlh) + (Bit32u)head) * (Bit32u)nlspt) + (Bit32u)sector - 1; 5441 5492 sector = 0; // this forces the command to be lba 5442 5493 } 5494 #else 5495 if (( (nph != nlh) || (npspt != nlspt)) ) { 5496 lba = ((((Bit32u)cylinder * (Bit32u)nlh) + (Bit32u)head) * (Bit32u)nlspt) + (Bit32u)sector - 1; 5497 sector = 0; // this forces the command to be lba 5498 } 5499 #endif 5443 5500 5444 5501 if ( GET_AH() == 0x02 ) 5445 status=ata_cmd_data_in(device, ATA_CMD_READ_SECTORS, count, cylinder, head, sector, lba, segment, offset); 5502 { 5503 #ifdef VBOX_WITH_SCSI 5504 if (VBOX_IS_SCSI_DEVICE(device)) 5505 status=scsi_read_sectors(VBOX_GET_SCSI_DEVICE(device), count, lba, segment, offset); 5506 else 5507 #endif 5508 status=ata_cmd_data_in(device, ATA_CMD_READ_SECTORS, count, cylinder, head, sector, lba, segment, offset); 5509 } 5446 5510 else 5447 status=ata_cmd_data_out(device, ATA_CMD_WRITE_SECTORS, count, cylinder, head, sector, lba, segment, offset); 5511 { 5512 #ifdef VBOX_WITH_SCSI 5513 if (VBOX_IS_SCSI_DEVICE(device)) 5514 BX_PANIC("Write to scsi devices not supported\n"); 5515 else 5516 #endif 5517 status=ata_cmd_data_out(device, ATA_CMD_WRITE_SECTORS, count, cylinder, head, sector, lba, segment, offset); 5518 } 5448 5519 5449 5520 // Set nb of sector transferred … … 5551 5622 // Get 32 bits lba and check 5552 5623 lba=read_dword(DS, SI+(Bit16u)&Int13Ext->lba1); 5553 if (lba >= read_dword(ebda_seg, &EbdaData->ata.devices[device].sectors) ) { 5554 BX_INFO("int13_harddisk: function %02x. LBA out of range\n",GET_AH()); 5555 goto int13_fail; 5556 } 5624 5625 #ifdef VBOX_WITH_SCSI 5626 if (VBOX_IS_SCSI_DEVICE(device)) 5627 { 5628 if (lba >= read_dword(ebda_seg, &EbdaData->scsi.devices[VBOX_GET_SCSI_DEVICE(device)].device_info.sectors) ) { 5629 BX_INFO("int13_harddisk: function %02x. LBA out of range\n",GET_AH()); 5630 goto int13_fail; 5631 } 5632 } 5633 else 5634 #endif 5635 if (lba >= read_dword(ebda_seg, &EbdaData->ata.devices[device].sectors) ) { 5636 BX_INFO("int13_harddisk: function %02x. LBA out of range\n",GET_AH()); 5637 goto int13_fail; 5638 } 5639 5557 5640 5558 5641 // If verify or seek … … 5564 5647 #ifdef VBOX 5565 5648 { 5566 if (count >= 256 || lba + count >= 268435456) 5567 status=ata_cmd_data_in(device, ATA_CMD_READ_SECTORS_EXT, count, 0, 0, 0, lba, segment, offset); 5649 #ifdef VBOX_WITH_SCSI 5650 if (VBOX_IS_SCSI_DEVICE(device)) 5651 status=scsi_read_sectors(VBOX_GET_SCSI_DEVICE(device), count, lba, segment, offset); 5568 5652 else 5569 status=ata_cmd_data_in(device, ATA_CMD_READ_SECTORS, count, 0, 0, 0, lba, segment, offset); 5653 #endif 5654 { 5655 if (count >= 256 || lba + count >= 268435456) 5656 status=ata_cmd_data_in(device, ATA_CMD_READ_SECTORS_EXT, count, 0, 0, 0, lba, segment, offset); 5657 else 5658 status=ata_cmd_data_in(device, ATA_CMD_READ_SECTORS, count, 0, 0, 0, lba, segment, offset); 5659 } 5570 5660 } 5571 5661 #else /* !VBOX */ … … 5575 5665 #ifdef VBOX 5576 5666 { 5577 if (count >= 256 || lba + count >= 268435456) 5578 status=ata_cmd_data_out(device, ATA_CMD_WRITE_SECTORS_EXT, count, 0, 0, 0, lba, segment, offset); 5667 #ifdef VBOX_WITH_SCSI 5668 if (VBOX_IS_SCSI_DEVICE(device)) 5669 BX_PANIC("Writes not supported for SCSI devices\n"); 5579 5670 else 5580 status=ata_cmd_data_out(device, ATA_CMD_WRITE_SECTORS, count, 0, 0, 0, lba, segment, offset); 5671 #endif 5672 { 5673 if (count >= 256 || lba + count >= 268435456) 5674 status=ata_cmd_data_out(device, ATA_CMD_WRITE_SECTORS_EXT, count, 0, 0, 0, lba, segment, offset); 5675 else 5676 status=ata_cmd_data_out(device, ATA_CMD_WRITE_SECTORS, count, 0, 0, 0, lba, segment, offset); 5677 } 5581 5678 } 5582 5679 #else /* !VBOX */ … … 8204 8301 bootlan=0; 8205 8302 #endif /* VBOX */ 8303 8206 8304 switch(bootseq & 0x0f) { 8207 8305 case 0x01: … … 11078 11176 #endif 11079 11177 11080 #if defined(VBOX) && (defined(VBOX_WITH_BUSLOGIC) || defined(VBX_WITH_LSILOGIC))11178 #ifdef VBOX_WITH_SCSI 11081 11179 ;; 11082 11180 ;; SCSI driver setup
Note:
See TracChangeset
for help on using the changeset viewer.