diff options
author | Hanhui <hanhui@acoinfo.com> | 2020-08-21 12:15:36 (GMT) |
---|---|---|
committer | Hanhui <hanhui@acoinfo.com> | 2020-08-21 12:15:36 (GMT) |
commit | e8171897ff6e4c3d19035c24d4aeaf5926716b90 (patch) | |
tree | 9e31606bd8e4da0009e7e07c26617d2e7472c1cc /SylixOS | |
parent | f0a81910d7f7ee9e4dbf7cd0e2d29d1ab33910f8 (diff) | |
download | libsylixos-e8171897ff6e4c3d19035c24d4aeaf5926716b90.zip libsylixos-e8171897ff6e4c3d19035c24d4aeaf5926716b90.tar.gz libsylixos-e8171897ff6e4c3d19035c24d4aeaf5926716b90.tar.bz2 |
Update SATA driver.
Diffstat (limited to 'SylixOS')
-rw-r--r-- | SylixOS/driver/pci/storage/pciStorageSata.c | 42 | ||||
-rw-r--r-- | SylixOS/driver/pci/storage/pciStorageSata.h | 2 | ||||
-rw-r--r-- | SylixOS/system/device/ahci/ahci.c | 10 | ||||
-rw-r--r-- | SylixOS/system/device/ahci/ahciCfg.h | 2 |
4 files changed, 39 insertions, 17 deletions
diff --git a/SylixOS/driver/pci/storage/pciStorageSata.c b/SylixOS/driver/pci/storage/pciStorageSata.c index 86ba4aa..c54e815 100644 --- a/SylixOS/driver/pci/storage/pciStorageSata.c +++ b/SylixOS/driver/pci/storage/pciStorageSata.c @@ -26,6 +26,7 @@ 2017.03.29 修正部分设备如 Sunrise Point-H 内存索引非 0 的问题. (v1.0.3-rc0) 2018.03.15 增加对 Loongson SATA 控制器 (如 7A1000) 资源索引的特殊处理. (v1.0.4-rc0) 2019.03.01 增加对 ATAPI 的支持. (v1.1.0-rc0) +2020.08.20 增加对 ZX-200 系列等只支持 MSI-X 中断的兼容支持. (v1.1.1-rc0) *********************************************************************************************************/ #define __SYLIXOS_PCI_DRV #define __SYLIXOS_AHCI_DRV @@ -938,6 +939,7 @@ static INT pciStorageSataVendorCtrlReadyWork (AHCI_CTRL_HANDLE hCtrl) PCI_RESOURCE_HANDLE hResource; pci_resource_size_t stStart; INT iBarIndex; + PCI_MSI_DESC_HANDLE hMsgHandle; hPciDev = (PCI_DEV_HANDLE)hCtrl->AHCICTRL_pvPciArg; /* 获取设备句柄 */ @@ -974,6 +976,27 @@ static INT pciStorageSataVendorCtrlReadyWork (AHCI_CTRL_HANDLE hCtrl) AHCI_LOG(AHCI_LOG_PRT, "ahci reg addr 0x%llx szie %llx.\r\n", hCtrl->AHCICTRL_pvRegAddr, hCtrl->AHCICTRL_stRegSize); + API_PciDevConfigReadWord(hPciDev, PCI_STATUS, &usStatus); + API_PciDevConfigWriteWord(hPciDev, PCI_STATUS, usStatus); + API_PciDevConfigReadWord(hPciDev, PCI_COMMAND, &usCmd); + API_PciDevConfigWriteWord(hPciDev, PCI_COMMAND, (usCmd | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER)); + + hMsgHandle = &hPciDev->PCIDEV_pmdDevIrqMsiDesc; + iRet = API_PciDevMsixEnableSet(hPciDev, LW_TRUE); + if (iRet != ERROR_NONE) { + goto __msi_handle; + } + + iRet = API_PciDevMsixRangeEnable(hPciDev, hMsgHandle, 1, 1); + if (iRet != ERROR_NONE) { + goto __msi_handle; + } + hCtrl->AHCICTRL_ulIrqVector = hMsgHandle->PCIMSI_ulDevIrqVector; + + return (ERROR_NONE); + +__msi_handle: + API_PciDevMsixEnableSet(hPciDev, LW_FALSE); iRet = API_PciDevMsiEnableSet(hPciDev, LW_TRUE); if (iRet != ERROR_NONE) { goto __intx_handle; @@ -982,27 +1005,16 @@ static INT pciStorageSataVendorCtrlReadyWork (AHCI_CTRL_HANDLE hCtrl) iRet = API_PciDevMsiRangeEnable(hPciDev, 1, 1); if (iRet != ERROR_NONE) { goto __intx_handle; - - } else { - hCtrl->AHCICTRL_ulIrqVector = hPciDev->PCIDEV_ulDevIrqVector; - goto __msi_handlel; } + hCtrl->AHCICTRL_ulIrqVector = hMsgHandle->PCIMSI_ulDevIrqVector; + + return (ERROR_NONE); __intx_handle: - iRet = API_PciDevMsiEnableSet(hPciDev, LW_FALSE); - if (iRet != ERROR_NONE) { - AHCI_LOG(AHCI_LOG_ERR, "pci msi disable failed dev %d:%d.%d.\r\n", - hPciDev->PCIDEV_iDevBus, hPciDev->PCIDEV_iDevDevice, hPciDev->PCIDEV_iDevFunction); - } + API_PciDevMsiEnableSet(hPciDev, LW_FALSE); hResource = API_PciDevResourceGet(hPciDev, PCI_IORESOURCE_IRQ, 0); hCtrl->AHCICTRL_ulIrqVector = (ULONG)PCI_RESOURCE_START(hResource); -__msi_handlel: - API_PciDevConfigReadWord(hPciDev, PCI_STATUS, &usStatus); - API_PciDevConfigWriteWord(hPciDev, PCI_STATUS, usStatus); - API_PciDevConfigReadWord(hPciDev, PCI_COMMAND, &usCmd); - API_PciDevConfigWriteWord(hPciDev, PCI_COMMAND, (usCmd | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER)); - return (ERROR_NONE); } /********************************************************************************************************* diff --git a/SylixOS/driver/pci/storage/pciStorageSata.h b/SylixOS/driver/pci/storage/pciStorageSata.h index dc9f0b4..cfb4c9a 100644 --- a/SylixOS/driver/pci/storage/pciStorageSata.h +++ b/SylixOS/driver/pci/storage/pciStorageSata.h @@ -26,7 +26,7 @@ 驱动参数 (版本号 0x01000101 为 v1.0.1-rc1) *********************************************************************************************************/ #define SATA_PCI_DRV_NAME "sata_pci" /* PCI 类型 */ -#define SATA_PCI_DRV_VER_NUM 0x01010000 /* 驱动版本数值 */ +#define SATA_PCI_DRV_VER_NUM 0x01010100 /* 驱动版本数值 */ /********************************************************************************************************* 函数声明 diff --git a/SylixOS/system/device/ahci/ahci.c b/SylixOS/system/device/ahci/ahci.c index bb802f8..b8d54a3 100644 --- a/SylixOS/system/device/ahci/ahci.c +++ b/SylixOS/system/device/ahci/ahci.c @@ -36,6 +36,7 @@ 2018.08.09 增加 S.M.A.R.T 功能的支持. (v1.2.0-rc0) 2018.08.20 修复 x86 下安装完系统后重启, 控制器给机械盘发送 RST-OFF 命令超时问题. (v1.2.1-rc0) 2018.03.01 增加 ATAPI 驱动支持. (v1.2.2-rc0) +2020.08.20 增加 PHY 复位后对错误寄存器进行清除操作来增强兼容性. (v1.2.3-rc0) *********************************************************************************************************/ #define __SYLIXOS_PCI_DRV #define __SYLIXOS_STDIO @@ -282,6 +283,15 @@ static INT __ahciDrivePhyReset (AHCI_CTRL_HANDLE hCtrl, UINT uiDrive) return (PX_ERROR); } + /* + * 端口复位后清除错误寄存器 + */ + AHCI_PORT_REG_MSG(hDrive, AHCI_PxSERR); + uiReg = AHCI_PORT_READ(hDrive, AHCI_PxSERR); + AHCI_PORT_WRITE(hDrive, AHCI_PxSERR, uiReg); + AHCI_PORT_READ(hDrive, AHCI_PxSERR); + AHCI_PORT_REG_MSG(hDrive, AHCI_PxSERR); + return (ERROR_NONE); } /********************************************************************************************************* diff --git a/SylixOS/system/device/ahci/ahciCfg.h b/SylixOS/system/device/ahci/ahciCfg.h index 60834f9..a2e8fbe 100644 --- a/SylixOS/system/device/ahci/ahciCfg.h +++ b/SylixOS/system/device/ahci/ahciCfg.h @@ -71,7 +71,7 @@ /********************************************************************************************************* 驱动版本 (0x01000101 为 v1.1.0) *********************************************************************************************************/ -#define AHCI_CTRL_DRV_VER_NUM 0x01020200 /* 驱动版本数值 */ +#define AHCI_CTRL_DRV_VER_NUM 0x01020300 /* 驱动版本数值 */ /********************************************************************************************************* 驱动参数 *********************************************************************************************************/ |