ReactOS 0.4.17-dev-684-ga6524ef
arbirq.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for arbirq.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS NTAPI IopArbIrqUnpackRequirements (_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor, _Out_ PUINT64 OutMinimumAddress, _Out_ PUINT64 OutMaximumAddress, _Out_ PUINT64 OutLength, _Out_ PUINT64 OutAlignment)
 
NTSTATUS NTAPI IopArbIrqPackResource (_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor, _In_ UINT64 Start, _Out_ PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescriptor)
 
NTSTATUS NTAPI IopArbIrqUnpackResource (_In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescriptor, _Out_ PUINT64 Start, _Out_ PUINT64 OutLength)
 
INT32 NTAPI IopArbIrqScoreRequirement (_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor)
 
NTSTATUS NTAPI IopArbIrqTranslateOrdering (_Out_ PIO_RESOURCE_DESCRIPTOR OutIoDescriptor, _In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor)
 
NTSTATUS NTAPI IopArbIrqInitialize (VOID)
 Initialize the root IRQ arbiter.
 

Variables

ARBITER_INSTANCE IopRootIrqArbiter
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file arbirq.c.

Function Documentation

◆ IopArbIrqInitialize()

NTSTATUS NTAPI IopArbIrqInitialize ( VOID  )

Initialize the root IRQ arbiter.

This is the fallback that sits at the top of the tree and takes over when no closer arbiter claims the request, e.g root-enumerated / HAL legacy devices (ISA-style, directly under the root), and platforms or boot paths where no bus driver above the device provides an interrupt arbiter (e.g. no ACPI _PRT routing in effect).

In those cases the arbitrated "vectors" are the legacy ISA IRQ lines, which is why IopArbIrqTranslateOrdering maps the ordering table through HalGetInterruptVector for the ISA bus. Otherwise, such devices would have nowhere to arbitrate their interrupts. (So this is purely for legacy PIC + No ACPI)

Returns
NTSTATUS
Return values
STATUS_SUCCESS
STATUS_UNSUCCESSFUL
STATUS_INSUFFICIENT_RESOURCES

Definition at line 149 of file arbirq.c.

150{
152
153 PAGED_CODE();
154
155 IopRootIrqArbiter.Name = L"RootIRQ";
160
162 NULL,
165 L"Root",
167 if (!NT_SUCCESS(Status))
168 {
169 DPRINT1("IopArbIrqInitialize: Failed with %X\n", Status);
170 }
171
172 return Status;
173}
#define PAGED_CODE()
ARBITER_INSTANCE IopRootIrqArbiter
Definition: pnpinit.c:24
NTSTATUS NTAPI IopArbIrqPackResource(_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor, _In_ UINT64 Start, _Out_ PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescriptor)
Definition: arbirq.c:41
INT32 NTAPI IopArbIrqScoreRequirement(_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor)
Definition: arbirq.c:76
NTSTATUS NTAPI IopArbIrqUnpackRequirements(_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor, _Out_ PUINT64 OutMinimumAddress, _Out_ PUINT64 OutMaximumAddress, _Out_ PUINT64 OutLength, _Out_ PUINT64 OutAlignment)
Definition: arbirq.c:22
NTSTATUS NTAPI IopArbIrqTranslateOrdering(_Out_ PIO_RESOURCE_DESCRIPTOR OutIoDescriptor, _In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor)
Definition: arbirq.c:87
NTSTATUS NTAPI IopArbIrqUnpackResource(_In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescriptor, _Out_ PUINT64 Start, _Out_ PUINT64 OutLength)
Definition: arbirq.c:61
NTSTATUS NTAPI ArbiterLibInitializeInstance(_Inout_ PARBITER_INSTANCE Arbiter, _In_ PDEVICE_OBJECT BusDeviceObject, _In_ CM_RESOURCE_TYPE ResourceType, _In_ PCWSTR ArbiterName, _In_ PCWSTR OrderName, _In_ PARB_TRANSLATE_ORDERING TranslateOrderingFunction)
Definition: arbiter.c:299
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define L(x)
Definition: resources.c:13
Status
Definition: gdiplustypes.h:24
#define CmResourceTypeInterrupt
Definition: restypes.h:105
PARB_UNPACK_RESOURCE UnpackResource
Definition: arbiter.h:294
PARB_SCORE_REQUIREMENT ScoreRequirement
Definition: arbiter.h:295
PARB_UNPACK_REQUIREMENT UnpackRequirement
Definition: arbiter.h:292
PARB_PACK_RESOURCE PackResource
Definition: arbiter.h:293

Referenced by IopInitializeArbiters().

◆ IopArbIrqPackResource()

NTSTATUS NTAPI IopArbIrqPackResource ( _In_ PIO_RESOURCE_DESCRIPTOR  IoDescriptor,
_In_ UINT64  Start,
_Out_ PCM_PARTIAL_RESOURCE_DESCRIPTOR  CmDescriptor 
)

