ReactOS 0.4.16-dev-2491-g3dc6630
usage.c File Reference
#include <hal.h>
Include dependency graph for usage.c:

Go to the source code of this file.

Functions

VOID NTAPI HalpGetResourceSortValue (IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, OUT PULONG Scale, OUT PLARGE_INTEGER Value)
 
VOID NTAPI HalpBuildPartialFromIdt (IN ULONG Entry, IN PCM_PARTIAL_RESOURCE_DESCRIPTOR RawDescriptor, IN PCM_PARTIAL_RESOURCE_DESCRIPTOR TranslatedDescriptor)
 
VOID NTAPI HalpBuildPartialFromAddress (IN INTERFACE_TYPE Interface, IN PADDRESS_USAGE CurrentAddress, IN ULONG Element, IN PCM_PARTIAL_RESOURCE_DESCRIPTOR RawDescriptor, IN PCM_PARTIAL_RESOURCE_DESCRIPTOR TranslatedDescriptor)
 
VOID NTAPI HalpReportResourceUsage (IN PUNICODE_STRING HalName, IN INTERFACE_TYPE InterfaceType)
 
VOID NTAPI HalpRegisterVector (IN UCHAR Flags, IN ULONG BusVector, IN ULONG SystemVector, IN KIRQL Irql)
 
VOID NTAPI HalpEnableInterruptHandler (IN UCHAR Flags, IN ULONG BusVector, IN ULONG SystemVector, IN KIRQL Irql, IN PVOID Handler, IN KINTERRUPT_MODE Mode)
 
VOID NTAPI HalpGetNMICrashFlag (VOID)
 

Variables

BOOLEAN HalpGetInfoFromACPI
 
BOOLEAN HalpNMIDumpFlag
 
PUCHAR KdComPortInUse
 
PADDRESS_USAGE HalpAddressUsageList
 
IDTUsageFlags HalpIDTUsageFlags [MAXIMUM_IDTVECTOR+1]
 
IDTUsage HalpIDTUsage [MAXIMUM_IDTVECTOR+1]
 
USHORT HalpComPortIrqMapping [][2]
 
ADDRESS_USAGE HalpComIoSpace
 
ADDRESS_USAGE HalpDefaultIoSpace
 

Function Documentation

◆ HalpBuildPartialFromAddress()

VOID NTAPI HalpBuildPartialFromAddress ( IN INTERFACE_TYPE  Interface,
IN PADDRESS_USAGE  CurrentAddress,
IN ULONG  Element,
IN PCM_PARTIAL_RESOURCE_DESCRIPTOR  RawDescriptor,
IN PCM_PARTIAL_RESOURCE_DESCRIPTOR  TranslatedDescriptor 
)

Definition at line 209 of file usage.c.

