refactor: make pci device driver loading passive, pci bus scanner will not load them...
[lunaix-os.git] / lunaix-os / includes / hal / ahci / ahci.h
index acd779b7152646c3aa09d815e58e6ebd13bffce0..d4db5c1d76f1e803d01299e049f61646636b28fd 100644 (file)
@@ -1,6 +1,9 @@
 #ifndef __LUNAIX_AHCI_H
 #define __LUNAIX_AHCI_H
 
+#include "hba.h"
+#include <lunaix/isrm.h>
+
 /*
  * Macro naming rule:
  *      HBA_R[xxx]
 
 #define AHCI_HBA_CLASS 0x10601
 
+struct ahci_driver
+{
+    struct llist_header ahci_drvs;
+    struct ahci_hba hba;
+    int id;
+};
+
+struct ahci_driver_param
+{
+    ptr_t mmio_base;
+    size_t mmio_size;
+    int ahci_iv;
+};
+
+void
+ahci_parse_dev_info(struct hba_device* dev_info, u16_t* data);
+
+void
+ahci_parsestr(char* str, u16_t* reg_start, int size_word);
+
 /**
- * @brief 初始化AHCI与HBA
+ * @brief Issue a HBA command (synchronized)
  *
+ * @param port
+ * @param slot
+ * @return int
  */
-void
-ahci_init();
+int
+ahci_try_send(struct hba_port* port, int slot);
 
+/**
+ * @brief Issue a HBA command (asynchronized)
+ *
+ * @param port
+ * @param state
+ * @param slot
+ */
 void
-ahci_list_device();
+ahci_post(struct hba_port* port, struct hba_cmd_state* state, int slot);
 
-unsigned int
-ahci_get_port_usage();
+struct ahci_driver*
+ahci_driver_init(struct ahci_driver_param* param);
 
-struct hba_port*
-ahci_get_port(unsigned int index);
+void
+ahci_hba_isr(const isr_param* param);
 
 #endif /* __LUNAIX_AHCI_H */