Merge branch 'master' into isa/arm64
[lunaix-os.git] / lunaix-os / hal / ahci / ahci.c
index 11e16214b7afa07f269f47dc9ef141efa0fac901..f40ae2428a135457793da09bf209e42d271ab73c 100644 (file)
 #include <hal/ahci/scsi.h>
 #include <hal/pci.h>
 
 #include <hal/ahci/scsi.h>
 #include <hal/pci.h>
 
-#include <sys/pci_hba.h>
-#include <sys/port_io.h>
+#include <asm/x86_pmio.h>
 
 #include <klibc/string.h>
 #include <lunaix/block.h>
 
 #include <klibc/string.h>
 #include <lunaix/block.h>
-#include <lunaix/isrm.h>
+#include <asm-generic/isrm.h>
 #include <lunaix/mm/mmio.h>
 #include <lunaix/mm/valloc.h>
 #include <lunaix/mm/page.h>
 #include <lunaix/mm/mmio.h>
 #include <lunaix/mm/valloc.h>
 #include <lunaix/mm/page.h>
@@ -256,6 +255,7 @@ hba_bind_vbuf(struct hba_cmdh* cmdh, struct hba_cmdt* cmdt, struct vecbuf* vbuf)
     do {
         assert_msg(i < HBA_MAX_PRDTE, "HBA: Too many PRDTEs");
         assert_msg(pos->buf.size <= 0x400000U, "HBA: Buffer too big");
     do {
         assert_msg(i < HBA_MAX_PRDTE, "HBA: Too many PRDTEs");
         assert_msg(pos->buf.size <= 0x400000U, "HBA: Buffer too big");
+        assert_msg(pos->buf.size, "HBA: expect a non-zero buffer size");
 
         cmdt->entries[i++] =
           (struct hba_prdte){ .data_base = vmm_v2p((ptr_t)pos->buf.buffer),
 
         cmdt->entries[i++] =
           (struct hba_prdte){ .data_base = vmm_v2p((ptr_t)pos->buf.buffer),
@@ -411,6 +411,7 @@ int
 ahci_identify_device(struct hba_device* device)
 {
     // 用于重新识别设备(比如在热插拔的情况下)
 ahci_identify_device(struct hba_device* device)
 {
     // 用于重新识别设备(比如在热插拔的情况下)
+    // FIXME this is not right...
     vfree(device);
     return ahci_init_device(device->port);
 }
     vfree(device);
     return ahci_init_device(device->port);
 }