214{
216
217 /* Set the type and make it exclusive */
218 RawDescriptor->Type = CurrentAddress->Type;
219 RawDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
220
221 /* Check what this is */
222 if (RawDescriptor->Type == CmResourceTypePort)
223 {
224 /* Write out port data */
225 AddressSpace = 1;
226 RawDescriptor->Flags = CM_RESOURCE_PORT_IO;
227 RawDescriptor->u.Port.Start.HighPart = 0;
228 RawDescriptor->u.Port.Start.LowPart = CurrentAddress->Element[Element].Start;
229 RawDescriptor->u.Port.Length = CurrentAddress->Element[Element].Length;
230
231 /* Determine if 16-bit port addresses are allowed */
232 RawDescriptor->Flags |= HalpIs16BitPortDecodeSupported();
233 }
234 else
235 {
236 /* Write out memory data */
237 AddressSpace = 0;
238 RawDescriptor->Flags = (CurrentAddress->Flags & IDT_READ_ONLY) ?
241 RawDescriptor->u.Memory.Start.HighPart = 0;
242 RawDescriptor->u.Memory.Start.LowPart = CurrentAddress->Element[Element].Start;
243 RawDescriptor->u.Memory.Length = CurrentAddress->Element[Element].Length;
244 }
245
246 /* Make an identical copy to begin with */
247 RtlCopyMemory(TranslatedDescriptor, RawDescriptor, sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
248
249 /* Check what this is */
250 if (RawDescriptor->Type == CmResourceTypePort)
251 {
252 /* Translate the port */
254 0,
255 RawDescriptor->u.Port.Start,
257 &TranslatedDescriptor->u.Port.Start);
258
259 /* If it turns out this is memory once translated, flag it */
260 if (AddressSpace == 0) TranslatedDescriptor->Flags = CM_RESOURCE_PORT_MEMORY;
261
262 }
263 else
264 {
265 /* Translate the memory */
267 0,
268 RawDescriptor->u.Memory.Start,
270 &TranslatedDescriptor->u.Memory.Start);
271 }
272}
BOOLEAN NTAPI HalTranslateBusAddress(IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber, IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress)
Definition: bus.c:140
ULONG NTAPI HalpIs16BitPortDecodeSupported(VOID)
Definition: halacpi.c:1012
#define IDT_READ_ONLY
Definition: halp.h:60
#define CM_RESOURCE_PORT_MEMORY
Definition: cmtypes.h:108
#define CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
#define CM_RESOURCE_MEMORY_READ_ONLY
Definition: cmtypes.h:122
#define CM_RESOURCE_MEMORY_READ_WRITE
Definition: cmtypes.h:121
#define CmResourceTypePort
Definition: restypes.h:104
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG
Definition: typedefs.h:59
struct _LARGE_INTEGER::@2480 u
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
Definition: wdffdo.h:465
@ CmResourceShareDriverExclusive
Definition: cmtypes.h:242
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
Definition: iofuncs.h:2274

Referenced by HalpReportResourceUsage().

◆ HalpBuildPartialFromIdt()

VOID NTAPI HalpBuildPartialFromIdt ( IN ULONG  Entry,
IN PCM_PARTIAL_RESOURCE_DESCRIPTOR  RawDescriptor,
IN PCM_PARTIAL_RESOURCE_DESCRIPTOR  TranslatedDescriptor 
)

Definition at line 171 of file usage.c.

