add system time, clean up pci into pci.sys, clean up syscall names, fix USERAPC1 typo

This commit is contained in:
maksw committed 2026-06-11 18:11:59 +02:00
1 parent c1a291c4c9
commit e41bf6e2c0
64 files changed
+4514 -2220

No files matched your search

+20 -29
View File
@@ -8,6 +8,8 @@
#include <intrin.h>
#include <ntlite/ddi/hal_api.h>
#include <ntlite/ddi/io_driver.h>
#include <ntlite/ddi/pci.h>
#include <ntlite/status.h>
#include <kernel/ke_debug.h>
#include <kernel/ke_irq.h>
@@ -20,12 +22,7 @@
#define RTL8139_VENDOR_REALTEK 0x10ECu
#define RTL8139_DEVICE_ID 0x8139u
#define PCI_REG_COMMAND 0x04u
#define PCI_REG_BAR0 0x10u
#define PCI_COMMAND_IO (1u << 0)
#define PCI_COMMAND_MEMORY (1u << 1)
#define PCI_COMMAND_MASTER (1u << 2)
#define PCI_COMMAND_INTX_DISABLE (1u << 10)
#define RTL8139_DEVICE_MAGIC 0x81390001u
#define RTL8139_REG_IDR0 0x00u
#define RTL8139_REG_MAR0 0x08u
@@ -91,30 +88,29 @@
#define RTL8139_RX_ALLOC_SIZE (RTL8139_RX_RING_SIZE + RTL8139_RX_PAD + RTL8139_RX_GUARD)
#define RTL8139_RX_PAGES ((RTL8139_RX_ALLOC_SIZE + 4095u) / 4096u)
#define RTL8139_TX_PAGES (((RTL8139_TX_SLOTS * RTL8139_TX_BUF_SIZE) + 4095u) / 4096u)
#define RTL8139_MMIO_PAGES 1u
#define RTL8139_RX_WIRE_MAX (NET_ETHERNET_MAX_FRAME + 4u)
#define RTL8139_RX_WIRE_MAX (NET_ETHERNET_MAX_FRAME + 4u)
#define RTL8139_REG_TSD(slot) (RTL8139_REG_TSD0 + ((slot) * 4u))
#define RTL8139_REG_TSAD(slot) (RTL8139_REG_TSAD0 + ((slot) * 4u))
typedef enum RTL8139_BAR_KIND {
Rtl8139BarNone = 0,
Rtl8139BarIo,
Rtl8139BarMmio,
} RTL8139_BAR_KIND;
typedef struct RTL8139_BAR {
RTL8139_BAR_KIND Kind;
uint64_t Base;
uint8_t Index;
} RTL8139_BAR;
#define RTL8139_MAX_DEVICES 8u
typedef struct RTL8139_DEVICE {
uint8_t Bus;
uint8_t Dev;
uint8_t Fn;
uint32_t Magic;
DEVICE_OBJECT* Fdo;
DEVICE_OBJECT* Pdo;
DEVICE_OBJECT* LowerDevice;
PCI_DEVICE_INFO PciInfo;
PCI_BAR RegisterBar;
uint64_t RegisterBytes;
uint8_t Irq;
bool Started;
bool Removed;
bool SurpriseRemoved;
bool UseMmio;
volatile uint8_t* Mmio;
uint16_t IoBase;
@@ -134,12 +130,7 @@ typedef struct RTL8139_DEVICE {
NET_DEVICE NetDevice;
} RTL8139_DEVICE;
extern const HAL_API* gHal;
extern RTL8139_DEVICE gDevice;
extern bool gDevicePresent;
bool Rtl8139ReadBar(uint8_t bus, uint8_t dev, uint8_t fn, uint8_t index, RTL8139_BAR* out);
KSTATUS Rtl8139MapMmio(uint64_t physBase, volatile uint8_t** outMmio);
KSTATUS Rtl8139SelectRegisterBar(RTL8139_DEVICE* r);
void Rtl8139EnablePci(RTL8139_DEVICE* r);
KSTATUS Rtl8139AddDevice(DRIVER_OBJECT* driver, DEVICE_OBJECT* physicalDeviceObject);
KSTATUS Rtl8139DispatchPnp(DEVICE_OBJECT* device, IRP* irp);