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.

86 lines
2.1 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. dynsysres.c
  5. Abstract:
  6. This module contain functions which support dynamic system
  7. resources e.g. processors, memory, and I/O. Among other things,
  8. it will contain code necessary to configure the OS for the
  9. 'capacity' of a partition rather than the boot resources.
  10. Author:
  11. Adam Glass
  12. Environment:
  13. Kernel mode only.
  14. Revision History:
  15. --*/
  16. #include "halp.h"
  17. #include "acpitabl.h"
  18. #include "xxacpi.h"
  19. #if defined(_WIN64) && !defined(_AMD64_)
  20. #define HalpGetAcpiTablePhase0 HalpGetAcpiTable
  21. #endif
  22. PHYSICAL_ADDRESS HalpMaxHotPlugMemoryAddress;
  23. VOID
  24. HalpGetHotPlugMemoryInfo(
  25. IN PLOADER_PARAMETER_BLOCK LoaderBlock
  26. )
  27. {
  28. PHYSICAL_ADDRESS Extent;
  29. PACPI_SRAT_ENTRY SratEntry;
  30. PACPI_SRAT_ENTRY SratEnd;
  31. PACPI_SRAT SratTable;
  32. SratTable = HalpGetAcpiTablePhase0(LoaderBlock, ACPI_SRAT_SIGNATURE);
  33. if (SratTable == NULL) {
  34. return;
  35. }
  36. //
  37. // The Static Resource Affinity Table (SRAT) exists.
  38. //
  39. // Scan it to determine if there are any hot plug memory regions.
  40. //
  41. SratEnd = (PACPI_SRAT_ENTRY)(((PUCHAR)SratTable) +
  42. SratTable->Header.Length);
  43. for (SratEntry = (PACPI_SRAT_ENTRY)(SratTable + 1);
  44. SratEntry < SratEnd;
  45. SratEntry = (PACPI_SRAT_ENTRY)(((PUCHAR) SratEntry) + SratEntry->Length)) {
  46. switch (SratEntry->Type) {
  47. case SratMemory:
  48. Extent.QuadPart = SratEntry->MemoryAffinity.Base.QuadPart +
  49. SratEntry->MemoryAffinity.Length;
  50. if (SratEntry->MemoryAffinity.Flags.HotPlug &&
  51. SratEntry->MemoryAffinity.Flags.Enabled &&
  52. (Extent.QuadPart > HalpMaxHotPlugMemoryAddress.QuadPart)) {
  53. HalpMaxHotPlugMemoryAddress = Extent;
  54. }
  55. break;
  56. }
  57. }
  58. }
  59. VOID
  60. HalpDynamicSystemResourceConfiguration(
  61. IN PLOADER_PARAMETER_BLOCK LoaderBlock
  62. )
  63. {
  64. HalpGetHotPlugMemoryInfo(LoaderBlock);
  65. }