[Yellowstone] Add method to get XHCI configuration space.
This commit is contained in:
parent
27c39d05e8
commit
3bacfea183
11 changed files with 172 additions and 4 deletions
|
|
@ -4,7 +4,7 @@
|
|||
#include <mammoth/util/init.h>
|
||||
#include <zcall.h>
|
||||
|
||||
#define PCI_DEBUG 0
|
||||
#define PCI_DEBUG 1
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
@ -32,6 +32,13 @@ z_cap_t PciReader::GetAhciVmmo() {
|
|||
return new_cap;
|
||||
}
|
||||
|
||||
z_cap_t PciReader::GetXhciVmmo() {
|
||||
uint64_t new_cap;
|
||||
check(ZMemoryObjectDuplicate(gBootPciVmmoCap, xhci_device_offset_,
|
||||
kPcieConfigurationSize, &new_cap));
|
||||
return new_cap;
|
||||
}
|
||||
|
||||
void PciReader::FunctionDump(uint64_t base, uint64_t bus, uint64_t dev,
|
||||
uint64_t fun) {
|
||||
PciDeviceHeader* hdr = PciHeader(base, bus, dev, fun);
|
||||
|
|
@ -55,6 +62,14 @@ void PciReader::FunctionDump(uint64_t base, uint64_t bus, uint64_t dev,
|
|||
#endif
|
||||
achi_device_offset_ = reinterpret_cast<uint64_t>(hdr) - base;
|
||||
}
|
||||
|
||||
if (hdr->class_code == 0xC && hdr->subclass == 0x3) {
|
||||
if (hdr->prog_interface == 0x30) {
|
||||
xhci_device_offset_ = reinterpret_cast<uint64_t>(hdr) - base;
|
||||
} else {
|
||||
dbgln("WARN: Non-XHCI USB Controller found");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PciReader::DeviceDump(uint64_t base, uint64_t bus, uint64_t dev) {
|
||||
|
|
|
|||
|
|
@ -28,11 +28,13 @@ class PciReader {
|
|||
PciReader();
|
||||
|
||||
z_cap_t GetAhciVmmo();
|
||||
z_cap_t GetXhciVmmo();
|
||||
|
||||
private:
|
||||
PciDeviceHeader* header_;
|
||||
|
||||
uint64_t achi_device_offset_ = 0;
|
||||
uint64_t xhci_device_offset_ = 0;
|
||||
|
||||
void PciDump(uint64_t vaddr);
|
||||
void BusDump(uint64_t base, uint64_t bus);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue