ReturnInfinity / BareMetal-OS-legacy

BareMetal is a 64-bit OS for x86-64 based computers. The OS is written entirely in Assembly while applications can be written in Assembly, C/C++, and Rust.
1.75k stars 302 forks source link

os/drivers/storage/ahci.asm #70

Closed erfzsven closed 10 years ago

erfzsven commented 10 years ago

the founddriver function loads ahci_cmdlist into P0CLB(Port0 command list base address), and 0x0 into P0CLBU, ahci_cmdlist equal 0x0007_0000, but it is bit31:10 in P0CLB presents the base address, plus the upper 32bits, forms a 54bit address, that will be 0x0000_01C0 instead of 0x0007_0000. so you have the command list placed at 0x0007_0000, why does it work? btw, where did you find these manuals for drivers development? how do you know how to control a device? just from google? or read other OS's code? Thank you.

IanSeyler commented 10 years ago

The total address is still 64-bit. The address has to be 1K aligned so bits 9:0 in PxCLB can only be 0.

I wrote the driver from scratch. Intel hosts the AHCI specifications on their website: http://www.intel.com/content/www/us/en/io/serial-ata/ahci.html