Initialize USB controllers from Usb instead of Pci

This commit is contained in:
josh committed 2023-10-24 10:44:48 -04:00
1 parent f8f9b72588
commit e357f2ba44
4 files changed
+38 -48

No files matched your search

+9 -48
View File
@@ -14,22 +14,28 @@ import hulk.list;
struct Pci
{
/* IO address for PCI configuration address. */
/** IO address for PCI configuration address. */
enum IO_ADDR_CONFIG_ADDRESS = 0xCF8u;
/* IO address for PCI configuration data. */
/** IO address for PCI configuration data. */
enum IO_ADDR_CONFIG_DATA = 0xCFCu;
/** Maximum number of devices on a bus. */
enum MAX_DEVICES_PER_BUS = 32;
/** Maximum number of functions on a devices. */
enum MAX_FUNCTIONS_PER_DEVICE = 8;
/** XHCI controller device type. */
enum XHCI_CONTROLLER = Type(0x0Cu, 0x03u, 0x30u);
/**
* PCI device address (bus number, device number, function number).
*/
struct Address
{
uint address;
alias address this;
this(ubyte bus_nr, ubyte device_nr, ubyte function_nr)
{
@@ -67,6 +73,7 @@ struct Pci
struct Type
{
uint type;
alias type this;
this(ubyte class_id, ubyte subclass_id, ubyte interface_id)
{
@@ -125,8 +132,6 @@ struct Pci
{
map_memory_regions();
}
spawn_device_instance();
}
private void map_memory_regions()
@@ -193,50 +198,6 @@ struct Pci
}
}
}
private void spawn_device_instance()
{
switch (config.class_id)
{
case SerialBusController.ID:
switch (config.subclass_id)
{
case SerialBusController.USBController.ID:
switch (config.interface_id)
{
case SerialBusController.USBController.XHCIController.ID:
XHCI.build(&this);
break;
default:
break;
}
break;
default:
break;
}
break;
default:
break;
}
}
}
struct SerialBusController
{
enum ID = 0x0Cu;
struct USBController
{
enum ID = 0x03u;
struct XHCIController
{
enum ID = 0x30u;
}
}
}
/**