From bb83659cf509f659cf1dd2e4ad239a32ad9ce119 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sat, 3 Feb 2024 10:07:06 +0100 Subject: WiP: See below. - GetDevicePathSize - IsDevicePathValid - DuplicateDevicePath - Fix kernel build on MinGW-gcc. - Will also work on kernel disk bootstrap drivers (ATA, NVME). - Add compile_flags.txt for drivers to lint correctly. Signed-off-by: Amlal El Mahrouss --- Drivers/AHCI/compile_flags.txt | 4 +++ Drivers/Ethernet/compile_flags.txt | 4 +++ Drivers/NVME/.gitkeep | 0 Drivers/NVME/compile_flags.txt | 4 +++ Drivers/WiFi/compile_flags.txt | 4 +++ Drivers/XHCI/Defines.hxx | 65 +++++++++++++++++++++++++++++++++++++ Drivers/XHCI/USBRegs.hxx | 66 -------------------------------------- Drivers/XHCI/compile_flags.txt | 4 +++ 8 files changed, 85 insertions(+), 66 deletions(-) create mode 100644 Drivers/AHCI/compile_flags.txt create mode 100644 Drivers/Ethernet/compile_flags.txt create mode 100644 Drivers/NVME/.gitkeep create mode 100644 Drivers/NVME/compile_flags.txt create mode 100644 Drivers/WiFi/compile_flags.txt create mode 100644 Drivers/XHCI/Defines.hxx delete mode 100644 Drivers/XHCI/USBRegs.hxx create mode 100644 Drivers/XHCI/compile_flags.txt (limited to 'Drivers') diff --git a/Drivers/AHCI/compile_flags.txt b/Drivers/AHCI/compile_flags.txt new file mode 100644 index 00000000..545816fc --- /dev/null +++ b/Drivers/AHCI/compile_flags.txt @@ -0,0 +1,4 @@ +-I./ +-I../ +-I../../Private +-std=c++20 diff --git a/Drivers/Ethernet/compile_flags.txt b/Drivers/Ethernet/compile_flags.txt new file mode 100644 index 00000000..545816fc --- /dev/null +++ b/Drivers/Ethernet/compile_flags.txt @@ -0,0 +1,4 @@ +-I./ +-I../ +-I../../Private +-std=c++20 diff --git a/Drivers/NVME/.gitkeep b/Drivers/NVME/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Drivers/NVME/compile_flags.txt b/Drivers/NVME/compile_flags.txt new file mode 100644 index 00000000..545816fc --- /dev/null +++ b/Drivers/NVME/compile_flags.txt @@ -0,0 +1,4 @@ +-I./ +-I../ +-I../../Private +-std=c++20 diff --git a/Drivers/WiFi/compile_flags.txt b/Drivers/WiFi/compile_flags.txt new file mode 100644 index 00000000..6e721e73 --- /dev/null +++ b/Drivers/WiFi/compile_flags.txt @@ -0,0 +1,4 @@ +-I./ +-I../ +-I../../../Private +-std=c++20 diff --git a/Drivers/XHCI/Defines.hxx b/Drivers/XHCI/Defines.hxx new file mode 100644 index 00000000..38ca7853 --- /dev/null +++ b/Drivers/XHCI/Defines.hxx @@ -0,0 +1,65 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + + File: Defines.hxx + Purpose: XHCI (and backwards) defines. + + Revision History: + + 01/02/24: Added file (amlel) + 03/02/24: Update filename to Defines.hxx (amlel) + +------------------------------------------- */ + +#pragma once + +#include + +#define kUSBCommand (UInt16)0x0 +#define kUSBStatus (UInt16)0x2 +#define kUSBInterruptEnable (UInt16)0x4 +#define kUSBFrameNum (UInt16)0x6 +#define kUSBFrameListBaseAddress (UInt16)0x8 +#define kUSBFrameModifyStart (UInt16)0xC +#define kUSBPort1StatusCtrl (UInt16)0x10 +#define kUSBPort2StatusCtrl (UInt16)0x12 + +typedef struct USBCommandRegister final { + UInt8 mReserved[8]; // Reserved + UInt8 + mMaxPacket; // 0 = Max packet size 32 bits 1 = Max packet size 64 bits + UInt8 mConfigure; + UInt8 mSoftwareDebug; + UInt8 mGlobalResume; + UInt8 mGlobalSuspend; + UInt8 mHostCtrlReset; + UInt8 mRun; // 1 = Controller execute frame list entries +} USBCommandRegister; + +typedef struct USBStatusRegister final { + UInt8 mReserved[8]; // Reserved + UInt8 mHalted; // 1 = bit 0 in CMD is zero 0 = bit 0 in CMD is 1 + UInt8 mProcessError; + UInt8 mSystemError; + UInt8 mResumeDetected; + UInt8 mErrorInterrupt; + UInt8 mInterrupt; +} USBStatusRegister; + +typedef struct USBInterruptEnableRegister final { + UInt8 mReserved[4]; // Reserved + UInt8 mShortPacket; // 1=Enable interrupt 0=Disable interrupt + UInt8 mComplete; // 1=Enable interrupt 0=Disable interrupt + UInt8 mResume; // 1=Enable interrupt 0=Disable interrupt + UInt8 mTimeoutCRC; // 1=Enable interrupt 0=Disable interrupt +} USBInterruptEnableRegister; + +/* + Some terminology: + + Frame Number: Number of processed entry of Frame List. + Frame List Base Address: + 32-bit physical adress of Frame List. Remember that first 12 bytes are + always 0. The Frame List must contain 1024 entries. +*/ diff --git a/Drivers/XHCI/USBRegs.hxx b/Drivers/XHCI/USBRegs.hxx deleted file mode 100644 index 5ef2ee2e..00000000 --- a/Drivers/XHCI/USBRegs.hxx +++ /dev/null @@ -1,66 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - - File: USBRegs.hxx - Purpose: USB registers - - Revision History: - - 01/02/24: Added file (amlel) - -------------------------------------------- */ - -#pragma once - -typedef __UINT16_TYPE__ UInt16; -typedef __UINT32_TYPE__ UInt32; -typedef __UINT8_TYPE__ UInt8; - -#define kUSBCommand (UInt16)0x0 -#define kUSBStatus (UInt16)0x2 -#define kUSBInterruptEnable (UInt16)0x4 -#define kUSBFrameNum (UInt16)0x6 -#define kUSBFrameListBaseAddress (UInt16)0x8 -#define kUSBFrameModifyStart (UInt16)0xC -#define kUSBPort1StatusCtrl (UInt16)0x10 -#define kUSBPort2StatusCtrl (UInt16)0x12 - -typedef struct USBCommandRegister final { - UInt8 mReserved[8]; // Reserved - UInt8 - mMaxPacket; // 0 = Max packet size 32 bits 1 = Max packet size 64 bits - UInt8 mConfigure; - UInt8 mSoftwareDebug; - UInt8 mGlobalResume; - UInt8 mGlobalSuspend; - UInt8 mHostCtrlReset; - UInt8 mRun; // 1 = Controller execute frame list entries -} USBCommandRegister; - -typedef struct USBStatusRegister final { - UInt8 mReserved[8]; // Reserved - UInt8 mHalted; // 1 = bit 0 in CMD is zero 0 = bit 0 in CMD is 1 - UInt8 mProcessError; - UInt8 mSystemError; - UInt8 mResumeDetected; - UInt8 mErrorInterrupt; - UInt8 mInterrupt; -} USBStatusRegister; - -typedef struct USBInterruptEnableRegister final { - UInt8 mReserved[4]; // Reserved - UInt8 mShortPacket; // 1=Enable interrupt 0=Disable interrupt - UInt8 mComplete; // 1=Enable interrupt 0=Disable interrupt - UInt8 mResume; // 1=Enable interrupt 0=Disable interrupt - UInt8 mTimeoutCRC; // 1=Enable interrupt 0=Disable interrupt -} USBInterruptEnableRegister; - -/* - Some terminology: - - Frame Number: Number of processed entry of Frame List. - Frame List Base Address: - 32-bit physical adress of Frame List. Remember that first 12 bytes are - always 0. The Frame List must contain 1024 entries. -*/ diff --git a/Drivers/XHCI/compile_flags.txt b/Drivers/XHCI/compile_flags.txt new file mode 100644 index 00000000..545816fc --- /dev/null +++ b/Drivers/XHCI/compile_flags.txt @@ -0,0 +1,4 @@ +-I./ +-I../ +-I../../Private +-std=c++20 -- cgit v1.2.3