Definition at line 41 of file arbirq.c.

45{
46 PAGED_CODE();
47
48 CmDescriptor->Type = CmResourceTypeInterrupt;
49 CmDescriptor->ShareDisposition = IoDescriptor->ShareDisposition;
50 CmDescriptor->Flags = IoDescriptor->Flags;
51
52 CmDescriptor->u.Interrupt.Level = (ULONG)Start;
53 CmDescriptor->u.Interrupt.Vector = (ULONG)Start;
54 CmDescriptor->u.Interrupt.Affinity = (KAFFINITY)-1;
55
56 return STATUS_SUCCESS;
57}
static _Out_opt_ PULONGLONG Start
ULONG_PTR KAFFINITY
Definition: compat.h:85
#define STATUS_SUCCESS
Definition: shellext.h:65
uint32_t ULONG
Definition: typedefs.h:59

Referenced by IopArbIrqInitialize().

◆ IopArbIrqScoreRequirement()

INT32 NTAPI IopArbIrqScoreRequirement ( _In_ PIO_RESOURCE_DESCRIPTOR  IoDescriptor)

Definition at line 76 of file arbirq.c.

78{
79 PAGED_CODE();
80
81 return (INT32)(IoDescriptor->u.Interrupt.MaximumVector -
82 IoDescriptor->u.Interrupt.MinimumVector + 1);
83}
int32_t INT32
Definition: typedefs.h:58

Referenced by IopArbIrqInitialize().

◆ IopArbIrqTranslateOrdering()

NTSTATUS NTAPI IopArbIrqTranslateOrdering ( _Out_ PIO_RESOURCE_DESCRIPTOR  OutIoDescriptor,
_In_ PIO_RESOURCE_DESCRIPTOR  IoDescriptor 
)

Definition at line 87 of file arbirq.c.

90{
91 KIRQL Irql;
93
94 PAGED_CODE();
95
96 *OutIoDescriptor = *IoDescriptor;
97
98 if (IoDescriptor->Type != CmResourceTypeInterrupt)
99 return STATUS_SUCCESS;
100
101 OutIoDescriptor->u.Interrupt.MinimumVector =
103 0,
104 IoDescriptor->u.Interrupt.MinimumVector,
105 IoDescriptor->u.Interrupt.MinimumVector,
106 &Irql,
107 &Affinity);
108
109 if (Affinity != 0)
110 {
111 Affinity = 0;
112 OutIoDescriptor->u.Interrupt.MaximumVector =
114 0,
115 IoDescriptor->u.Interrupt.MaximumVector,
116 IoDescriptor->u.Interrupt.MaximumVector,
117 &Irql,
118 &Affinity);
119 }
120
121 if (Affinity == 0)
122 *OutIoDescriptor = *IoDescriptor;
123
124 return STATUS_SUCCESS;
125}
_Out_ PKIRQL Irql
Definition: csq.h:179
NTHALAPI ULONG NTAPI HalGetInterruptVector(INTERFACE_TYPE, ULONG, ULONG, ULONG, PKIRQL, PKAFFINITY)
UCHAR KIRQL
Definition: env_spec_w32.h:591
@ Isa
Definition: restypes.h:122
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
Definition: halfuncs.h:174

Referenced by IopArbIrqInitialize().

◆ IopArbIrqUnpackRequirements()

NTSTATUS NTAPI IopArbIrqUnpackRequirements ( _In_ PIO_RESOURCE_DESCRIPTOR  IoDescriptor,
_Out_ PUINT64  OutMinimumAddress,
_Out_ PUINT64  OutMaximumAddress,
_Out_ PUINT64  OutLength,
_Out_ PUINT64  OutAlignment 
)

Definition at line 22 of file arbirq.c.

28{
29 PAGED_CODE();
30
31 *OutMinimumAddress = IoDescriptor->u.Interrupt.MinimumVector;
32 *OutMaximumAddress = IoDescriptor->u.Interrupt.MaximumVector;
33 *OutLength = 1;
34 *OutAlignment = 1;
35
36 return STATUS_SUCCESS;
37}

Referenced by IopArbIrqInitialize().

◆ IopArbIrqUnpackResource()

NTSTATUS NTAPI IopArbIrqUnpackResource ( _In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR  CmDescriptor,
_Out_ PUINT64  Start,
_Out_ PUINT64  OutLength 
)

Definition at line 61 of file arbirq.c.

65{
66 PAGED_CODE();
67
68 *Start = CmDescriptor->u.Interrupt.Vector;
69 *OutLength = 1;
70
71 return STATUS_SUCCESS;
72}

Referenced by IopArbIrqInitialize().

Variable Documentation

◆ IopRootIrqArbiter

ARBITER_INSTANCE IopRootIrqArbiter
extern

Definition at line 24 of file pnpinit.c.

Referenced by IopArbIrqInitialize().