174{
175 /* Exclusive interrupt entry */
176 RawDescriptor->Type = CmResourceTypeInterrupt;
177 RawDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
178
179 /* Check the interrupt type */
181 {
182 /* Latched */
183 RawDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
184 }
185 else
186 {
187 /* Level */
188 RawDescriptor->Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE;
189 }
190
191 /* Get vector and level from IDT usage */
192 RawDescriptor->u.Interrupt.Vector = HalpIDTUsage[Entry].BusReleativeVector;
193 RawDescriptor->u.Interrupt.Level = HalpIDTUsage[Entry].BusReleativeVector;
194
195 /* Affinity is all the CPUs */
196 RawDescriptor->u.Interrupt.Affinity = HalpActiveProcessors;
197
198 /* The translated copy is identical */
199 RtlCopyMemory(TranslatedDescriptor, RawDescriptor, sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
200
201 /* But the vector and IRQL must be set correctly */
202 TranslatedDescriptor->u.Interrupt.Vector = Entry;
203 TranslatedDescriptor->u.Interrupt.Level = HalpIDTUsage[Entry].Irql;
204}
KAFFINITY HalpActiveProcessors
Definition: processor.c:17
IDTUsageFlags HalpIDTUsageFlags[256]
Definition: usage.c:19
IDTUsage HalpIDTUsage[256]
Definition: usage.c:20
#define IDT_LATCHED
Definition: halp.h:20
#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE
Definition: restypes.h:116
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: restypes.h:117
#define CmResourceTypeInterrupt
Definition: restypes.h:105
base of all file and directory entries
Definition: entries.h:83
UCHAR BusReleativeVector
Definition: halp.h:32
KIRQL Irql
Definition: halp.h:31
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by HalpReportResourceUsage().

◆ HalpEnableInterruptHandler()

VOID NTAPI HalpEnableInterruptHandler ( IN UCHAR  Flags,
IN ULONG  BusVector,
IN ULONG  SystemVector,
IN KIRQL  Irql,
IN PVOID  Handler,
IN KINTERRUPT_MODE  Mode 
)

Definition at line 582 of file usage.c.

588{
589 /* Set the IDT_LATCHED flag for latched interrupts */
590 if (Mode == Latched) Flags |= IDT_LATCHED;
591
592 /* Register the vector */
593 HalpRegisterVector(Flags, BusVector, SystemVector, Irql);
594
595 /* Connect the interrupt */
596 KeRegisterInterruptHandler(SystemVector, Handler);
597
598 /* Enable the interrupt */
599 HalEnableSystemInterrupt(SystemVector, Irql, Mode);
600}
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER Handler
Definition: acpixf.h:672
_Out_ PKIRQL Irql
Definition: csq.h:179
BOOLEAN NTAPI HalEnableSystemInterrupt(IN ULONG Vector, IN KIRQL Irql, IN KINTERRUPT_MODE InterruptMode)
Definition: pic.c:295
VOID NTAPI HalpRegisterVector(IN UCHAR Flags, IN ULONG BusVector, IN ULONG SystemVector, IN KIRQL Irql)
Definition: usage.c:565
_In_ ULONG Mode
Definition: hubbusif.h:303
FORCEINLINE VOID KeRegisterInterruptHandler(IN ULONG Vector, IN PVOID Handler)
Definition: ke.h:303
@ Latched
Definition: miniport.h:81

◆ HalpGetNMICrashFlag()

VOID NTAPI HalpGetNMICrashFlag ( VOID  )

Definition at line 605 of file usage.c.

606{
608 UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\CrashControl");
613 KEY_VALUE_PARTIAL_INFORMATION KeyValueInformation;
614
615 /* Set default */
616 HalpNMIDumpFlag = 0;
617
618 /* Initialize attributes */
620 &KeyName,
622 NULL,
623 NULL);
624
625 /* Open crash key */
626 Status = ZwOpenKey(&Handle, KEY_READ, &ObjectAttributes);
627 if (NT_SUCCESS(Status))
628 {
629 /* Query key value */
630 RtlInitUnicodeString(&ValueName, L"NMICrashDump");
631 Status = ZwQueryValueKey(Handle,
632 &ValueName,
634 &KeyValueInformation,
635 sizeof(KeyValueInformation),
636 &ResultLength);
637 if (NT_SUCCESS(Status))
638 {
639 /* Check for valid data */
641 {
642 /* Read the flag */
643 HalpNMIDumpFlag = KeyValueInformation.Data[0];
644 }
645 }
646
647 /* We're done */
649 }
650}
LONG NTSTATUS
Definition: precomp.h:26
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define RTL_CONSTANT_STRING(s)
Definition: combase.c:35
#define L(x)
Definition: resources.c:13
ULONG Handle
Definition: gdb_input.c:15
Status
Definition: gdiplustypes.h:25
BOOLEAN HalpNMIDumpFlag
Definition: usage.c:15
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
@ KeyValuePartialInformation
Definition: nt_native.h:1185
#define KEY_READ
Definition: nt_native.h:1026
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3782
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2705
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:243

Referenced by HalpInitializePciBus().

◆ HalpGetResourceSortValue()

VOID NTAPI HalpGetResourceSortValue ( IN PCM_PARTIAL_RESOURCE_DESCRIPTOR  Descriptor,
OUT PULONG  Scale,
OUT PLARGE_INTEGER  Value 
)

Definition at line 131 of file usage.c.

134{
135 /* Sorting depends on resource type */
136 switch (Descriptor->Type)
137 {
139
140 /* Interrupt goes by level */
141 *Scale = 0;
142 Value->QuadPart = (LONGLONG)Descriptor->u.Interrupt.Level;
143 break;
144
146
147 /* Port goes by port address */
148 *Scale = 1;
149 *Value = Descriptor->u.Port.Start;
150 break;
151
153
154 /* Memory goes by base address */
155 *Scale = 2;
156 *Value = Descriptor->u.Memory.Start;
157 break;
158
159 default:
160
161 /* Anything else */
162 *Scale = 4;
163 Value->QuadPart = 0LL;
164 break;
165 }
166}
#define CmResourceTypeMemory
Definition: restypes.h:106
#define LL
Definition: tui.h:166
int64_t LONGLONG
Definition: typedefs.h:68
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342

Referenced by HalpReportResourceUsage().

◆ HalpRegisterVector()

