VirtualBox

儲存庫 vbox 的更動 12560


忽略:
時間撮記:
2008-9-18 上午11:29:49 (16 年 以前)
作者:
vboxsync
訊息:

Update BIOS scsi driver

位置:
trunk/src/VBox/Devices/PC/BIOS
檔案:
修改 2 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Devices/PC/BIOS/Makefile.kmk

    r12269 r12560  
    6767
    6868# 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 \
    7070                $(PATH_SUB_CURRENT)/../DevPcBios.h $(PATH_ROOT)/include/VBox/bioslogo.h | $$(dir $$@)
    7171        $(call MSG_TOOL,cpp,PcBiosBin,$<,$@)
  • trunk/src/VBox/Devices/PC/BIOS/rombios.c

    r12494 r12560  
    219219#endif
    220220
    221 #if defined(VBOX) && (defined(VBOX_WITH_BUSLOGIC) || defined(VBOX_WITH_LSILOGIC))
    222 #    define BX_MAX_SCSI_DEVICES 16
     221#ifdef VBOX_WITH_SCSI
     222#    define BX_MAX_SCSI_DEVICES 1
    223223#endif
    224224
     
    720720    ata_device_t  devices[BX_MAX_ATA_DEVICES];
    721721    //
    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
    723726    Bit8u  hdcount, hdidmap[BX_MAX_ATA_DEVICES];
     727#endif
    724728
    725729    // map between (bios cd id - 0xE0) and ata channels
     
    753757#endif // BX_ELTORITO_BOOT
    754758
    755 #ifdef VBOX
    756 # if defined(VBOX_WITH_BUSLOGIC) || defined(VBOX_WITH_LSILOGIC)
     759#ifdef VBOX_WITH_SCSI
    757760  typedef struct {
    758761    // I/O port this device is attached to.
     
    767770    // SCSi device info
    768771    scsi_device_t   devices[BX_MAX_SCSI_DEVICES];
    769     // map between (bios hd id - 0x80) and scsi devices
    770     Bit8u  hdcount, hdidmap[BX_MAX_SCSI_DEVICES];
     772    // Number of scsi disks.
     773    Bit8u  hdcount;
    771774    } scsi_t;
    772 # endif
    773775#endif
    774776
     
    793795    cdemu_t cdemu;
    794796#endif // BX_ELTORITO_BOOT
     797
    795798#ifdef VBOX
    796 # if defined(VBOX_WITH_BUSLOGIC) || defined(VBOX_WITH_LSILOGIC)
     799
     800#ifdef VBOX_WITH_SCSI
    797801    // SCSI Driver data
    798     //scsi_t scsi;
     802    scsi_t scsi;
    799803# endif
    800804
     
    21392143}
    21402144
    2141 #if VBOX
    2142 # if VBOX_WITH_BUSLOGIC || VBOX_WITH_LSILOGIC
    2143 #  include "scsi.c"
    2144 # endif
    2145 #endif
    2146 
    21472145#if BX_USE_ATADRV
    21482146
     
    37773775// ---------------------------------------------------------------------------
    37783776#endif // BX_ELTORITO_BOOT
     3777
     3778#ifdef VBOX_WITH_SCSI
     3779#  include "scsi.c"
     3780#endif
    37793781
    37803782  void
     
    53715373  write_byte(0x0040, 0x008e, 0);  // clear completion flag
    53725374
     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
    53735382  // basic check : device has to be defined
    53745383  if ( (GET_ELDL() < 0x80) || (GET_ELDL() >= 0x80 + BX_MAX_ATA_DEVICES) ) {
     
    53765385    goto int13_fail;
    53775386    }
     5387#endif
    53785388
    53795389  // Get the ata channel
    53805390  device=read_byte(ebda_seg,&EbdaData->ata.hdidmap[GET_ELDL()-0x80]);
    53815391
     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
    53825399  // basic check : device has to be valid
    53835400  if (device >= BX_MAX_ATA_DEVICES) {
     
    53855402    goto int13_fail;
    53865403    }
     5404#endif
    53875405
    53885406  switch (GET_AH()) {
    53895407
    53905408    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);
    53925414      goto int13_success;
    53935415      break;
     
    54205442        }
    54215443
    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
    54255462
    54265463      // sanity check on cyl heads, sec
     
    54335470      if ( GET_AH() == 0x04 ) goto int13_success;
    54345471
    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
    54375487
    54385488      // 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)) {
    54405491        lba = ((((Bit32u)cylinder * (Bit32u)nlh) + (Bit32u)head) * (Bit32u)nlspt) + (Bit32u)sector - 1;
    54415492        sector = 0; // this forces the command to be lba
    54425493        }
     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
    54435500
    54445501      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      }
    54465510      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      }
    54485519
    54495520      // Set nb of sector transferred
     
    55515622      // Get 32 bits lba and check
    55525623      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
    55575640
    55585641      // If verify or seek
     
    55645647#ifdef VBOX
    55655648      {
    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);
    55685652        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        }
    55705660      }
    55715661#else /* !VBOX */
     
    55755665#ifdef VBOX
    55765666      {
    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");
    55795670        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        }
    55815678      }
    55825679#else /* !VBOX */
     
    82048301  bootlan=0;
    82058302#endif /* VBOX */
     8303
    82068304  switch(bootseq & 0x0f) {
    82078305    case 0x01:
     
    1107811176#endif
    1107911177
    11080 #if defined(VBOX) && (defined(VBOX_WITH_BUSLOGIC) || defined(VBX_WITH_LSILOGIC))
     11178#ifdef VBOX_WITH_SCSI
    1108111179  ;;
    1108211180  ;; SCSI driver setup
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette