summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorHanhui <sylixos@gmail.com>2019-07-10 06:57:06 (GMT)
committer Hanhui <sylixos@gmail.com>2019-06-19 09:04:05 (GMT)
commit3d1e2cf4710336a779b274582f6f38642ac2acf0 (patch)
treed6cd98835f73adb2d662499ffb99b953dff3f076
parent2e021491a30625995217a50130f66fee68195ae9 (diff)
downloadAIC-OS-3d1e2cf4710336a779b274582f6f38642ac2acf0.zip
More accurate BogoMIPS measurement in superscalar processor.
-rw-r--r--SylixOS/arch/arm/arm_support.h2
-rw-r--r--SylixOS/arch/arm/common/armLibAsm.S6
-rw-r--r--SylixOS/arch/arm/common/v7m/armLibV7MAsm.S6
-rw-r--r--SylixOS/arch/arm64/arm64_support.h2
-rw-r--r--SylixOS/arch/arm64/common/arm64LibAsm.S9
-rw-r--r--SylixOS/arch/csky/common/cskyLibAsm.S6
-rw-r--r--SylixOS/arch/csky/csky_support.h2
-rw-r--r--SylixOS/arch/mips/common/mipsLibAsm.S6
-rw-r--r--SylixOS/arch/mips/mips_support.h2
-rw-r--r--SylixOS/arch/ppc/common/ppcLibAsm.S6
-rw-r--r--SylixOS/arch/ppc/ppc_support.h2
-rw-r--r--SylixOS/arch/riscv/common/riscvLibAsm.S6
-rw-r--r--SylixOS/arch/riscv/riscv_support.h2
-rw-r--r--SylixOS/arch/sparc/common/sparcLibAsm.S6
-rw-r--r--SylixOS/arch/sparc/sparc_support.h2
-rw-r--r--SylixOS/arch/x86/common/x64/x64LibAsm.S6
-rw-r--r--SylixOS/arch/x86/common/x86LibAsm.S10
-rw-r--r--SylixOS/arch/x86/x86_support.h2
-rw-r--r--SylixOS/driver/pci/storage/pciStorageAta.c70
-rw-r--r--SylixOS/driver/pci/storage/pciStorageAta.h2
-rw-r--r--SylixOS/system/device/pci/pciLib.c10
21 files changed, 153 insertions, 12 deletions
diff --git a/SylixOS/arch/arm/arm_support.h b/SylixOS/arch/arm/arm_support.h
index 5ef5a35..3ae0b89 100644
--- a/SylixOS/arch/arm/arm_support.h
+++ b/SylixOS/arch/arm/arm_support.h
@@ -180,7 +180,7 @@ INTREG archGetCpsr(VOID);
VOID archBogoMipsLoop(ULONG ulLoop);
#define __ARCH_BOGOMIPS_LOOP archBogoMipsLoop
-#define __ARCH_BOGOMIPS_INS_PER_LOOP 2
+#define __ARCH_BOGOMIPS_INS_PER_LOOP 8
/*********************************************************************************************************
ARM CP15 基本功能
diff --git a/SylixOS/arch/arm/common/armLibAsm.S b/SylixOS/arch/arm/common/armLibAsm.S
index 9307366..8c2e70c 100644
--- a/SylixOS/arch/arm/common/armLibAsm.S
+++ b/SylixOS/arch/arm/common/armLibAsm.S
@@ -306,6 +306,12 @@ FUNC_DEF(archReboot)
FUNC_DEF(archBogoMipsLoop)
1:
+ MOV R1 , #1
+ MOV R2 , #2
+ MOV R3 , #3
+ MOV R1 , #1
+ MOV R2 , #2
+ MOV R3 , #3
SUBS R0 , R0 , #1
BNE 1b
BX LR
diff --git a/SylixOS/arch/arm/common/v7m/armLibV7MAsm.S b/SylixOS/arch/arm/common/v7m/armLibV7MAsm.S
index 2474a37..bfe98a7 100644
--- a/SylixOS/arch/arm/common/v7m/armLibV7MAsm.S
+++ b/SylixOS/arch/arm/common/v7m/armLibV7MAsm.S
@@ -253,6 +253,12 @@ FUNC_DEF(archReboot)
FUNC_DEF(archBogoMipsLoop)
1:
+ MOV R1 , #1
+ MOV R2 , #2
+ MOV R3 , #3
+ MOV R1 , #1
+ MOV R2 , #2
+ MOV R3 , #3
SUBS R0 , R0 , #1
BNE 1b
BX LR
diff --git a/SylixOS/arch/arm64/arm64_support.h b/SylixOS/arch/arm64/arm64_support.h
index f6f8b91..7ab89dc 100644
--- a/SylixOS/arch/arm64/arm64_support.h
+++ b/SylixOS/arch/arm64/arm64_support.h
@@ -152,7 +152,7 @@ VOID arm64WaitForInterrupt(VOID);
VOID archBogoMipsLoop(ULONG ulLoop);
#define __ARCH_BOGOMIPS_LOOP archBogoMipsLoop
-#define __ARCH_BOGOMIPS_INS_PER_LOOP 2
+#define __ARCH_BOGOMIPS_INS_PER_LOOP 8
/*********************************************************************************************************
ARM64 处理器 CACHE 操作
diff --git a/SylixOS/arch/arm64/common/arm64LibAsm.S b/SylixOS/arch/arm64/common/arm64LibAsm.S
index a7ef998..1aa3bfb 100644
--- a/SylixOS/arch/arm64/common/arm64LibAsm.S
+++ b/SylixOS/arch/arm64/common/arm64LibAsm.S
@@ -323,8 +323,15 @@ FUNC_DEF(archReboot)
;*********************************************************************************************************/
FUNC_DEF(archBogoMipsLoop)
+1:
+ MOV X1 , #1
+ MOV X2 , #2
+ MOV X3 , #3
+ MOV X1 , #1
+ MOV X2 , #2
+ MOV X3 , #3
SUBS X0 , X0 , #1
- BNE archBogoMipsLoop
+ BNE 1b
RET
FUNC_END()
diff --git a/SylixOS/arch/csky/common/cskyLibAsm.S b/SylixOS/arch/csky/common/cskyLibAsm.S
index e9073cc..43c88a2 100644
--- a/SylixOS/arch/csky/common/cskyLibAsm.S
+++ b/SylixOS/arch/csky/common/cskyLibAsm.S
@@ -256,6 +256,12 @@ FUNC_DEF(archReboot)
;*********************************************************************************************************/
FUNC_DEF(archBogoMipsLoop)
+ MOVI A1 , 1
+ MOVI A2 , 2
+ MOVI A3 , 3
+ MOVI A1 , 1
+ MOVI A2 , 2
+ MOVI A3 , 3
SUBI A0 , 1
BNEZ A0 , archBogoMipsLoop
RTS
diff --git a/SylixOS/arch/csky/csky_support.h b/SylixOS/arch/csky/csky_support.h
index 233bcca..64e9d9c 100644
--- a/SylixOS/arch/csky/csky_support.h
+++ b/SylixOS/arch/csky/csky_support.h
@@ -145,7 +145,7 @@ VOID archReboot(INT iRebootType, addr_t ulStartAddress);
VOID archBogoMipsLoop(ULONG ulLoop);
#define __ARCH_BOGOMIPS_LOOP archBogoMipsLoop
-#define __ARCH_BOGOMIPS_INS_PER_LOOP 2
+#define __ARCH_BOGOMIPS_INS_PER_LOOP 8
/*********************************************************************************************************
C-SKY 处理器 CACHE 操作
diff --git a/SylixOS/arch/mips/common/mipsLibAsm.S b/SylixOS/arch/mips/common/mipsLibAsm.S
index 32fec95..1159413 100644
--- a/SylixOS/arch/mips/common/mipsLibAsm.S
+++ b/SylixOS/arch/mips/common/mipsLibAsm.S
@@ -300,6 +300,12 @@ FUNC_DEF(archReboot)
FUNC_DEF(archBogoMipsLoop)
1:
+ LI T1 , 1
+ LI T2 , 2
+ LI T3 , 3
+ LI T1 , 1
+ LI T2 , 2
+ LI T3 , 3
BNE A0 , ZERO , 1b
REG_SUBU A0 , 1
JR RA
diff --git a/SylixOS/arch/mips/mips_support.h b/SylixOS/arch/mips/mips_support.h
index 1dabfbf..ac2da34 100644
--- a/SylixOS/arch/mips/mips_support.h
+++ b/SylixOS/arch/mips/mips_support.h
@@ -154,7 +154,7 @@ VOID archReboot(INT iRebootType, addr_t ulStartAddress);
VOID archBogoMipsLoop(ULONG ulLoop);
#define __ARCH_BOGOMIPS_LOOP archBogoMipsLoop
-#define __ARCH_BOGOMIPS_INS_PER_LOOP 2
+#define __ARCH_BOGOMIPS_INS_PER_LOOP 8
/*********************************************************************************************************
MIPS 处理器 CACHE 操作
diff --git a/SylixOS/arch/ppc/common/ppcLibAsm.S b/SylixOS/arch/ppc/common/ppcLibAsm.S
index a77a50d..633164f 100644
--- a/SylixOS/arch/ppc/common/ppcLibAsm.S
+++ b/SylixOS/arch/ppc/common/ppcLibAsm.S
@@ -275,6 +275,12 @@ FUNC_DEF(archReboot)
FUNC_DEF(archBogoMipsLoop)
1:
+ LI R4 , 4
+ LI R5 , 5
+ LI R6 , 6
+ LI R4 , 4
+ LI R5 , 5
+ LI R6 , 6
SUBI R3 , R3 , 1
CMPWI CR0, R3 , 0
BNE CR0, 1b
diff --git a/SylixOS/arch/ppc/ppc_support.h b/SylixOS/arch/ppc/ppc_support.h
index eb4e459..0657111 100644
--- a/SylixOS/arch/ppc/ppc_support.h
+++ b/SylixOS/arch/ppc/ppc_support.h
@@ -146,7 +146,7 @@ VOID archReboot(INT iRebootType, addr_t ulStartAddress);
VOID archBogoMipsLoop(ULONG ulLoop);
#define __ARCH_BOGOMIPS_LOOP archBogoMipsLoop
-#define __ARCH_BOGOMIPS_INS_PER_LOOP 3
+#define __ARCH_BOGOMIPS_INS_PER_LOOP 9
/*********************************************************************************************************
PowerPC 处理器定义
diff --git a/SylixOS/arch/riscv/common/riscvLibAsm.S b/SylixOS/arch/riscv/common/riscvLibAsm.S
index 0637a87..5081d65 100644
--- a/SylixOS/arch/riscv/common/riscvLibAsm.S
+++ b/SylixOS/arch/riscv/common/riscvLibAsm.S
@@ -235,6 +235,12 @@ FUNC_DEF(archReboot)
FUNC_DEF(archBogoMipsLoop)
LI T0 , 1
LINE_LABEL(again)
+ LI T1 , 1
+ LI T2 , 2
+ LI T3 , 3
+ LI T1 , 1
+ LI T2 , 2
+ LI T3 , 3
SUB A0 , A0 , T0
BNEZ A0 , again
RET
diff --git a/SylixOS/arch/riscv/riscv_support.h b/SylixOS/arch/riscv/riscv_support.h
index 104d2bb..fb1b3a3 100644
--- a/SylixOS/arch/riscv/riscv_support.h
+++ b/SylixOS/arch/riscv/riscv_support.h
@@ -149,7 +149,7 @@ VOID archReboot(INT iRebootType, addr_t ulStartAddress);
VOID archBogoMipsLoop(ULONG ulLoop);
#define __ARCH_BOGOMIPS_LOOP archBogoMipsLoop
-#define __ARCH_BOGOMIPS_INS_PER_LOOP 2
+#define __ARCH_BOGOMIPS_INS_PER_LOOP 8
/*********************************************************************************************************
RISC-V 处理器 CACHE 操作
diff --git a/SylixOS/arch/sparc/common/sparcLibAsm.S b/SylixOS/arch/sparc/common/sparcLibAsm.S
index 332e8ff..026f138 100644
--- a/SylixOS/arch/sparc/common/sparcLibAsm.S
+++ b/SylixOS/arch/sparc/common/sparcLibAsm.S
@@ -286,6 +286,12 @@ FUNC_END(archReboot)
FUNC_DEF(archBogoMipsLoop)
LINE_LABEL(bogo_loop)
+ MOV 1 , %o1
+ MOV 2 , %o2
+ MOV 3 , %o3
+ MOV 1 , %o1
+ MOV 2 , %o2
+ MOV 3 , %o3
SUBCC %o0 , 0x1 , %o0
BNE bogo_loop
NOP
diff --git a/SylixOS/arch/sparc/sparc_support.h b/SylixOS/arch/sparc/sparc_support.h
index e29d11d..f528547 100644
--- a/SylixOS/arch/sparc/sparc_support.h
+++ b/SylixOS/arch/sparc/sparc_support.h
@@ -147,7 +147,7 @@ VOID archReboot(INT iRebootType, addr_t ulStartAddress);
VOID archBogoMipsLoop(ULONG ulLoop);
#define __ARCH_BOGOMIPS_LOOP archBogoMipsLoop
-#define __ARCH_BOGOMIPS_INS_PER_LOOP 3
+#define __ARCH_BOGOMIPS_INS_PER_LOOP 9
/*********************************************************************************************************
SPARC 处理器定义
diff --git a/SylixOS/arch/x86/common/x64/x64LibAsm.S b/SylixOS/arch/x86/common/x64/x64LibAsm.S
index d3e4aea..e7b6898 100644
--- a/SylixOS/arch/x86/common/x64/x64LibAsm.S
+++ b/SylixOS/arch/x86/common/x64/x64LibAsm.S
@@ -293,6 +293,12 @@ FUNC_DEF(archReboot)
FUNC_DEF(archBogoMipsLoop)
1:
+ MOV $1 , X86_64_ARG1
+ MOV $2 , X86_64_ARG2
+ MOV $3 , X86_64_ARG3
+ MOV $1 , X86_64_ARG1
+ MOV $2 , X86_64_ARG2
+ MOV $3 , X86_64_ARG3
DEC X86_64_ARG0
JNS 1b
RET
diff --git a/SylixOS/arch/x86/common/x86LibAsm.S b/SylixOS/arch/x86/common/x86LibAsm.S
index 6a8b9ec..7cb139c 100644
--- a/SylixOS/arch/x86/common/x86LibAsm.S
+++ b/SylixOS/arch/x86/common/x86LibAsm.S
@@ -274,9 +274,15 @@ FUNC_DEF(archReboot)
;*********************************************************************************************************/
FUNC_DEF(archBogoMipsLoop)
- MOVL X86_SP_ARG1(%ESP) , %EAX
+ MOVL X86_SP_ARG1(%ESP) , %ECX
1:
- DEC %EAX
+ MOVL $1 , %EAX
+ MOVL $2 , %EDX
+ MOVL $1 , %EAX
+ MOVL $2 , %EDX
+ MOVL $1 , %EAX
+ MOVL $2 , %EDX
+ DEC %ECX
JNS 1b
RET
FUNC_END(archBogoMipsLoop)
diff --git a/SylixOS/arch/x86/x86_support.h b/SylixOS/arch/x86/x86_support.h
index d3f5097..8886ea8 100644
--- a/SylixOS/arch/x86/x86_support.h
+++ b/SylixOS/arch/x86/x86_support.h
@@ -150,7 +150,7 @@ VOID archReboot(INT iRebootType, addr_t ulStartAddress);
VOID archBogoMipsLoop(ULONG ulLoop);
#define __ARCH_BOGOMIPS_LOOP archBogoMipsLoop
-#define __ARCH_BOGOMIPS_INS_PER_LOOP 2
+#define __ARCH_BOGOMIPS_INS_PER_LOOP 8
/*********************************************************************************************************
x86 处理器 CACHE 操作
diff --git a/SylixOS/driver/pci/storage/pciStorageAta.c b/SylixOS/driver/pci/storage/pciStorageAta.c
index 0a94fd5..91bf222 100644
--- a/SylixOS/driver/pci/storage/pciStorageAta.c
+++ b/SylixOS/driver/pci/storage/pciStorageAta.c
@@ -17,6 +17,9 @@
** 文件创建日期: 2018 年 09 月 04 日
**
** 描 述: ATA/IDE 驱动.
+
+** BUG:
+** 2019.07.02 增加 INTEL ICH4 IDE 控制器延时的特殊处理, 否则会出现控制器复位失败.
*********************************************************************************************************/
#define __SYLIXOS_PCI_DRV
#define __SYLIXOS_ATA_DRV
@@ -30,6 +33,7 @@
#if (LW_CFG_DEVICE_EN > 0) && (LW_CFG_PCI_EN > 0) && (LW_CFG_ATA_EN > 0) && (LW_CFG_DRV_ATA_IDE > 0)
#include "pci_ids.h"
#include "pciStorageAta.h"
+#include "../SylixOS/system/device/ata/ataLib.h"
/*********************************************************************************************************
板载类型.
*********************************************************************************************************/
@@ -203,6 +207,68 @@ typedef struct ata_pci_dma_ctrl {
typedef ATA_PCI_DMA_CTRL_CB *ATA_PCI_DMA_CTRL_HANDLE;
/*********************************************************************************************************
+** 函数名称: pciStorageAtaCtrlIch4Delay
+** 功能描述: ICH4 控制器延时处理
+** 输 入 : hCtrl 控制器句柄
+** 输 出 : NONE
+** 全局变量:
+** 调用模块:
+*********************************************************************************************************/
+static VOID pciStorageAtaCtrlIch4Delay (ATA_CTRL_HANDLE hCtrl)
+{
+ UINT8 ucReg;
+
+ ATA_IO_BYTES_READ(hCtrl, ATA_A_STATUS_ADDR(hCtrl), &ucReg, 1);
+ ATA_IO_BYTES_READ(hCtrl, ATA_A_STATUS_ADDR(hCtrl), &ucReg, 1);
+ ATA_IO_BYTES_READ(hCtrl, ATA_A_STATUS_ADDR(hCtrl), &ucReg, 1);
+ ATA_IO_BYTES_READ(hCtrl, ATA_A_STATUS_ADDR(hCtrl), &ucReg, 1);
+ ATA_IO_BYTES_READ(hCtrl, ATA_A_STATUS_ADDR(hCtrl), &ucReg, 1);
+ ATA_IO_BYTES_READ(hCtrl, ATA_A_STATUS_ADDR(hCtrl), &ucReg, 1);
+
+ ATA_IO_BYTES_READ(hCtrl, ATA_A_STATUS_ADDR(hCtrl), &ucReg, 1);
+ ATA_IO_BYTES_READ(hCtrl, ATA_A_STATUS_ADDR(hCtrl), &ucReg, 1);
+ ATA_IO_BYTES_READ(hCtrl, ATA_A_STATUS_ADDR(hCtrl), &ucReg, 1);
+}
+/*********************************************************************************************************
+** 函数名称: pciStorageAtaCtrlQuirk
+** 功能描述: 控制器的特殊处理
+** 输 入 : hPciDev PCI 设备句柄
+** hDrv 驱动句柄
+** hCtrlCfg 控制器配置句柄
+** 输 出 : ERROR or OK
+** 全局变量:
+** 调用模块:
+*********************************************************************************************************/
+static INT pciStorageAtaCtrlQuirk (PCI_DEV_HANDLE hPciDev,
+ ATA_DRV_HANDLE hDrv,
+ ATA_CTRL_CFG_HANDLE hCtrlCfg)
+{
+ UINT16 usVendorId;
+ UINT16 usDeviceId;
+
+ if ((!hPciDev) || (!hDrv) || (!hCtrlCfg)) {
+ _ErrorHandle(EINVAL);
+ return (PX_ERROR);
+ }
+
+ usVendorId = PCI_DEV_VENDOR_ID(hPciDev);
+ usDeviceId = PCI_DEV_DEVICE_ID(hPciDev);
+
+ switch (usVendorId) {
+
+ case PCI_VENDOR_ID_INTEL:
+ if (usDeviceId == PCI_DEVICE_ID_INTEL_82801DB_11) {
+ hCtrlCfg->ATACTRLCFG_pfuncDelay = (FUNCPTR)pciStorageAtaCtrlIch4Delay;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return (ERROR_NONE);
+}
+/*********************************************************************************************************
** 函数名称: pciStorageAtaDevIdTblGet
** 功能描述: 获取设备列表
** 输 入 : phPciDevId 设备 ID 列表句柄缓冲区
@@ -989,6 +1055,8 @@ static INT pciStorageAtaDevProbe (PCI_DEV_HANDLE hPciDev, const PCI_DEV_ID_HAN
}
hCtrlCfg->ATACTRLCFG_pfuncDelay = (FUNCPTR)LW_NULL;
+ pciStorageAtaCtrlQuirk(hPciDev, hDrv, hCtrlCfg);
+
hCtrlCfg = &hDrv->ATADRV_tCtrlCfg[1];
if (ucReg & ATA_SEC_NATIVE_EN) {
hResource = API_PciDevResourceGet(hPciDev, PCI_IORESOURCE_IRQ, 0);
@@ -1028,6 +1096,8 @@ static INT pciStorageAtaDevProbe (PCI_DEV_HANDLE hPciDev, const PCI_DEV_ID_HAN
}
hCtrlCfg->ATACTRLCFG_pfuncDelay = (FUNCPTR)LW_NULL;
+ pciStorageAtaCtrlQuirk(hPciDev, hDrv, hCtrlCfg);
+
/*
* 驱动 IO 操作初始化
*/
diff --git a/SylixOS/driver/pci/storage/pciStorageAta.h b/SylixOS/driver/pci/storage/pciStorageAta.h
index e9d1d39..64ed9f3 100644
--- a/SylixOS/driver/pci/storage/pciStorageAta.h
+++ b/SylixOS/driver/pci/storage/pciStorageAta.h
@@ -26,7 +26,7 @@
驱动名称
*********************************************************************************************************/
#define ATA_PCI_DRV_NAME "ata_pci" /* PCI 类型 */
-#define ATA_PCI_DRV_VER_NUM 0x02000000 /* 驱动版本数值 */
+#define ATA_PCI_DRV_VER_NUM 0x02000100 /* 驱动版本数值 */
/*********************************************************************************************************
函数声明
diff --git a/SylixOS/system/device/pci/pciLib.c b/SylixOS/system/device/pci/pciLib.c
index 5375b94..4cb57ac 100644
--- a/SylixOS/system/device/pci/pciLib.c
+++ b/SylixOS/system/device/pci/pciLib.c
@@ -216,6 +216,8 @@ pci_size_t API_PciSizeNumGet (pci_size_t stSize)
LW_API
PCI_CTRL_HANDLE API_PciCtrlCreate (PCI_CTRL_HANDLE hCtrl)
{
+ PCI_AUTO_HANDLE hPciAuto; /* 自动配置控制句柄 */
+
if (PCI_CTRL == LW_NULL) {
PCI_CTRL = hCtrl;
@@ -227,8 +229,16 @@ PCI_CTRL_HANDLE API_PciCtrlCreate (PCI_CTRL_HANDLE hCtrl)
/*
* 需要在设备列表创建完成之后再进行自动配置
* 因为部分平台配置寄存器的读写需要依赖父节点的索引参数
+ *
+ * 需要在自动配置后重新更新设备列表
+ * 因为部分主控器会修改枚举设备树型结构
*/
API_PciAutoScan(hCtrl, (UINT32 *)&hCtrl->PCI_iBusMax);
+ hPciAuto = &hCtrl->PCI_tAutoConfig;
+ if (hPciAuto->PCIAUTO_iConfigEn) { /* 自动配置使能 */
+ API_PciDevDelete(LW_NULL);
+ API_PciDevListCreate();
+ }
#if LW_CFG_PROCFS_EN > 0
__procFsPciInit();