- Timestamp:
- Aug 23, 2012 12:06:39 PM (12 years ago)
- Location:
- trunk/src/VBox/Devices/PC/BIOS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS/ahci.c
r42842 r42947 645 645 if (val == 0x101) 646 646 { 647 uint32_t cSectors; 648 uint16_t cCylinders, cHeads, cSectorsPerTrack; 647 uint32_t sectors; 648 uint16_t cylinders, heads, spt; 649 uint16_t lcylinders, lheads, lspt; 649 650 uint8_t idxCmosChsBase; 650 651 … … 661 662 hd_index = devcount_ahci + BX_MAX_ATA_DEVICES + BX_MAX_SCSI_DEVICES; 662 663 663 removable 664 c Cylinders = *(uint16_t *)(abBuffer+(1*2));// word 1665 cHeads = *(uint16_t *)(abBuffer+(3*2));// word 3666 cSectorsPerTrack = *(uint16_t *)(abBuffer+(6*2));// word 6667 cSectors = *(uint32_t *)(abBuffer+(60*2));// word 60 and word 61664 removable = *(abBuffer+0) & 0x80 ? 1 : 0; 665 cylinders = *(uint16_t *)(abBuffer+(1*2)); // word 1 666 heads = *(uint16_t *)(abBuffer+(3*2)); // word 3 667 spt = *(uint16_t *)(abBuffer+(6*2)); // word 6 668 sectors = *(uint32_t *)(abBuffer+(60*2)); // word 60 and word 61 668 669 669 670 /** @todo update sectors to be a 64 bit number (also lba...). */ 670 if ( cSectors == 268435455)671 cSectors = *(uint32_t *)(abBuffer+(100*2)); // words 100 to 103 (someday)672 673 DBG_AHCI("AHCI: %ld sectors\n", cSectors);671 if (sectors == 0x0FFFFFFF) /* For disks bigger than ~128GB */ 672 sectors = *(uint32_t *)(abBuffer+(100*2)); // words 100 to 103 (someday) 673 674 DBG_AHCI("AHCI: %ld sectors\n", sectors); 674 675 675 676 bios_dsk->ahcidev[devcount_ahci].port = u8Port; … … 680 681 bios_dsk->devices[hd_index].blksize = 512; 681 682 bios_dsk->devices[hd_index].translation = GEO_TRANSLATION_LBA; 682 bios_dsk->devices[hd_index].sectors = cSectors;683 684 bios_dsk->devices[hd_index].pchs.heads = cHeads;685 bios_dsk->devices[hd_index].pchs.cylinders = c Cylinders;686 bios_dsk->devices[hd_index].pchs.spt = cSectorsPerTrack;683 bios_dsk->devices[hd_index].sectors = sectors; 684 685 bios_dsk->devices[hd_index].pchs.heads = heads; 686 bios_dsk->devices[hd_index].pchs.cylinders = cylinders; 687 bios_dsk->devices[hd_index].pchs.spt = spt; 687 688 688 689 /* Get logical CHS geometry. */ … … 706 707 if (idxCmosChsBase && inb_cmos(idxCmosChsBase+7)) 707 708 { 708 cCylinders = inb_cmos(idxCmosChsBase) + (inb_cmos(idxCmosChsBase+1) << 8);709 cHeads = inb_cmos(idxCmosChsBase+2);710 cSectorsPerTrack = inb_cmos(idxCmosChsBase+7);709 lcylinders = inb_cmos(idxCmosChsBase + 0) + (inb_cmos(idxCmosChsBase + 1) << 8); 710 lheads = inb_cmos(idxCmosChsBase + 2); 711 lspt = inb_cmos(idxCmosChsBase + 7); 711 712 } 712 713 else 713 714 { 714 #if 0 // LCHS equals PCHS? 715 cCylinders = 0; 716 cHeads = 0; 717 cSectorsPerTrack = 0; 718 #endif 715 //@todo: What should we really do if logical geometry isn't in the CMOS? 716 lcylinders = cylinders; 717 lheads = heads; 718 lspt = spt; 719 719 } 720 DBG_AHCI("AHCI: Dev %d LCHS=%d/%d/%d\n",721 devcount_ahci, cCylinders, cHeads, cSectorsPerTrack);722 723 bios_dsk->devices[hd_index].lchs.heads = cHeads;724 bios_dsk->devices[hd_index].lchs.cylinders = cCylinders;725 bios_dsk->devices[hd_index].lchs.spt = cSectorsPerTrack;720 BX_INFO("AHCI %d-P#%d: PCHS=%u/%d/%d LCHS=%u/%u/%u %ld sectors\n", devcount_ahci, 721 u8Port, cylinders, heads, spt, lcylinders, lheads, lspt, sectors); 722 723 bios_dsk->devices[hd_index].lchs.heads = lheads; 724 bios_dsk->devices[hd_index].lchs.cylinders = lcylinders; 725 bios_dsk->devices[hd_index].lchs.spt = lspt; 726 726 727 727 /* Store the ID of the disk in the BIOS hdidmap. */ -
trunk/src/VBox/Devices/PC/BIOS/ata.c
r39651 r42947 485 485 sectors = *(uint32_t *)(buffer+(60*2)); // word 60 and word 61 486 486 /** @todo update sectors to be a 64 bit number (also lba...). */ 487 if (sectors == 268435455)487 if (sectors == 0x0FFFFFFF) /* For disks bigger than ~128GB */ 488 488 sectors = *(uint32_t *)(buffer+(100*2)); // words 100 to 103 (someday) 489 489 switch (device)
Note:
See TracChangeset
for help on using the changeset viewer.