diff options
| author | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-01 08:48:08 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-01 08:48:08 +0100 |
| commit | fcc8bad0b5e0af4f1f68c96449ce086375cb4b81 (patch) | |
| tree | 0b6ab548c72900b3534a358de23728b4bc1d7275 | |
| parent | b052cb4fbb7b83c1292a3098ee7d00e9f3f3fba1 (diff) | |
See below.
- Add USBRegs in XHCI.
- Add brief description in EFIKit/EPM.hxx
- Move HCoreKrnl into EFI/BOOT (makefile NewBoot)
Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
| -rw-r--r-- | Drivers/XHCI/USBRegs.hxx | 66 | ||||
| -rw-r--r-- | Private/EFIKit/EPM.hxx | 55 | ||||
| -rw-r--r-- | Private/NewBoot/Source/makefile | 1 |
3 files changed, 96 insertions, 26 deletions
diff --git a/Drivers/XHCI/USBRegs.hxx b/Drivers/XHCI/USBRegs.hxx new file mode 100644 index 00000000..5ef2ee2e --- /dev/null +++ b/Drivers/XHCI/USBRegs.hxx @@ -0,0 +1,66 @@ +/* ------------------------------------------- + + 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/Private/EFIKit/EPM.hxx b/Private/EFIKit/EPM.hxx index 4b88c4cd..f1cb84ba 100644 --- a/Private/EFIKit/EPM.hxx +++ b/Private/EFIKit/EPM.hxx @@ -7,6 +7,12 @@ * ======================================================== */ +/** + @brief The Explicit Partition Map use is to tell how many NewFS and other + EPM compatible fs. We have in this computer. + +*/ + #ifndef __PARTITION_MAP__ #define __PARTITION_MAP__ @@ -20,31 +26,29 @@ inline consteval int kMagicLen = 4; * @brief The EPM bootloader block. * boot code info */ -struct __attribute__((packed)) BootBlock -{ - char magic[kMagicLen]; - char name[kNameLen]; - char uuid[kUUIDLen]; - int version; - long long int num_blocks; - long long int sector_sz; - long long int sector_start; +struct __attribute__((packed)) BootBlock { + char magic[kMagicLen]; + char name[kNameLen]; + char uuid[kUUIDLen]; + int version; + long long int num_blocks; + long long int sector_sz; + long long int sector_start; }; /** * @brief The EPM partition block. * used to explain a partition inside a media. */ -struct __attribute__((packed)) PartitionBlock -{ - char name[32]; - int magic; - long long int sector_end; - long long int sector_sz; - long long int sector_start; - short type; - int version; - char fs[16]; /* ffs_2 */ +struct __attribute__((packed)) PartitionBlock { + char name[32]; + int magic; + long long int sector_end; + long long int sector_sz; + long long int sector_start; + short type; + int version; + char fs[16]; /* ffs_2 */ }; /* @brief AMD64 magic for EPM */ @@ -67,12 +71,11 @@ struct __attribute__((packed)) PartitionBlock //! version types. //! use in boot block version field. -enum -{ - kEPMMpUx = 0xcf, - kEPMLinux = 0x8f, - kEPMBSD = 0x9f, - kEPMHCore = 0x1f, +enum { + kEPMMpUx = 0xcf, + kEPMLinux = 0x8f, + kEPMBSD = 0x9f, + kEPMHCore = 0x1f, }; /// END SPECS @@ -86,4 +89,4 @@ typedef struct PartitionBlock PartitionBlockType; #define kMag "EPM??" #endif -#endif // ifndef __PARTITION_MAP__ +#endif // ifndef __PARTITION_MAP__ diff --git a/Private/NewBoot/Source/makefile b/Private/NewBoot/Source/makefile index 0a2e1d91..4193f12d 100644 --- a/Private/NewBoot/Source/makefile +++ b/Private/NewBoot/Source/makefile @@ -17,6 +17,7 @@ bootloader-amd64: $(CC_GNU) $(FLAG_GNU) HEL/AMD64/*.cxx $(LD_GNU) *.o -e efi_main -filealign:16 -shared --subsystem=10 -ffreestanding -o HCoreLdr.exe cp HCoreLdr.exe CDROM/EFI/BOOT/BOOTX64.EFI + cp ../../HCoreKrnl.exe CDROM/EFI/BOOT/HCoreKrnl.exe .PHONY: run-efi-debug run-efi-debug: |
