replace ad hoc driver loading with a proper driver manager, new DDK, new PnP manager with device matching, asynchronous startup, resource ownership and removal, add shared PCI capability helpers, replace typed, rigid services with a proper service manager, implement proper system shutdown and restart, shutting down unloads drivers and shuts down services, add simple power button, remove heavyweight boot self-tests and SMP stress runs, add monotonic timestamps to kernel debug output, fruitless USB and PS/2 fixes, make test builds opt in.

This commit is contained in:
maksw committed 2026-10-26 10:08:03 +01:00
1 parent c0ad63c27f
commit d36f19509c
160 files changed
+6563 -7366

No files matched your search

+23
View File
@@ -11,6 +11,8 @@ KSTATUS XhciSetConfiguration(XHCI_CONTROLLER* xhci, XHCI_DEVICE* dev,
setup.wIndex = 0;
setup.wLength = 0;
DbgPrint("usb-stage: slot=%u SET_CONFIGURATION begin value=%u\n",
dev->SlotId, configurationValue);
KSTATUS st = XhciControlNoData(xhci, dev, &setup);
if (!KSUCCESS(st)) {
DbgPrint("usb: SET_CONFIGURATION slot=%u value=%u failed st=0x%x\n",
@@ -20,6 +22,8 @@ KSTATUS XhciSetConfiguration(XHCI_CONTROLLER* xhci, XHCI_DEVICE* dev,
dev->ConfigurationValue = configurationValue;
dev->Configured = true;
DbgPrint("usb-stage: slot=%u SET_CONFIGURATION done value=%u\n",
dev->SlotId, configurationValue);
UsbTrace("usb: SET_CONFIGURATION slot=%u value=%u complete\n",
dev->SlotId, configurationValue);
return NTLSTATUS_SUCCESS;
@@ -220,6 +224,7 @@ KSTATUS XhciDiscoverAndSetConfiguration(XHCI_CONTROLLER* xhci, XHCI_DEVICE* dev,
USB_CONFIGURATION_DESCRIPTOR config;
memset(&config, 0, sizeof(config));
uint16_t totalLength = 0;
DbgPrint("usb-stage: slot=%u GET_CONFIGURATION begin\n", dev->SlotId);
KSTATUS st = XhciGetConfigurationDescriptor(xhci, dev, 0, &config, &totalLength);
if (!KSUCCESS(st)) {
DbgPrint("usb: slot=%u configuration descriptor read failed st=0x%x\n",
@@ -227,6 +232,8 @@ KSTATUS XhciDiscoverAndSetConfiguration(XHCI_CONTROLLER* xhci, XHCI_DEVICE* dev,
return st;
}
DbgPrint("usb-stage: slot=%u GET_CONFIGURATION done total=%u value=%u\n",
dev->SlotId, totalLength, config.bConfigurationValue);
XhciLogConfigurationTree(xhci, dev, &config, totalLength);
if (config.bConfigurationValue == 0) {
@@ -239,6 +246,7 @@ KSTATUS XhciDiscoverAndSetConfiguration(XHCI_CONTROLLER* xhci, XHCI_DEVICE* dev,
if (!KSUCCESS(st)) return st;
if (!dev->UsbPdo) {
DbgPrint("usb-stage: slot=%u PDO creation begin\n", dev->SlotId);
st = UsbCreateDevicePdo(&xhci->Hcd, dev,
dev->ParentDeviceObject ? dev->ParentDeviceObject :
(xhci->Hcd.RootHubPdo ? xhci->Hcd.RootHubPdo : xhci->Hcd.ControllerDevice));
@@ -246,6 +254,7 @@ KSTATUS XhciDiscoverAndSetConfiguration(XHCI_CONTROLLER* xhci, XHCI_DEVICE* dev,
DbgPrint("usb: create device PDO slot=%u failed st=0x%x\n", dev->SlotId, st);
return st;
}
DbgPrint("usb-stage: slot=%u PDO creation done\n", dev->SlotId);
}
return NTLSTATUS_SUCCESS;
@@ -286,8 +295,14 @@ static KSTATUS XhciEnumeratePathEx(XHCI_CONTROLLER* xhci,
if (!xhci || !path || path->RootPort == 0)
return NTLSTATUS_INVALID_PARAMETER;
DbgPrint("usb-stage: hcd=%02x:%02x.%u root=%u hub-slot=%u hub-port=%u enable-slot begin\n",
xhci->Bus, xhci->Dev, xhci->Fn, path->RootPort,
path->BehindHub ? path->ParentHubSlot : 0,
path->BehindHub ? path->ParentHubPort : 0);
uint8_t slotId = 0;
KSTATUS st = XhciEnableSlot(xhci, &slotId);
DbgPrint("usb-stage: hcd=%02x:%02x.%u enable-slot done st=0x%x slot=%u\n",
xhci->Bus, xhci->Dev, xhci->Fn, st, slotId);
if (!KSUCCESS(st)) return st;
XHCI_DEVICE* dev = &xhci->Devices[slotId];
@@ -307,7 +322,11 @@ static KSTATUS XhciEnumeratePathEx(XHCI_CONTROLLER* xhci,
XhciBuildDefaultControlContext(xhci, dev);
DbgPrint("usb-stage: hcd=%02x:%02x.%u slot=%u address-device begin speed=%u route=%05x\n",
xhci->Bus, xhci->Dev, xhci->Fn, slotId, speed, path->RouteString);
st = XhciAddressDevice(xhci, dev);
DbgPrint("usb-stage: hcd=%02x:%02x.%u slot=%u address-device done st=0x%x\n",
xhci->Bus, xhci->Dev, xhci->Fn, slotId, st);
if (!KSUCCESS(st)) {
XhciRollbackEnumeratedSlot(xhci, slotId);
return st;
@@ -316,7 +335,11 @@ static KSTATUS XhciEnumeratePathEx(XHCI_CONTROLLER* xhci,
USB_DEVICE_DESCRIPTOR desc;
memset(&desc, 0, sizeof(desc));
DbgPrint("usb-stage: hcd=%02x:%02x.%u slot=%u get-device-descriptor begin\n",
xhci->Bus, xhci->Dev, xhci->Fn, slotId);
st = XhciGetDeviceDescriptorTimeout(xhci, dev, &desc, USB_XHCI_ENUM_CONTROL_TIMEOUT_US);
DbgPrint("usb-stage: hcd=%02x:%02x.%u slot=%u get-device-descriptor done st=0x%x\n",
xhci->Bus, xhci->Dev, xhci->Fn, slotId, st);
if (!KSUCCESS(st)) {
DbgPrint("usb: port %u slot %u descriptor read failed st=0x%x\n",
logicalPort, slotId, st);