VOID NTAPI HalpRegisterVector ( IN UCHAR  Flags,
IN ULONG  BusVector,
IN ULONG  SystemVector,
IN KIRQL  Irql 
)

Definition at line 565 of file usage.c.

569{
570 /* Save the vector flags */
571 HalpIDTUsageFlags[SystemVector].Flags = Flags;
572
573 /* Save the vector data */
574 HalpIDTUsage[SystemVector].Irql = Irql;
575 HalpIDTUsage[SystemVector].BusReleativeVector = (UCHAR)BusVector;
576}
UCHAR Flags
Definition: halp.h:26
unsigned char UCHAR
Definition: xmlstorage.h:181

◆ HalpReportResourceUsage()

VOID NTAPI HalpReportResourceUsage ( IN PUNICODE_STRING  HalName,
IN INTERFACE_TYPE  InterfaceType 
)

Definition at line 277 of file usage.c.

279{
280 PCM_RESOURCE_LIST RawList, TranslatedList;
281 PCM_FULL_RESOURCE_DESCRIPTOR RawFull, TranslatedFull;
282 PCM_PARTIAL_RESOURCE_DESCRIPTOR CurrentRaw, CurrentTranslated, SortedRaw, SortedTranslated;
283 CM_PARTIAL_RESOURCE_DESCRIPTOR RawPartial, TranslatedPartial;
284 PCM_PARTIAL_RESOURCE_LIST RawPartialList = NULL, TranslatedPartialList = NULL;
286 ULONG i, j, k, ListSize, Count, Element, CurrentScale, SortScale, ReportType, FlagMatch;
287 ADDRESS_USAGE *CurrentAddress;
288 LARGE_INTEGER CurrentSortValue, SortValue;
289
290 DbgPrint("%wZ detected\n", HalName);
291
292 /* Check if KD is using a COM port */
293 if (KdComPortInUse)
294 {
295 /* Enter it into the I/O space */
299
300#if defined(SARCH_XBOX)
301 /*
302 * Do not claim interrupt resources for the KD COM port.
303 * The actual COM port lacks SERIRQ, IRQ 4 is hardwired to the NIC.
304 */
305#else
306 /* Use the debug port table if we have one */
308
309 /* Check if we're using ACPI */
311 {
312 /* No, so use our local table */
314 for (i = 0, Port = HalpComPortIrqMapping[i][0];
315 Port;
316 i++, Port = HalpComPortIrqMapping[i][0])
317 {
318 /* Is this the port we want? */
320 {
321 /* Register it */
326 HIGH_LEVEL);
327 }
328 }
329 }
330#endif
331 }
332
333 /* On non-ACPI systems, we need to build an address map */
335
336 /* Allocate the master raw and translated lists */
338 TranslatedList = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE * 2, TAG_HAL);
339 if (!(RawList) || !(TranslatedList))
340 {
341 /* Bugcheck the system */
342 KeBugCheckEx(HAL_MEMORY_ALLOCATION,
343 4 * PAGE_SIZE,
344 1,
345 (ULONG_PTR)__FILE__,
346 __LINE__);
347 }
348
349 /* Zero out the lists */
350 RtlZeroMemory(RawList, PAGE_SIZE * 2);
351 RtlZeroMemory(TranslatedList, PAGE_SIZE * 2);
352
353 /* Set the interface type to begin with */
355
356 /* Loop all IDT entries that are not IRQs */
357 for (i = 0; i < PRIMARY_VECTOR_BASE; i++)
358 {
359 /* Check if the IDT isn't owned */
361 {
362 /* Then register it for internal usage */
365 }
366 }
367
368 /* Our full raw descriptors start here */
369 RawFull = RawList->List;
370
371 /* Keep track of the current partial raw and translated descriptors */
372 CurrentRaw = (PCM_PARTIAL_RESOURCE_DESCRIPTOR)RawList->List;
373 CurrentTranslated = (PCM_PARTIAL_RESOURCE_DESCRIPTOR)TranslatedList->List;
374
375 /* Do two passes */
376 for (ReportType = 0; ReportType < 2; ReportType++)
377 {
378 /* Pass 0 is for device usage */
379 if (ReportType == 0)
380 {
381 FlagMatch = IDT_DEVICE & ~IDT_REGISTERED;
383 }
384 else
385 {
386 /* Past 1 is for internal HAL usage */
387 FlagMatch = IDT_INTERNAL & ~IDT_REGISTERED;
389 }
390
391 /* Reset loop variables */
392 i = Element = 0;
393
394 /* Start looping our address uage list and interrupts */
395 CurrentAddress = HalpAddressUsageList;
396 while (TRUE)
397 {
398 /* Check for valid vector number */
399 if (i <= MAXIMUM_IDTVECTOR)
400 {
401 /* Check if this entry should be parsed */
402 if ((HalpIDTUsageFlags[i].Flags & FlagMatch))
403 {
404 /* Parse it */
405 HalpBuildPartialFromIdt(i, &RawPartial, &TranslatedPartial);
406 i++;
407 }
408 else
409 {
410 /* Skip this entry */
411 i++;
412 continue;
413 }
414 }
415 else
416 {
417 /* This is an address instead */
418 if (!CurrentAddress) break;
419
420 /* Check if the address should be reported */
421 if (!(CurrentAddress->Flags & FlagMatch) ||
422 !(CurrentAddress->Element[Element].Length))
423 {
424 /* Nope, skip it */
425 Element = 0;
426 CurrentAddress = CurrentAddress->Next;
427 continue;
428 }
429
430 /* Otherwise, parse the entry */
432 CurrentAddress,
433 Element,
434 &RawPartial,
435 &TranslatedPartial);
436 Element++;
437 }
438
439 /* Check for interface change */
440 if (RawFull->InterfaceType != Interface)
441 {
442 /* We need to add another full descriptor */
443 RawList->Count++;
444 TranslatedList->Count++;
445
446 /* The full descriptor follows wherever we were */
447 RawFull = (PCM_FULL_RESOURCE_DESCRIPTOR)CurrentRaw;
448 TranslatedFull = (PCM_FULL_RESOURCE_DESCRIPTOR)CurrentTranslated;
449
450 /* And it is of this new interface type */
451 RawFull->InterfaceType = Interface;
452 TranslatedFull->InterfaceType = Interface;
453
454 /* And its partial descriptors begin here */
455 RawPartialList = &RawFull->PartialResourceList;
456 TranslatedPartialList = &TranslatedFull->PartialResourceList;
457
458 /* And our next full descriptor should follow here */
459 CurrentRaw = RawFull->PartialResourceList.PartialDescriptors;
460 CurrentTranslated = TranslatedFull->PartialResourceList.PartialDescriptors;
461 }
462
463 /* We have written a new partial descriptor */
464 RawPartialList->Count++;
465 TranslatedPartialList->Count++;
466
467 /* Copy our local descriptors into the actual list */
468 RtlCopyMemory(CurrentRaw, &RawPartial, sizeof(RawPartial));
469 RtlCopyMemory(CurrentTranslated, &TranslatedPartial, sizeof(TranslatedPartial));
470
471 /* Move to the next partial descriptor */
472 CurrentRaw++;
473 CurrentTranslated++;
474 }
475 }
476
477 /* Get the final list of the size for the kernel call later */
478 ListSize = (ULONG)((ULONG_PTR)CurrentRaw - (ULONG_PTR)RawList);
479
480 /* Now reset back to the first full descriptor */
481 RawFull = RawList->List;
482 TranslatedFull = TranslatedList->List;
483
484 /* And loop all the full descriptors */
485 for (i = 0; i < RawList->Count; i++)
486 {
487 /* Get the first partial descriptor in this list */
488 CurrentRaw = RawFull->PartialResourceList.PartialDescriptors;
489 CurrentTranslated = TranslatedFull->PartialResourceList.PartialDescriptors;
490
491 /* Get the count of partials in this list */
493
494 /* Loop all the partials in this list */
495 for (j = 0; j < Count; j++)
496 {
497 /* Get the sort value at this point */
498 HalpGetResourceSortValue(CurrentRaw, &CurrentScale, &CurrentSortValue);
499
500 /* Save the current sort pointer */
501 SortedRaw = CurrentRaw;
502 SortedTranslated = CurrentTranslated;
503
504 /* Loop all descriptors starting from this one */
505 for (k = j; k < Count; k++)
506 {
507 /* Get the sort value at the sort point */
508 HalpGetResourceSortValue(SortedRaw, &SortScale, &SortValue);
509
510 /* Check if a swap needs to occur */
511 if ((SortScale < CurrentScale) ||
512 ((SortScale == CurrentScale) &&
513 (SortValue.QuadPart <= CurrentSortValue.QuadPart)))
514 {
515 /* Swap raw partial with the sort location partial */
516 RtlCopyMemory(&RawPartial, CurrentRaw, sizeof(RawPartial));
517 RtlCopyMemory(CurrentRaw, SortedRaw, sizeof(RawPartial));
518 RtlCopyMemory(SortedRaw, &RawPartial, sizeof(RawPartial));
519
520 /* Swap translated partial in the same way */
521 RtlCopyMemory(&TranslatedPartial, CurrentTranslated, sizeof(TranslatedPartial));
522 RtlCopyMemory(CurrentTranslated, SortedTranslated, sizeof(TranslatedPartial));
523 RtlCopyMemory(SortedTranslated, &TranslatedPartial, sizeof(TranslatedPartial));
524
525 /* Update the sort value at this point */
526 HalpGetResourceSortValue(CurrentRaw, &CurrentScale, &CurrentSortValue);
527 }
528
529 /* The sort location has been updated */
530 SortedRaw++;
531 SortedTranslated++;
532 }
533
534 /* Move to the next partial */
535 CurrentRaw++;
536 CurrentTranslated++;
537 }
538
539 /* Move to the next full descriptor */
540 RawFull = (PCM_FULL_RESOURCE_DESCRIPTOR)CurrentRaw;
541 TranslatedFull = (PCM_FULL_RESOURCE_DESCRIPTOR)CurrentTranslated;
542 }
543
544 /* Mark this is an ACPI system, if it is */
546
547 /* Tell the kernel about all this */
549 RawList,
550 TranslatedList,
551 ListSize);
552
553 /* Free our lists */
554 ExFreePool(RawList);
555 ExFreePool(TranslatedList);
556
557 /* Get the machine's serial number */
559}
DECLSPEC_NORETURN VOID NTAPI KeBugCheckEx(IN ULONG BugCheckCode, IN ULONG_PTR BugCheckParameter1, IN ULONG_PTR BugCheckParameter2, IN ULONG_PTR BugCheckParameter3, IN ULONG_PTR BugCheckParameter4)
Definition: debug.c:485
#define TRUE
Definition: types.h:120
#define ULONG_PTR
Definition: config.h:101
#define PtrToUlong(u)
Definition: config.h:107
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define HIGH_LEVEL
Definition: env_spec_w32.h:703
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define NonPagedPool
Definition: env_spec_w32.h:307
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define DbgPrint
Definition: hal.h:12
NTSTATUS NTAPI HalpMarkAcpiHal(VOID)
Definition: misc.c:57
VOID NTAPI HalpReportSerialNumber(VOID)
Definition: misc.c:26
BOOLEAN HalpGetInfoFromACPI
Definition: usage.c:14
VOID NTAPI HalpBuildPartialFromIdt(IN ULONG Entry, IN PCM_PARTIAL_RESOURCE_DESCRIPTOR RawDescriptor, IN PCM_PARTIAL_RESOURCE_DESCRIPTOR TranslatedDescriptor)
Definition: usage.c:171
USHORT HalpComPortIrqMapping[][2]
Definition: usage.c:31
VOID NTAPI HalpBuildPartialFromAddress(IN INTERFACE_TYPE Interface, IN PADDRESS_USAGE CurrentAddress, IN ULONG Element, IN PCM_PARTIAL_RESOURCE_DESCRIPTOR RawDescriptor, IN PCM_PARTIAL_RESOURCE_DESCRIPTOR TranslatedDescriptor)
Definition: usage.c:209
PUCHAR KdComPortInUse
Definition: usage.c:16
ADDRESS_USAGE HalpComIoSpace
Definition: usage.c:41
VOID NTAPI HalpGetResourceSortValue(IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, OUT PULONG Scale, OUT PLARGE_INTEGER Value)
Definition: usage.c:131
PADDRESS_USAGE HalpAddressUsageList
Definition: usage.c:17
#define TAG_HAL
Definition: hal.h:61
VOID NTAPI HalpBuildAddressMap(VOID)
Definition: halacpi.c:995
PWCHAR HalName
Definition: halacpi.c:45
BOOLEAN NTAPI HalpGetDebugPortTable(VOID)
Definition: halacpi.c:1003
#define PRIMARY_VECTOR_BASE
Definition: halp.h:16
#define IDT_REGISTERED
Definition: halp.h:19
#define IDT_INTERNAL
Definition: halp.h:21
#define IDT_DEVICE
Definition: halp.h:22
CPPORT Port[4]
Definition: headless.c:38
NTSTATUS NTAPI IoReportHalResourceUsage(_In_ PUNICODE_STRING HalName, _In_ PCM_RESOURCE_LIST RawResourceList, _In_ PCM_RESOURCE_LIST TranslatedResourceList, _In_ ULONG ResourceListSize)
Reports hardware resources of the HAL in the \Registry\Machine\Hardware\ResourceMap tree.
Definition: iorsrce.c:1321
int k
Definition: mpi.c:3369
#define MAXIMUM_IDTVECTOR
Definition: ketypes.h:346
int Count
Definition: noreturn.cpp:7
struct _CM_FULL_RESOURCE_DESCRIPTOR * PCM_FULL_RESOURCE_DESCRIPTOR
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR * PCM_PARTIAL_RESOURCE_DESCRIPTOR
@ InterfaceTypeUndefined
Definition: restypes.h:120
@ Internal
Definition: restypes.h:121
enum _INTERFACE_TYPE INTERFACE_TYPE
CM_PARTIAL_RESOURCE_LIST PartialResourceList
Definition: restypes.h:144
INTERFACE_TYPE InterfaceType
Definition: restypes.h:142
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: restypes.h:100
CM_FULL_RESOURCE_DESCRIPTOR List[1]
Definition: restypes.h:149
struct _HalAddressUsage * Next
Definition: halp.h:202
UCHAR Flags
Definition: halp.h:204
struct _HalAddressUsage::@1636 Element[]
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
LONGLONG QuadPart
Definition: typedefs.h:114
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID InterfaceType
Definition: wdffdo.h:463

