VirtualBox

Ignore:
Timestamp:
Oct 1, 2012 10:13:16 AM (12 years ago)
Author:
vboxsync
Message:

BIOS: Build default logical geometry if none was provided in CMOS.

File:
1 edited

Legend:

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

    r43438 r43483  
    608608}
    609609
    610 static void ahci_port_detect_device(ahci_t __far *ahci, uint8_t u8Port)
     610void ahci_port_detect_device(ahci_t __far *ahci, uint8_t u8Port)
    611611{
    612612    uint32_t            val;
     
    651651                uint32_t    sectors;
    652652                uint16_t    cylinders, heads, spt;
    653                 uint16_t    lcylinders, lheads, lspt;
     653                chs_t       lgeo;
    654654                uint8_t     idxCmosChsBase;
    655655
     
    711711                if (idxCmosChsBase && inb_cmos(idxCmosChsBase+7))
    712712                {
    713                     lcylinders = inb_cmos(idxCmosChsBase + 0) + (inb_cmos(idxCmosChsBase + 1) << 8);
    714                     lheads     = inb_cmos(idxCmosChsBase + 2);
    715                     lspt       = inb_cmos(idxCmosChsBase + 7);
     713                    lgeo.cylinders = inb_cmos(idxCmosChsBase + 0) + (inb_cmos(idxCmosChsBase + 1) << 8);
     714                    lgeo.heads     = inb_cmos(idxCmosChsBase + 2);
     715                    lgeo.spt       = inb_cmos(idxCmosChsBase + 7);
    716716                }
    717717                else
    718                 {
    719                     //@todo: What should we really do if logical geometry isn't in the CMOS?
    720                     lcylinders = cylinders;
    721                     lheads     = heads;
    722                     lspt       = spt;
    723                 }
     718                    set_geom_lba(&lgeo, sectors);   /* Default EDD-style translated LBA geometry. */
     719
    724720                BX_INFO("AHCI %d-P#%d: PCHS=%u/%d/%d LCHS=%u/%u/%u %ld sectors\n", devcount_ahci,
    725                         u8Port, cylinders, heads, spt, lcylinders, lheads, lspt, sectors);
    726 
    727                 bios_dsk->devices[hd_index].lchs.heads     = lheads;
    728                 bios_dsk->devices[hd_index].lchs.cylinders = lcylinders;
    729                 bios_dsk->devices[hd_index].lchs.spt       = lspt;
     721                        u8Port, cylinders, heads, spt, lgeo.cylinders, lgeo.heads, lgeo.spt, sectors);
     722
     723                bios_dsk->devices[hd_index].lchs = lgeo;
    730724
    731725                /* Store the ID of the disk in the BIOS hdidmap. */
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