Windows NT 4.0 source code leak
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.

158 lines
2.7 KiB

5 years ago
  1. /*++
  2. Copyright (c) 1992 Digital Equipment Corporation
  3. Module Name:
  4. ebmapio.c
  5. Abstract:
  6. This maps I/O addresses used by the HAL on Low Cost Alpha (LCA) machines.
  7. Author:
  8. Wim Colgate (DEC) 26-Oct-1993
  9. Originally taken from the Jensen hal code.
  10. Environment:
  11. Kernel mode
  12. Revision History:
  13. --*/
  14. #include "halp.h"
  15. #include "eb66def.h"
  16. //
  17. // Define global data used to locate the EISA control space.
  18. //
  19. PVOID HalpEisaControlBase;
  20. PVOID HalpEisaIntAckBase;
  21. PVOID HalpCMOSRamBase;
  22. BOOLEAN
  23. HalpMapIoSpace (
  24. VOID
  25. )
  26. /*++
  27. Routine Description:
  28. This routine maps the HAL I/O space for a LCA based
  29. system using the Quasi VA.
  30. Arguments:
  31. None.
  32. Return Value:
  33. If the initialization is successfully completed, than a value of TRUE
  34. is returned. Otherwise, a value of FALSE is returned.
  35. --*/
  36. {
  37. PVOID PciIoSpaceBase;
  38. //
  39. // Map the address spaces on the LCA4.
  40. //
  41. HalpLca4MapAddressSpaces();
  42. //
  43. // Map base addresses into QVA space.
  44. //
  45. PciIoSpaceBase = HAL_MAKE_QVA( HalpLca4PciIoPhysical() );
  46. HalpEisaControlBase = PciIoSpaceBase;;
  47. HalpEisaIntAckBase = HAL_MAKE_QVA( HalpLca4PciIntAckPhysical() );
  48. HalpCMOSRamBase = (PVOID)((ULONG)PciIoSpaceBase + CMOS_ISA_PORT_ADDRESS);
  49. //
  50. // Map the real-time clock registers.
  51. //
  52. HalpRtcAddressPort = (PVOID)((ULONG)PciIoSpaceBase + RTC_ISA_ADDRESS_PORT);
  53. HalpRtcDataPort = (PVOID)((ULONG)PciIoSpaceBase + RTC_ISA_DATA_PORT);
  54. return TRUE;
  55. }
  56. ULONG
  57. HalpMapDebugPort(
  58. IN ULONG ComPort,
  59. OUT PULONG ReadQva,
  60. OUT PULONG WriteQva
  61. )
  62. /*++
  63. Routine Description:
  64. This routine maps the debug com port so that the kernel debugger
  65. may function - if called it is called very earlier in the boot sequence.
  66. Arguments:
  67. ComPort - Supplies the number of the com port to use as the debug port.
  68. ReadQva - Receives the QVA used to access the read registers of the debug
  69. port.
  70. WriteQva - Receives the QVA used to access the write registers of the
  71. debug port.
  72. Return Value:
  73. Returns the base bus address of the device used as the debug port.
  74. --*/
  75. {
  76. ULONG ComPortAddress;
  77. ULONG PortQva;
  78. //
  79. // Compute the port address, based on the desired com port.
  80. //
  81. switch( ComPort ){
  82. case 1:
  83. ComPortAddress = COM1_ISA_PORT_ADDRESS;
  84. break;
  85. case 2:
  86. default:
  87. ComPortAddress = COM2_ISA_PORT_ADDRESS;
  88. }
  89. //
  90. // Map the address spaces on the LCA4.
  91. //
  92. HalpLca4MapAddressSpaces();
  93. //
  94. // Return the QVAs for read and write access.
  95. //
  96. PortQva = (ULONG)(HAL_MAKE_QVA(HalpLca4PciIoPhysical())) + ComPortAddress;
  97. *ReadQva = PortQva;
  98. *WriteQva = PortQva;
  99. return ComPortAddress;
  100. }