AHCI Generic driver.
More...
|
| STATIC | ALIGN (kib_cast(4)) UInt8 kIdentifyData[kAHCISectorSize] |
| template<BOOL Write, BOOL CommandOrCTRL, BOOL Identify> |
| STATIC Void | drv_std_input_output_ahci (UInt64 lba, UInt8 *buffer, SizeT sector_sz, SizeT size_buffer) |
| | Send an AHCI command, according to the template parameters.
|
| STATIC Int32 | drv_find_cmd_slot_ahci (HbaPort *port) |
| | Finds a command slot for a HBA port.
|
| STATIC Void | drv_compute_disk_ahci () |
| | Identify device and read LBA info, Disk OEM vendor.
|
| STATIC SizeT | drv_get_size_ahci () |
| STATIC SizeT | drv_get_sector_count_ahci () |
| STATIC | ATTRIBUTE (unused) SizeT drv_get_size_ahci() |
| | Get the drive size.
|
| STATIC BOOL | ahci_enable_and_probe () |
| | Enable Host and probe using the IDENTIFY command.
|
| STATIC Bool | drv_init_command_structures_ahci () |
| STATIC Bool | drv_std_init_ahci (UInt16 &pi, BOOL &atapi) |
| | Initializes an AHCI disk.
|
| Bool | drv_std_detected_ahci () |
| | Checks if an AHCI device is detected.
|
| UInt16 | Kernel::sk_init_ahci_device (BOOL atapi) |
| | Initialize an AHCI device (StorageKit).
|
| STATIC Void | Kernel::Detail::sk_io_read_ahci (DeviceInterface< IMountpoint * > *self, IMountpoint *mnt) |
| | Read AHCI device.
|
| STATIC Void | Kernel::Detail::sk_io_write_ahci (DeviceInterface< IMountpoint * > *self, IMountpoint *mnt) |
| | Write AHCI device.
|
| ErrorOr< AHCIDeviceInterface > | Kernel::sk_acquire_ahci_device (UInt32 drv_index) |
| | Acquires a new AHCI device with drv_index in mind.
|
AHCI Generic driver.
- Author
- Amlal El Mahrouss (amlal.nosp@m.@nek.nosp@m.ernel.nosp@m..org)
- Version
- 0.1
- Date
- 2024-02-02
- Copyright
- (C) 2024-2025, Amlal El Mahrouss, licensed under the Apache 2.0 license.
◆ kSATABar5
◆ kSATABohcBiosOwned
| #define kSATABohcBiosOwned (1 << 0) |
◆ kSATABohcOSOwned
| #define kSATABohcOSOwned (1 << 1) |
◆ kSATAErrTaskFile
| #define kSATAErrTaskFile (1 << 30) |
◆ kSATALBAMode
| #define kSATALBAMode (1 << 6) |
◆ kSATAPISig
| #define kSATAPISig (0xEB140101) |
◆ kSATAPortCnt
| #define kSATAPortCnt (0x20) |
◆ kSATAProgIfAHCI
| #define kSATAProgIfAHCI (0x01) |
◆ kSATAPxCmdCR
| #define kSATAPxCmdCR (0x8000) |
◆ kSATAPxCmdFR
| #define kSATAPxCmdFR (0x4000) |
◆ kSATAPxCmdFre
| #define kSATAPxCmdFre (0x0010) |
◆ kSATAPxCmdST
| #define kSATAPxCmdST (0x0001) |
◆ kSATASig
| #define kSATASig (0x00000101) |
◆ kSATASRBsy
| #define kSATASRBsy (0x80) |
◆ kSATASRDrq
| #define kSATASRDrq (0x08) |
◆ kSATASubClass
| #define kSATASubClass (0x06) |
◆ ahci_enable_and_probe()
Enable Host and probe using the IDENTIFY command.
◆ ALIGN()
◆ ATTRIBUTE()
Get the drive size.
!
- Returns
- Disk size in bytes.
◆ drv_compute_disk_ahci()
Identify device and read LBA info, Disk OEM vendor.
Extract 48-bit LBA.
◆ drv_find_cmd_slot_ahci()
Finds a command slot for a HBA port.
- Parameters
-
| port | The port to search on. |
- Returns
- The slot, or -1.
◆ drv_get_sector_count_ahci()
◆ drv_get_size_ahci()
◆ drv_init_command_structures_ahci()
◆ drv_std_detected_ahci()
| Bool drv_std_detected_ahci |
( |
| ) |
|
Checks if an AHCI device is detected.
- Returns
- Either if detected, or not found.
◆ drv_std_init_ahci()
Initializes an AHCI disk.
- Parameters
-
| pi | the amount of ports that have been detected. |
| atapi | reference value, tells whether we should detect ATAPI instead of SATA. |
- Returns
- if the disk was successfully initialized or not.
AMLALE: TODO: Iterator is good enough, but we need to expand it.
◆ drv_std_input_output_ahci()
Send an AHCI command, according to the template parameters.
- Parameters
-
| lba | Logical Block Address to look for. |
| buffer | The data buffer to transfer. |
| sector_sz | The disk's sector size (unused) |
| size_buffer | The size of the buffer parameter. |
◆ kCurrentDiskModel
| STATIC Char kCurrentDiskModel[50] = {"GENERIC SATA"} |
◆ kSATADev
◆ kSATAHba
◆ kSATAIndex
◆ kSATAPortsImplemented
◆ kSATASectorCount