Changeset 68611 in vbox for trunk/src/VBox/Devices/PC
- Timestamp:
- Sep 1, 2017 6:03:23 PM (7 years ago)
- Location:
- trunk/src/VBox/Devices/PC/BIOS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS/ahci.c
r67679 r68611 637 637 } 638 638 639 /* Wait for the specified number of BIOS timer ticks or data bytes. */ 640 void wait_ticks_device_init( unsigned wait_ticks, unsigned wait_bytes ) 641 { 642 } 643 639 644 void ahci_port_detect_device(ahci_t __far *ahci, uint8_t u8Port) 640 645 { 641 uint32_t val; 642 bio_dsk_t __far *bios_dsk; 646 uint32_t val; 647 bio_dsk_t __far *bios_dsk; 648 volatile uint32_t __far *ticks; 649 uint32_t end_tick; 650 int device_found = 0; 643 651 644 652 ahci_port_init(ahci, u8Port); … … 654 662 VBOXAHCI_PORT_WRITE_REG(ahci->iobase, u8Port, AHCI_REG_PORT_SCTL, 0); 655 663 656 /* Check if there is a device on the port. */ 657 VBOXAHCI_PORT_READ_REG(ahci->iobase, u8Port, AHCI_REG_PORT_SSTS, val); 658 if (ahci_ctrl_extract_bits(val, 0xfL, 0) == 0) 659 return; /* No device detected. */ 660 661 do 664 /* 665 * We do however have to wait for the device to initialize (the port reset 666 * to complete). That can take up to 10ms according to the SATA spec (device 667 * must send COMINIT within 10ms of COMRESET). We should be generous with 668 * the wait because in the typical case there are no ports without a device 669 * attached. 670 */ 671 ticks = MK_FP( 0x40, 0x6C ); 672 end_tick = *ticks + 3; /* Wait up to five BIOS ticks, something in 150ms range. */ 673 674 while( *ticks < end_tick ) 662 675 { 676 /* If PxSSTS.DET is 3, everything went fine. */ 663 677 VBOXAHCI_PORT_READ_REG(ahci->iobase, u8Port, AHCI_REG_PORT_SSTS, val); 664 } while (ahci_ctrl_extract_bits(val, 0xfL, 0) == 0x1); 678 if (ahci_ctrl_extract_bits(val, 0xfL, 0) == 3) { 679 device_found = 1; 680 break; 681 } 682 } 683 684 /* Timed out, no device detected. */ 685 if (!device_found) { 686 DBG_AHCI("AHCI: Timed out, no device detected on port %d\n", u8Port); 687 return; 688 } 665 689 666 690 if (ahci_ctrl_extract_bits(val, 0xfL, 0) == 0x3) -
trunk/src/VBox/Devices/PC/BIOS/orgs.asm
r67888 r68611 618 618 ifdef VBOX_WITH_AHCI 619 619 ; AHCI driver setup 620 ;; TODO: AHCI initialization needs timer, but enabling 621 ;; interrupts elsewhere may be risky. Just do it around 622 ;; the AHCI init. 623 sti 620 624 call _ahci_init 625 cli 621 626 endif 622 627
Note:
See TracChangeset
for help on using the changeset viewer.