Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
2.1 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. mpirql.c
  5. Abstract:
  6. This module implements support for int<->vector translation.
  7. Author:
  8. Forrest Foltz (forrestf) 1-Dec-2000
  9. Environment:
  10. Kernel mode only.
  11. Revision History:
  12. --*/
  13. #include "halcmn.h"
  14. #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
  15. #define NUM_VECTORS 0x100
  16. typedef struct _VECTOR_INIT {
  17. ULONG Vector;
  18. KIRQL Irql;
  19. } VECTOR_INIT, *PVECTOR_INIT;
  20. VECTOR_INIT HalpVectorInit[] = {
  21. { ZERO_VECTOR, 0 },
  22. { APC_VECTOR, APC_LEVEL },
  23. { DPC_VECTOR, DISPATCH_LEVEL },
  24. { APIC_GENERIC_VECTOR, PROFILE_LEVEL },
  25. { APIC_CLOCK_VECTOR, CLOCK_LEVEL },
  26. { APIC_IPI_VECTOR, IPI_LEVEL },
  27. { POWERFAIL_VECTOR, POWER_LEVEL }
  28. };
  29. //
  30. // HalpVectorToIRQL maps interrupt vectors to NT IRQLs
  31. //
  32. KIRQL HalpVectorToIRQL[NUM_VECTORS];
  33. //
  34. // HalpVectorToINTI maps interrupt vector to EISA interrupt level
  35. // on a per-node (cluster) basis. This can be thought of as a
  36. // two-dimensional array.
  37. //
  38. USHORT HalpVectorToINTI[MAX_NODES * NUM_VECTORS];
  39. VOID
  40. HalpInitializeIrqlTables (
  41. VOID
  42. )
  43. /*++
  44. Routine Description:
  45. This routine is responsible for initializing the HalpVectorToINTI[] and
  46. HalpVectorToIRQL[] tables, based on the contents of the HalpVectorInit[]
  47. array.
  48. Arguments:
  49. None.
  50. Return Value:
  51. None.
  52. --*/
  53. {
  54. ULONG count;
  55. PVECTOR_INIT vectorInit;
  56. //
  57. // Initialize every element of HalpVectorToINTI to 0xFFFF
  58. //
  59. for (count = 0; count < ARRAY_SIZE(HalpVectorToINTI); count++) {
  60. HalpVectorToINTI[count] = 0xFFFF;
  61. }
  62. //
  63. // Build HalpVectorToIrql based on the contents of HalpVectorInit.
  64. // Any unused entries are initialized to (KIRQL)0xFF.
  65. //
  66. for (count = 0; count < ARRAY_SIZE(HalpVectorToIRQL); count++) {
  67. HalpVectorToIRQL[count] = (KIRQL)0xFF;
  68. }
  69. for (count = 0; count < ARRAY_SIZE(HalpVectorInit); count++) {
  70. vectorInit = &HalpVectorInit[count];
  71. HalpVectorToIRQL[vectorInit->Vector] = vectorInit->Irql;
  72. }
  73. }