Add ATA drive support #27

Merged
apio merged 28 commits from please-read-my-ata-drive into main 2023-06-16 19:40:11 +00:00
Showing only changes of commit cc8450751c - Show all commits

View File

@ -33,19 +33,32 @@ namespace PCI
void write8(const Device::Address& address, u32 field, u8 value)
{
ignore(address, field, value);
todo();
u8 offset = (u8)(field & ~0x3);
union {
u8 split[4];
u32 full;
};
full = read32(address, offset);
split[(field & 0x3)] = value;
write32(address, offset, full);
}
void write16(const Device::Address& address, u32 field, u8 value)
void write16(const Device::Address& address, u32 field, u16 value)
{
ignore(address, field, value);
todo();
u8 offset = (u8)(field & ~0x3);
union {
u8 split[4];
u32 full;
};
full = read32(address, offset);
split[(field & 0x3)] = (u8)(value >> 8);
split[(field & 0x3) + 1] = (u8)(value & 0xff);
write32(address, offset, full);
}
void write32(const Device::Address& address, u32 field, u8 value)
void write32(const Device::Address& address, u32 field, u32 value)
{
ignore(address, field, value);
todo();
IO::outl(PCI_ADDRESS_PORT, make_pci_address(address, field));
IO::outl(PCI_VALUE_PORT, value);
}
}