git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'origin/master' into isa/arm64
[lunaix-os.git]
/
lunaix-os
/
hal
/
ahci
/
ahci.c
diff --git
a/lunaix-os/hal/ahci/ahci.c
b/lunaix-os/hal/ahci/ahci.c
index 82375e0a9dda85670435f1e2c21d4e09ea40b392..5213a53268becba11eb363428d722c79c281499f 100644
(file)
--- a/
lunaix-os/hal/ahci/ahci.c
+++ b/
lunaix-os/hal/ahci/ahci.c
@@
-14,11
+14,9
@@
#include <hal/ahci/scsi.h>
#include <hal/pci.h>
#include <hal/ahci/scsi.h>
#include <hal/pci.h>
-#include <sys/port_io.h>
-
#include <klibc/string.h>
#include <lunaix/block.h>
#include <klibc/string.h>
#include <lunaix/block.h>
-#include <
lunaix/
generic/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>
@@
-29,7
+27,7
@@
#define HBA_CLB_SIZE 1024
#define HBA_MY_IE (HBA_PxINTR_DHR | HBA_PxINTR_TFE | HBA_PxINTR_OF)
#define HBA_CLB_SIZE 1024
#define HBA_MY_IE (HBA_PxINTR_DHR | HBA_PxINTR_TFE | HBA_PxINTR_OF)
-#define AHCI_DEVCLASS DEVCLASS(
DEVIF_PCI, DEVFN_STORAGE, DEV_
SATA)
+#define AHCI_DEVCLASS DEVCLASS(
LUNAIX, STORAGE,
SATA)
// #define DO_HBA_FULL_RESET
// #define DO_HBA_FULL_RESET
@@
-71,7
+69,7
@@
__hba_reset_port(hba_reg_t* port_reg)
}
// 如果port未响应,则继续执行重置
port_reg[HBA_RPxSCTL] = (port_reg[HBA_RPxSCTL] & ~0xf) | 1;
}
// 如果port未响应,则继续执行重置
port_reg[HBA_RPxSCTL] = (port_reg[HBA_RPxSCTL] & ~0xf) | 1;
- port_delay(100000); // 等待至少一毫秒,差不多就行了
+
port_reg[HBA_RPxSCTL] &= ~0xf;
}
port_reg[HBA_RPxSCTL] &= ~0xf;
}
@@
-255,6
+253,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),
@@
-410,6
+409,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);
}