X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/bb7ce16533fb6c1384775dea6e1150e74c229daf..a4ec38a4c7ef61b04b92d34637c846a8e2e95f7f:/lunaix-os/hal/ahci/ahci.c diff --git a/lunaix-os/hal/ahci/ahci.c b/lunaix-os/hal/ahci/ahci.c index 206112e..43b8f1e 100644 --- a/lunaix-os/hal/ahci/ahci.c +++ b/lunaix-os/hal/ahci/ahci.c @@ -78,9 +78,8 @@ ahci_init() struct pci_device* ahci_dev = pci_get_device_by_class(AHCI_HBA_CLASS); assert_msg(ahci_dev, "AHCI: Not found."); - uintptr_t bar6, size; - size = pci_bar_sizing(ahci_dev, &bar6, 6); - assert_msg(bar6 && PCI_BAR_MMIO(bar6), "AHCI: BAR#6 is not MMIO."); + struct pci_base_addr* bar6 = &ahci_dev->bar[5]; + assert_msg(bar6->type & BAR_TYPE_MMIO, "AHCI: BAR#6 is not MMIO."); pci_reg_t cmd = pci_read_cspace(ahci_dev->cspace_base, PCI_REG_STATUS_CMD); @@ -94,7 +93,7 @@ ahci_init() memset(&hba, 0, sizeof(hba)); - hba.base = (hba_reg_t*)ioremap(PCI_BAR_ADDR_MM(bar6), size); + hba.base = (hba_reg_t*)ioremap(bar6->start, bar6->size); #ifdef DO_HBA_FULL_RESET // 重置HBA