Changeset 58466 in vbox for trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Bus/Pci/IdeBusPei/AtapiPeim.c
- Timestamp:
- Oct 29, 2015 4:30:44 AM (9 years ago)
- Location:
- trunk/src/VBox/Devices/EFI/Firmware
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware
- Property svn:mergeinfo changed
/vendor/edk2/current merged: 103769-103776
- Property svn:mergeinfo changed
-
trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Bus/Pci/IdeBusPei/AtapiPeim.c
r58459 r58466 20 20 21 21 /** 22 Initializes the Atapi Block Io PPI. 23 22 Initializes the Atapi Block Io PPI. 23 24 24 @param[in] FileHandle Handle of the file being invoked. 25 25 @param[in] PeiServices Describes the list of possible PEI Services. … … 88 88 Gets the count of block I/O devices that one specific block driver detects. 89 89 90 This function is used for getting the count of block I/O devices that one 90 This function is used for getting the count of block I/O devices that one 91 91 specific block driver detects. To the PEI ATAPI driver, it returns the number 92 of all the detected ATAPI devices it detects during the enumeration process. 93 To the PEI legacy floppy driver, it returns the number of all the legacy 94 devices it finds during its enumeration process. If no device is detected, 95 then the function will return zero. 96 97 @param[in] PeiServices General-purpose services that are available 92 of all the detected ATAPI devices it detects during the enumeration process. 93 To the PEI legacy floppy driver, it returns the number of all the legacy 94 devices it finds during its enumeration process. If no device is detected, 95 then the function will return zero. 96 97 @param[in] PeiServices General-purpose services that are available 98 98 to every PEIM. 99 @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI 99 @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI 100 100 instance. 101 101 @param[out] NumberBlockDevices The number of block I/O devices discovered. … … 126 126 Gets a block device's media information. 127 127 128 This function will provide the caller with the specified block device's media 129 information. If the media changes, calling this function will update the media 128 This function will provide the caller with the specified block device's media 129 information. If the media changes, calling this function will update the media 130 130 information accordingly. 131 131 … … 133 133 PEIM 134 134 @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance. 135 @param[in] DeviceIndex Specifies the block device to which the function wants 136 to talk. Because the driver that implements Block I/O 137 PPIs will manage multiple block devices, the PPIs that 138 want to talk to a single device must specify the 135 @param[in] DeviceIndex Specifies the block device to which the function wants 136 to talk. Because the driver that implements Block I/O 137 PPIs will manage multiple block devices, the PPIs that 138 want to talk to a single device must specify the 139 139 device index that was assigned during the enumeration 140 process. This index is a number from one to 140 process. This index is a number from one to 141 141 NumberBlockDevices. 142 @param[out] MediaInfo The media information of the specified block media. 143 The caller is responsible for the ownership of this 142 @param[out] MediaInfo The media information of the specified block media. 143 The caller is responsible for the ownership of this 144 144 data structure. 145 146 @retval EFI_SUCCESS Media information about the specified block device 145 146 @retval EFI_SUCCESS Media information about the specified block device 147 147 was obtained successfully. 148 @retval EFI_DEVICE_ERROR Cannot get the media information due to a hardware 148 @retval EFI_DEVICE_ERROR Cannot get the media information due to a hardware 149 149 error. 150 150 @retval Others Other failure occurs. … … 187 187 // probe media and retrieve latest media information 188 188 // 189 DEBUG ((EFI_D_INFO, "Atatpi GetInfo DevicePosition is %d\n", AtapiBlkIoDev->DeviceInfo[Index].DevicePosition)); 189 DEBUG ((EFI_D_INFO, "Atatpi GetInfo DevicePosition is %d\n", AtapiBlkIoDev->DeviceInfo[Index].DevicePosition)); 190 190 DEBUG ((EFI_D_INFO, "Atatpi GetInfo DeviceType is %d\n", AtapiBlkIoDev->DeviceInfo[Index].MediaInfo.DeviceType)); 191 191 DEBUG ((EFI_D_INFO, "Atatpi GetInfo MediaPresent is %d\n", AtapiBlkIoDev->DeviceInfo[Index].MediaInfo.MediaPresent)); … … 207 207 DEBUG ((EFI_D_INFO, "Atatpi GetInfo BlockSize is 0x%x\n", AtapiBlkIoDev->DeviceInfo[Index].MediaInfo.BlockSize)); 208 208 DEBUG ((EFI_D_INFO, "Atatpi GetInfo LastBlock is 0x%x\n", AtapiBlkIoDev->DeviceInfo[Index].MediaInfo.LastBlock)); 209 209 210 210 // 211 211 // Get media info from AtapiBlkIoDev … … 219 219 Reads the requested number of blocks from the specified block device. 220 220 221 The function reads the requested number of blocks from the device. All the 221 The function reads the requested number of blocks from the device. All the 222 222 blocks are read, or an error is returned. If there is no media in the device, 223 223 the function returns EFI_NO_MEDIA. 224 224 225 @param[in] PeiServices General-purpose services that are available to 225 @param[in] PeiServices General-purpose services that are available to 226 226 every PEIM. 227 227 @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance. 228 @param[in] DeviceIndex Specifies the block device to which the function wants 229 to talk. Because the driver that implements Block I/O 230 PPIs will manage multiple block devices, the PPIs that 231 want to talk to a single device must specify the device 232 index that was assigned during the enumeration process. 228 @param[in] DeviceIndex Specifies the block device to which the function wants 229 to talk. Because the driver that implements Block I/O 230 PPIs will manage multiple block devices, the PPIs that 231 want to talk to a single device must specify the device 232 index that was assigned during the enumeration process. 233 233 This index is a number from one to NumberBlockDevices. 234 234 @param[in] StartLBA The starting logical block address (LBA) to read from … … 237 237 a multiple of the intrinsic block size of the device. 238 238 @param[out] Buffer A pointer to the destination buffer for the data. 239 The caller is responsible for the ownership of the 239 The caller is responsible for the ownership of the 240 240 buffer. 241 241 242 242 @retval EFI_SUCCESS The data was read correctly from the device. 243 @retval EFI_DEVICE_ERROR The device reported an error while attempting 243 @retval EFI_DEVICE_ERROR The device reported an error while attempting 244 244 to perform the read operation. 245 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not 245 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not 246 246 valid, or the buffer is not properly aligned. 247 247 @retval EFI_NO_MEDIA There is no media in the device. … … 366 366 367 367 // 368 // Allow SATA Devices to spin-up. This is needed if 368 // Allow SATA Devices to spin-up. This is needed if 369 369 // SEC and PEI phase is too short, for example Release Build. 370 370 // … … 384 384 // Using Command and Control Regs Base Address to fill other registers. 385 385 // 386 for (Index1 = 0; Index1 < IdeEnabledNumber; Index1 ++) { 386 for (Index1 = 0; Index1 < IdeEnabledNumber; Index1 ++) { 387 387 CommandBlockBaseAddr = IdeRegsBaseAddr[Index1].CommandBlockBaseAddr; 388 388 AtapiBlkIoDev->IdeIoPortReg[Index1].Data = CommandBlockBaseAddr; … … 398 398 AtapiBlkIoDev->IdeIoPortReg[Index1].Alt.DeviceControl = ControlBlockBaseAddr; 399 399 AtapiBlkIoDev->IdeIoPortReg[Index1].DriveAddress = (UINT16) (ControlBlockBaseAddr + 0x1); 400 400 401 401 // 402 402 // Scan IDE bus for ATAPI devices IDE or Sata device … … 418 418 Status = DetectMedia (AtapiBlkIoDev, DevicePosition, &MediaInfo); 419 419 CopyMem (&(AtapiBlkIoDev->DeviceInfo[DeviceCount].MediaInfo), &MediaInfo, sizeof (MediaInfo)); 420 420 421 421 DEBUG ((EFI_D_INFO, "Atatpi Device Position is %d\n", DevicePosition)); 422 422 DEBUG ((EFI_D_INFO, "Atatpi DeviceType is %d\n", MediaInfo.DeviceType)); … … 438 438 /** 439 439 Detect Atapi devices. 440 440 441 441 @param[in] AtapiBlkIoDev A pointer to atapi block IO device. 442 442 @param[in] DevicePosition An integer to signify device position. … … 475 475 /** 476 476 Check power mode of Atapi devices. 477 477 478 478 @param[in] AtapiBlkIoDev A pointer to atapi block IO device. 479 479 @param[in] DevicePosition An integer to signify device position. … … 608 608 /** 609 609 Detect if an IDE controller exists in specified position. 610 610 611 611 @param[in] AtapiBlkIoDev A pointer to atapi block IO device. 612 612 @param[in] DevicePosition An integer to signify device position. … … 650 650 /** 651 651 Wait specified time interval to poll for BSY bit clear in the Status Register. 652 652 653 653 @param[in] AtapiBlkIoDev A pointer to atapi block IO device. 654 654 @param[in] IdeIoRegisters A pointer to IDE IO registers. … … 695 695 /** 696 696 Wait specified time interval to poll for DRDY bit set in the Status register. 697 697 698 698 @param[in] AtapiBlkIoDev A pointer to atapi block IO device. 699 699 @param[in] IdeIoRegisters A pointer to IDE IO registers. … … 736 736 } 737 737 } 738 738 739 739 MicroSecondDelay (250); 740 740 … … 752 752 /** 753 753 Wait specified time interval to poll for DRQ bit clear in the Status Register. 754 754 755 755 @param[in] AtapiBlkIoDev A pointer to atapi block IO device. 756 756 @param[in] IdeIoRegisters A pointer to IDE IO registers. … … 795 795 } 796 796 } 797 797 798 798 MicroSecondDelay (250); 799 799 … … 810 810 /** 811 811 Wait specified time interval to poll for DRQ bit clear in the Alternate Status Register. 812 812 813 813 @param[in] AtapiBlkIoDev A pointer to atapi block IO device. 814 814 @param[in] IdeIoRegisters A pointer to IDE IO registers. … … 853 853 } 854 854 } 855 855 856 856 MicroSecondDelay (250); 857 857 … … 1214 1214 /** 1215 1215 Send out ATAPI commands conforms to the Packet Command with PIO Data In Protocol. 1216 1216 1217 1217 @param[in] AtapiBlkIoDev A pointer to atapi block IO device. 1218 1218 @param[in] DevicePosition An integer to signify device position. … … 1496 1496 } 1497 1497 1498 /** 1499 Used before read/write blocks from/to ATAPI device media. 1498 /** 1499 Used before read/write blocks from/to ATAPI device media. 1500 1500 Since ATAPI device media is removable, it is necessary to detect 1501 1501 whether media is present and get current present media's information. … … 1531 1531 return EFI_OUT_OF_RESOURCES; 1532 1532 } 1533 1533 1534 1534 // 1535 1535 // Test Unit Ready command is used to detect whether device is accessible, … … 1666 1666 } 1667 1667 1668 /** 1668 /** 1669 1669 Reset specified Atapi device. 1670 1670 … … 1764 1764 } 1765 1765 1766 /** 1766 /** 1767 1767 Sends out ATAPI Request Sense Packet Command to the specified device. 1768 1768 … … 1860 1860 } 1861 1861 1862 /** 1862 /** 1863 1863 Sends out ATAPI Read Capacity Packet Command to the specified device. 1864 1864 This command will return the information regarding the capacity of the … … 1961 1961 } 1962 1962 1963 /** 1963 /** 1964 1964 Perform read from disk in block unit. 1965 1965 … … 2064 2064 } 2065 2065 2066 /** 2066 /** 2067 2067 Check if there is media according to sense data. 2068 2068 … … 2100 2100 } 2101 2101 2102 /** 2102 /** 2103 2103 Check if device state is unclear according to sense data. 2104 2104 … … 2107 2107 2108 2108 @retval TRUE Device state is unclear 2109 @retval FALSE Device state is clear 2109 @retval FALSE Device state is clear 2110 2110 2111 2111 **/ … … 2141 2141 } 2142 2142 2143 /** 2143 /** 2144 2144 Check if there is media error according to sense data. 2145 2145 … … 2214 2214 } 2215 2215 2216 /** 2216 /** 2217 2217 Check if drive is ready according to sense data. 2218 2218
Note:
See TracChangeset
for help on using the changeset viewer.