Variable Documentation

◆ HalpAddressUsageList

PADDRESS_USAGE HalpAddressUsageList

Definition at line 17 of file usage.c.

Referenced by HalInitSystem(), and HalpReportResourceUsage().

◆ HalpComIoSpace

ADDRESS_USAGE HalpComIoSpace
Initial value:
=
{
{
{0x2F8, 0x8},
{0, 0}
}
}

Definition at line 41 of file usage.c.

Referenced by HalpReportResourceUsage().

◆ HalpComPortIrqMapping

USHORT HalpComPortIrqMapping[][2]
Initial value:
=
{
{0x3F8, 4},
{0x2F8, 3},
{0x3E8, 4},
{0x2E8, 3},
{0, 0}
}

Definition at line 31 of file usage.c.

Referenced by HalpReportResourceUsage().

◆ HalpDefaultIoSpace

ADDRESS_USAGE HalpDefaultIoSpace

Definition at line 51 of file usage.c.

Referenced by HalInitSystem().

◆ HalpGetInfoFromACPI

BOOLEAN HalpGetInfoFromACPI

Definition at line 14 of file usage.c.

Referenced by HalpReportResourceUsage().

◆ HalpIDTUsage

IDTUsage HalpIDTUsage[MAXIMUM_IDTVECTOR+1]

Definition at line 19 of file usage.c.

◆ HalpIDTUsageFlags

IDTUsageFlags HalpIDTUsageFlags[MAXIMUM_IDTVECTOR+1]

Definition at line 18 of file usage.c.

◆ HalpNMIDumpFlag

BOOLEAN HalpNMIDumpFlag

Definition at line 15 of file usage.c.

Referenced by HalpGetNMICrashFlag().

◆ KdComPortInUse

PUCHAR KdComPortInUse

Definition at line 16 of file usage.c.