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:
1 parent
c0ad63c27f
commit
d36f19509c
160 files changed
+6563
-7366
No files matched your search
@@ -1,8 +1,8 @@
|
||||
#include <ntlite/ddk/module.h>
|
||||
// ATA compatibility storage driver. This file owns legacy IDE probing and PIO disk access for older virtual hardware.
|
||||
|
||||
#include "ata.h"
|
||||
|
||||
const NTL_DDK* gAtaDdk;
|
||||
static DRIVER_OBJECT gAtaDriver;
|
||||
static ATA_CONTROLLER* gAtaControllers[ATA_MAX_CONTROLLERS];
|
||||
static uint32_t gAtaControllerCount;
|
||||
@@ -56,12 +56,12 @@ static void AtaDelay400ns(ATA_CHANNEL* ch) {
|
||||
|
||||
// Returns the monotonic DDK timer in microseconds.
|
||||
static uint64_t AtaQueryTicks(void) {
|
||||
return gAtaDdk->Timer->QueryTicks();
|
||||
return KeQueryTicks();
|
||||
}
|
||||
|
||||
// Delays briefly between ATA status samples without involving the scheduler.
|
||||
static void AtaPollDelay(void) {
|
||||
gAtaDdk->Timer->Stall(ATA_POLL_INTERVAL_US);
|
||||
KeStallExecution(ATA_POLL_INTERVAL_US);
|
||||
}
|
||||
|
||||
// Returns whether a status byte represents an unimplemented/floating legacy channel.
|
||||
@@ -125,9 +125,9 @@ static KSTATUS AtaResetChannel(ATA_CHANNEL* ch) {
|
||||
DbgPrint("ATA: channel %u reset begin status=0x%02x\n", ch->Index, before);
|
||||
|
||||
AtaDeviceControl(ch, ATA_DEVICE_CONTROL_NIEN | ATA_DEVICE_CONTROL_SRST);
|
||||
gAtaDdk->Timer->Stall(ATA_RESET_ASSERT_US);
|
||||
KeStallExecution(ATA_RESET_ASSERT_US);
|
||||
AtaDeviceControl(ch, ATA_DEVICE_CONTROL_NIEN);
|
||||
gAtaDdk->Timer->Stall(ATA_RESET_SETTLE_US);
|
||||
KeStallExecution(ATA_RESET_SETTLE_US);
|
||||
|
||||
uint8_t finalStatus = AtaAltStatus(ch);
|
||||
if (AtaStatusIsAbsent(finalStatus)) {
|
||||
@@ -922,14 +922,11 @@ KSTATUS AtaAddDevice(DRIVER_OBJECT* driver, DEVICE_OBJECT* physicalDeviceObject)
|
||||
return NTLSTATUS_SUCCESS;
|
||||
}
|
||||
|
||||
// Implements the driver Entry operation.
|
||||
KSTATUS DriverEntry(const NTL_DDK* ddk, NTL_DRIVER_INIT* init) {
|
||||
(void)init;
|
||||
if (!ddk || !ddk->Timer || !ddk->Timer->QueryTicks || !ddk->Timer->Stall)
|
||||
return NTLSTATUS_INVALID_PARAMETER;
|
||||
static KSTATUS DriverInitialize(NTL_MODULE* module) {
|
||||
(void)module;
|
||||
|
||||
DbgPrint("ATA: driver loading...\n");
|
||||
gAtaDdk = ddk;
|
||||
|
||||
gAtaControllerCount = 0;
|
||||
|
||||
memset(&gAtaDriver, 0, sizeof(gAtaDriver));
|
||||
@@ -940,9 +937,8 @@ KSTATUS DriverEntry(const NTL_DDK* ddk, NTL_DRIVER_INIT* init) {
|
||||
gAtaDriver.MajorFunction[IRP_MJ_WRITE] = AtaDispatchReadWrite;
|
||||
gAtaDriver.MajorFunction[IRP_MJ_FLUSH_BUFFERS] = AtaDispatchFlush;
|
||||
gAtaDriver.MajorFunction[IRP_MJ_PNP] = AtaDispatchPnp;
|
||||
|
||||
KSTATUS st = IoRegisterDriverObject(&gAtaDriver);
|
||||
if (!KSUCCESS(st))
|
||||
DbgPrint("ATA: IoRegisterDriverObject failed: 0x%x\n", st);
|
||||
return st;
|
||||
return NTLSTATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static DRIVER_OBJECT* const gModuleIoDrivers[] = { &gAtaDriver };
|
||||
NTL_DECLARE_IO_MODULE(DriverInitialize, gModuleIoDrivers);
|
||||
Reference in new issue
Block a user