From 36bf934fbe078dff4c3ad430bb2a355fd8185478 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 14 Jul 2024 14:31:41 +0200 Subject: [PATCH] [NDK][REGEDIT][ROSTESTS:ACPI] Make IO_RESOURCE_REQUIREMENTS_LIST accessible to user mode code - Copy IO_RESOURCE_REQUIREMENTS_LIST to the NDK. - Remove local copies of IO_RESOURCE_REQUIREMENTS_LIST --- base/applications/regedit/edit.c | 112 ----------------- .../acpi/Bus_PDO_QueryResourceRequirements.c | 73 ----------- sdk/include/ndk/iotypes.h | 113 ++++++++++++++++++ 3 files changed, 113 insertions(+), 185 deletions(-) diff --git a/base/applications/regedit/edit.c b/base/applications/regedit/edit.c index 786eefc11b3..3a9d133f9ba 100644 --- a/base/applications/regedit/edit.c +++ b/base/applications/regedit/edit.c @@ -23,118 +23,6 @@ #define NTOS_MODE_USER #include -#if defined(NT_PROCESSOR_GROUPS) - -typedef USHORT IRQ_DEVICE_POLICY, *PIRQ_DEVICE_POLICY; - -enum _IRQ_DEVICE_POLICY_USHORT { - IrqPolicyMachineDefault = 0, - IrqPolicyAllCloseProcessors = 1, - IrqPolicyOneCloseProcessor = 2, - IrqPolicyAllProcessorsInMachine = 3, - IrqPolicyAllProcessorsInGroup = 3, - IrqPolicySpecifiedProcessors = 4, - IrqPolicySpreadMessagesAcrossAllProcessors = 5}; - -#else /* defined(NT_PROCESSOR_GROUPS) */ - -typedef enum _IRQ_DEVICE_POLICY { - IrqPolicyMachineDefault = 0, - IrqPolicyAllCloseProcessors, - IrqPolicyOneCloseProcessor, - IrqPolicyAllProcessorsInMachine, - IrqPolicySpecifiedProcessors, - IrqPolicySpreadMessagesAcrossAllProcessors -} IRQ_DEVICE_POLICY, *PIRQ_DEVICE_POLICY; - -#endif - -typedef enum _IRQ_PRIORITY { - IrqPriorityUndefined = 0, - IrqPriorityLow, - IrqPriorityNormal, - IrqPriorityHigh -} IRQ_PRIORITY, *PIRQ_PRIORITY; -typedef struct _IO_RESOURCE_DESCRIPTOR { - UCHAR Option; - UCHAR Type; - UCHAR ShareDisposition; - UCHAR Spare1; - USHORT Flags; - USHORT Spare2; - union { - struct { - ULONG Length; - ULONG Alignment; - PHYSICAL_ADDRESS MinimumAddress; - PHYSICAL_ADDRESS MaximumAddress; - } Port; - struct { - ULONG Length; - ULONG Alignment; - PHYSICAL_ADDRESS MinimumAddress; - PHYSICAL_ADDRESS MaximumAddress; - } Memory; - struct { - ULONG MinimumVector; - ULONG MaximumVector; -#if defined(NT_PROCESSOR_GROUPS) - IRQ_DEVICE_POLICY AffinityPolicy; - USHORT Group; -#else - IRQ_DEVICE_POLICY AffinityPolicy; -#endif - IRQ_PRIORITY PriorityPolicy; - KAFFINITY TargetedProcessors; - } Interrupt; - struct { - ULONG MinimumChannel; - ULONG MaximumChannel; - } Dma; - struct { - ULONG Length; - ULONG Alignment; - PHYSICAL_ADDRESS MinimumAddress; - PHYSICAL_ADDRESS MaximumAddress; - } Generic; - struct { - ULONG Data[3]; - } DevicePrivate; - struct { - ULONG Length; - ULONG MinBusNumber; - ULONG MaxBusNumber; - ULONG Reserved; - } BusNumber; - struct { - ULONG Priority; - ULONG Reserved1; - ULONG Reserved2; - } ConfigData; - } u; -} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR; - -#define IO_RESOURCE_PREFERRED 0x01 -#define IO_RESOURCE_DEFAULT 0x02 -#define IO_RESOURCE_ALTERNATIVE 0x08 - -typedef struct _IO_RESOURCE_LIST { - USHORT Version; - USHORT Revision; - ULONG Count; - IO_RESOURCE_DESCRIPTOR Descriptors[1]; -} IO_RESOURCE_LIST, *PIO_RESOURCE_LIST; - -typedef struct _IO_RESOURCE_REQUIREMENTS_LIST { - ULONG ListSize; - INTERFACE_TYPE InterfaceType; - ULONG BusNumber; - ULONG SlotNumber; - ULONG Reserved[3]; - ULONG AlternativeLists; - IO_RESOURCE_LIST List[1]; -} IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST; - typedef enum _EDIT_MODE { EDIT_MODE_DEC, diff --git a/modules/rostests/apitests/acpi/Bus_PDO_QueryResourceRequirements.c b/modules/rostests/apitests/acpi/Bus_PDO_QueryResourceRequirements.c index 695e6f0d42a..d9b310e077b 100644 --- a/modules/rostests/apitests/acpi/Bus_PDO_QueryResourceRequirements.c +++ b/modules/rostests/apitests/acpi/Bus_PDO_QueryResourceRequirements.c @@ -12,79 +12,6 @@ #define UNIT_TEST #include -/* Kernel definitions (copied) */ -#define IO_RESOURCE_PREFERRED 0x01 -#define IO_RESOURCE_DEFAULT 0x02 -#define IO_RESOURCE_ALTERNATIVE 0x08 - -typedef struct _IO_RESOURCE_DESCRIPTOR { - UCHAR Option; - UCHAR Type; - UCHAR ShareDisposition; - UCHAR Spare1; - USHORT Flags; - USHORT Spare2; - union { - struct { - ULONG Length; - ULONG Alignment; - PHYSICAL_ADDRESS MinimumAddress; - PHYSICAL_ADDRESS MaximumAddress; - } Port; - struct { - ULONG Length; - ULONG Alignment; - PHYSICAL_ADDRESS MinimumAddress; - PHYSICAL_ADDRESS MaximumAddress; - } Memory; - struct { - ULONG MinimumVector; - ULONG MaximumVector; - } Interrupt; - struct { - ULONG MinimumChannel; - ULONG MaximumChannel; - } Dma; - struct { - ULONG Length; - ULONG Alignment; - PHYSICAL_ADDRESS MinimumAddress; - PHYSICAL_ADDRESS MaximumAddress; - } Generic; - struct { - ULONG Data[3]; - } DevicePrivate; - struct { - ULONG Length; - ULONG MinBusNumber; - ULONG MaxBusNumber; - ULONG Reserved; - } BusNumber; - struct { - ULONG Priority; - ULONG Reserved1; - ULONG Reserved2; - } ConfigData; - } u; -} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR; - -typedef struct _IO_RESOURCE_LIST { - USHORT Version; - USHORT Revision; - ULONG Count; - IO_RESOURCE_DESCRIPTOR Descriptors[1]; -} IO_RESOURCE_LIST, *PIO_RESOURCE_LIST; - -typedef struct _IO_RESOURCE_REQUIREMENTS_LIST { - ULONG ListSize; - INTERFACE_TYPE InterfaceType; - ULONG BusNumber; - ULONG SlotNumber; - ULONG Reserved[3]; - ULONG AlternativeLists; - IO_RESOURCE_LIST List[1]; -} IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST; - /* Kernel definitions (mock) */ #define PAGED_CODE() #define DPRINT1(...) do { if (0) DbgPrint(__VA_ARGS__); } while (0) diff --git a/sdk/include/ndk/iotypes.h b/sdk/include/ndk/iotypes.h index 6f5ef0bbaea..3e78ef20979 100644 --- a/sdk/include/ndk/iotypes.h +++ b/sdk/include/ndk/iotypes.h @@ -278,6 +278,119 @@ typedef enum _BUS_DATA_TYPE MaximumBusDataType } BUS_DATA_TYPE, *PBUS_DATA_TYPE; +#if defined(NT_PROCESSOR_GROUPS) + +typedef USHORT IRQ_DEVICE_POLICY, *PIRQ_DEVICE_POLICY; + +enum _IRQ_DEVICE_POLICY_USHORT { + IrqPolicyMachineDefault = 0, + IrqPolicyAllCloseProcessors = 1, + IrqPolicyOneCloseProcessor = 2, + IrqPolicyAllProcessorsInMachine = 3, + IrqPolicyAllProcessorsInGroup = 3, + IrqPolicySpecifiedProcessors = 4, + IrqPolicySpreadMessagesAcrossAllProcessors = 5}; + +#else /* defined(NT_PROCESSOR_GROUPS) */ + +typedef enum _IRQ_DEVICE_POLICY { + IrqPolicyMachineDefault = 0, + IrqPolicyAllCloseProcessors, + IrqPolicyOneCloseProcessor, + IrqPolicyAllProcessorsInMachine, + IrqPolicySpecifiedProcessors, + IrqPolicySpreadMessagesAcrossAllProcessors +} IRQ_DEVICE_POLICY, *PIRQ_DEVICE_POLICY; + +#endif + +typedef enum _IRQ_PRIORITY { + IrqPriorityUndefined = 0, + IrqPriorityLow, + IrqPriorityNormal, + IrqPriorityHigh +} IRQ_PRIORITY, *PIRQ_PRIORITY; + +#define IO_RESOURCE_PREFERRED 0x01 +#define IO_RESOURCE_DEFAULT 0x02 +#define IO_RESOURCE_ALTERNATIVE 0x08 + +typedef struct _IO_RESOURCE_DESCRIPTOR { + UCHAR Option; + UCHAR Type; + UCHAR ShareDisposition; + UCHAR Spare1; + USHORT Flags; + USHORT Spare2; + union { + struct { + ULONG Length; + ULONG Alignment; + PHYSICAL_ADDRESS MinimumAddress; + PHYSICAL_ADDRESS MaximumAddress; + } Port; + struct { + ULONG Length; + ULONG Alignment; + PHYSICAL_ADDRESS MinimumAddress; + PHYSICAL_ADDRESS MaximumAddress; + } Memory; + struct { + ULONG MinimumVector; + ULONG MaximumVector; +#if defined(NT_PROCESSOR_GROUPS) + IRQ_DEVICE_POLICY AffinityPolicy; + USHORT Group; +#else + IRQ_DEVICE_POLICY AffinityPolicy; +#endif + IRQ_PRIORITY PriorityPolicy; + KAFFINITY TargetedProcessors; + } Interrupt; + struct { + ULONG MinimumChannel; + ULONG MaximumChannel; + } Dma; + struct { + ULONG Length; + ULONG Alignment; + PHYSICAL_ADDRESS MinimumAddress; + PHYSICAL_ADDRESS MaximumAddress; + } Generic; + struct { + ULONG Data[3]; + } DevicePrivate; + struct { + ULONG Length; + ULONG MinBusNumber; + ULONG MaxBusNumber; + ULONG Reserved; + } BusNumber; + struct { + ULONG Priority; + ULONG Reserved1; + ULONG Reserved2; + } ConfigData; + } u; +} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR; + +typedef struct _IO_RESOURCE_LIST { + USHORT Version; + USHORT Revision; + ULONG Count; + IO_RESOURCE_DESCRIPTOR Descriptors[1]; +} IO_RESOURCE_LIST, *PIO_RESOURCE_LIST; + +typedef struct _IO_RESOURCE_REQUIREMENTS_LIST { + ULONG ListSize; + INTERFACE_TYPE InterfaceType; + ULONG BusNumber; + ULONG SlotNumber; + ULONG Reserved[3]; + ULONG AlternativeLists; + IO_RESOURCE_LIST List[1]; +} IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST; + // // File Information Classes for NtQueryInformationFile //