Skip to content

Commit

Permalink
prototyped a new implementation because the first re-write caused iss…
Browse files Browse the repository at this point in the history
…ues on real hardware
  • Loading branch information
FlareCoding committed Sep 21, 2024
1 parent 435655b commit 47d66f8
Show file tree
Hide file tree
Showing 25 changed files with 8,753 additions and 4,426 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ DISK_IMG := $(BIN_DIR)/$(OSNAME).elf
# QEMU
QEMU_CORES := 8
QEMU_EMULATOR := qemu-system-x86_64
COMMON_QEMU_FLAGS := -machine q35 -device qemu-xhci,id=xhci -drive file=$(DISK_IMG),format=raw -m 4G -net none -smp $(QEMU_CORES) -serial mon:stdio -trace usb_xhci_* -D /tmp/stellux-qemu-xhci.log
COMMON_QEMU_FLAGS := -machine q35 -device usb-ehci,id=ehci -device qemu-xhci,id=xhci -drive file=$(DISK_IMG),format=raw -m 4G -net none -smp $(QEMU_CORES) -serial mon:stdio -trace usb_xhci_* -D /tmp/stellux-qemu-xhci.log
QEMU_FLAGS := $(COMMON_QEMU_FLAGS) -drive if=pflash,format=raw,unit=0,file="efi/OVMF_CODE.fd",readonly=on -drive if=pflash,format=raw,unit=1,file="efi/OVMF_VARS.fd"

# Sample connected USB 2.0 devices
Expand Down
Binary file modified efi/OVMF_VARS.fd
Binary file not shown.
15 changes: 15 additions & 0 deletions kernel/src/acpi/mcfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ size_t Mcfg::findXhciController() {
return kstl::npos;
}

size_t Mcfg::findEhciController() {
for (size_t i = 0; i < m_devices.size(); i++) {
auto& info = m_devices[i];
if (
info.headerInfo.classCode == 0x0C &&
info.headerInfo.subclass == 0x03 &&
info.headerInfo.progIF == 0x20
) {
return i;
}
}

return kstl::npos;
}

__PRIVILEGED_CODE
void Mcfg::_enumeratePciFunction(uint64_t deviceAddress, uint64_t function) {
uint64_t offset = function << 12;
Expand Down
1 change: 1 addition & 0 deletions kernel/src/acpi/mcfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Mcfg {

// Helper functions for finding popular needed PCI devices
size_t findXhciController();
size_t findEhciController();

private:
McfgHeader* m_base;
Expand Down
Loading

0 comments on commit 47d66f8

Please sign in to comment.