VirtualBox

Changeset 18324 in vbox for trunk/src


Ignore:
Timestamp:
Mar 26, 2009 4:01:52 PM (16 years ago)
Author:
vboxsync
Message:

BIOS: Make it possible to select SCSI disks on the boot screen

Location:
trunk/src/VBox/Devices/PC/BIOS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/BIOS/logo.c

    r16537 r18324  
    258258{
    259259    Bit16u ebda_seg=read_word(0x0040,0x000E);
    260     Bit8u actual_device = 0;
    261     Bit8u first_ctrl_printed = 0;
    262     Bit8u second_ctrl_printed = 0;
     260    Bit8u hd_count;
     261    Bit8u hd_curr = 0;
     262    Bit8u ide_ctrl_printed = 0;
     263    Bit8u sata_ctrl_printed = 0;
     264    Bit8u scsi_ctrl_printed = 0;
    263265    Bit8u device;
    264266
    265     device = read_byte(ebda_seg, &EbdaData->ata.hdidmap[actual_device]);
    266 
    267     while ((actual_device < BX_MAX_ATA_DEVICES) && (device < BX_MAX_ATA_DEVICES))
    268     {
    269         Bit8u device_position;
    270 
    271         device_position = device;
    272 
    273         if ((device_position < 4) && (first_ctrl_printed == 0))
    274         {
    275             printf("IDE controller:\n");
    276             first_ctrl_printed = 1;
    277         }
    278         else if ((device_position >= 4) && (second_ctrl_printed == 0))
    279         {
    280             printf("\n\nAHCI controller:\n");
    281             second_ctrl_printed = 1;
    282         }
    283 
    284         printf("\n    %d) ", actual_device+1);
    285 
    286         /*
    287          * If actual_device is bigger than or equal 4
    288          * this is the next controller and
    289          * the positions start at the beginning.
    290          */
    291         if (device_position >= 4)
    292             device_position -= 4;
    293 
    294         if (device_position / 2)
    295             printf("Secondary ");
     267    hd_count = read_byte(ebda_seg, &EbdaData->ata.hdcount);
     268
     269    for (hd_curr = 0; hd_curr < hd_count; hd_curr++)
     270    {
     271        device = read_byte(ebda_seg, &EbdaData->ata.hdidmap[hd_curr]);
     272
     273        if (!VBOX_IS_SCSI_DEVICE(device))
     274        {
     275
     276            if ((device < 4) && (ide_ctrl_printed == 0))
     277            {
     278                printf("IDE controller:\n");
     279                ide_ctrl_printed = 1;
     280            }
     281            else if ((device >= 4) && (sata_ctrl_printed == 0))
     282            {
     283                printf("\n\nAHCI controller:\n");
     284                sata_ctrl_printed = 1;
     285            }
     286
     287            printf("\n    %d) ", hd_curr+1);
     288
     289            /*
     290             * If actual_device is bigger than or equal 4
     291             * this is the next controller and
     292             * the positions start at the beginning.
     293             */
     294            if (device >= 4)
     295                device -= 4;
     296
     297            if (device / 2)
     298                printf("Secondary ");
     299            else
     300                printf("Primary ");
     301
     302            if (device % 2)
     303                printf("Slave");
     304            else
     305                printf("Master");
     306        }
    296307        else
    297             printf("Primary ");
    298 
    299         if (device_position % 2)
    300             printf("Slave");
    301         else
    302             printf("Master");
    303 
    304         actual_device++;
    305         device = read_byte(ebda_seg, &EbdaData->ata.hdidmap[actual_device]);
     308        {
     309            if (scsi_ctrl_printed == 0)
     310            {
     311                printf("\n\nSCSI controller:\n");
     312                scsi_ctrl_printed = 1;
     313            }
     314
     315            printf("\n    %d) Hard disk", hd_curr+1);
     316
     317        }
    306318    }
    307319
    308     if ((first_ctrl_printed == 0) && (second_ctrl_printed == 0))
     320    if (   (ide_ctrl_printed == 0)
     321        && (sata_ctrl_printed == 0)
     322        && (scsi_ctrl_printed == 0))
    309323        printf("No hard disks found");
    310324
     
    316330{
    317331    Bit16u ebda_seg=read_word(0x0040,0x000E);
    318     Bit8u actual_device;
    319     Bit8u detected_devices = 0;
    320 
    321     for (actual_device = 0; actual_device < BX_MAX_ATA_DEVICES; actual_device++)
    322     {
    323         Bit8u device = read_byte(ebda_seg, &EbdaData->ata.hdidmap[actual_device]);
    324 
    325         if (device < BX_MAX_ATA_DEVICES)
    326         {
    327             scode--;
    328             if (scode == 0x01)
    329                 return actual_device;
    330         }
    331     }
     332
     333    /* Check that the scan code is in the range of detected hard disks. */
     334    Bit8u hd_count = read_byte(ebda_seg, &EbdaData->ata.hdcount);
     335
     336    /* The key '1' has scancode 0x02 which represents the first disk */
     337    scode -= 2;
     338
     339    if (scode < hd_count)
     340        return scode;
    332341
    333342    /* Scancode is higher than number of available devices */
    334     return 0x08;
     343    return 0xff;
    335344}
    336345
     
    472481
    473482                    /*
    474                      * We support a maximum of 8 boot drives.
    475                      * If this value is bigger than 7 not all
    476                      * values are used and the user pressed
    477                      * and invalid key.
    478                      * Wait for the next pressed key.
     483                     * 0xff indicates that there is no mapping
     484                     * from the scan code to a hard drive.
     485                     * Wait for next keystroke.
    479486                     */
    480                     if (boot_drive > 7)
     487                    if (boot_drive == 0xff)
    481488                        continue;
    482489
  • trunk/src/VBox/Devices/PC/BIOS/rombios.c

    r18265 r18324  
    220220
    221221#ifdef VBOX_WITH_SCSI
    222 #    define BX_MAX_SCSI_DEVICES 2
     222/* Enough for now */
     223#    define BX_MAX_SCSI_DEVICES 4
     224
     225/* A SCSI device starts always at BX_MAX_ATA_DEVICES. */
     226#    define VBOX_IS_SCSI_DEVICE(device_id) (device_id >= BX_MAX_ATA_DEVICES)
     227#    define VBOX_GET_SCSI_DEVICE(device_id) (device_id - BX_MAX_ATA_DEVICES)
    223228#endif
    224229
Note: See TracChangeset for help on using the changeset viewer.

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