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.

136 lines
2.5 KiB

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name:
  4. o2m.c
  5. Abstract:
  6. This module contains the code that contains
  7. O2 micro cardbus controller specific initialization and
  8. other dispatches
  9. Author:
  10. Ravisankar Pudipeddi (ravisp) 1-Nov-97
  11. Environment:
  12. Kernel mode
  13. Revision History :
  14. --*/
  15. #include "pch.h"
  16. VOID
  17. O2MInitialize(
  18. IN PFDO_EXTENSION FdoExtension
  19. )
  20. /*++
  21. Routine Description:
  22. Initialize O2Micro controllers
  23. Arguments:
  24. FdoExtension - Pointer to the device extension for the controller FDO
  25. Return Value:
  26. None
  27. --*/
  28. {
  29. UCHAR byte;
  30. USHORT word;
  31. //
  32. // patch for o2micro controllers courtesy of Eric Still ([email protected])
  33. //
  34. byte = PcicReadSocket(FdoExtension->SocketList, 0x3a) | 0xa0;
  35. PcicWriteSocket(FdoExtension->SocketList, 0x3a, byte);
  36. //
  37. // initialize IRQ routing to ISA
  38. //
  39. GetPciConfigSpace(FdoExtension, CFGSPACE_BRIDGE_CTRL, &word, 2);
  40. word |= BCTRL_IRQROUTING_ENABLE;
  41. SetPciConfigSpace(FdoExtension, CFGSPACE_BRIDGE_CTRL, &word, 2);
  42. }
  43. NTSTATUS
  44. O2MSetPower(
  45. IN PSOCKET Socket,
  46. IN BOOLEAN Enable,
  47. OUT PULONG pDelayTime
  48. )
  49. /*++
  50. Routine Description:
  51. Set power to the specified socket.
  52. Arguments:
  53. SocketPtr - the socket to set
  54. Enable - TRUE means to set power - FALSE is to turn it off.
  55. pDelayTime - specifies delay (msec) to occur after the current phase
  56. Return Value:
  57. STATUS_MORE_PROCESSING_REQUIRED - increment phase, perform delay, recall
  58. other status values terminate sequence
  59. --*/
  60. {
  61. NTSTATUS status;
  62. status = CBSetPower(Socket, Enable, pDelayTime);
  63. if (NT_SUCCESS(status) & Enable) {
  64. UCHAR byte;
  65. //
  66. // patch for o2micro controllers courtesy of Eric Still ([email protected])
  67. //
  68. byte = PcicReadSocket(Socket, 0x3a) | 0xa0;
  69. PcicWriteSocket(Socket, 0x3a, byte);
  70. }
  71. return status;
  72. }
  73. BOOLEAN
  74. O2MSetZV(
  75. IN PSOCKET Socket,
  76. IN BOOLEAN Enable
  77. )
  78. {
  79. ULONG oldValue;
  80. if (Enable) {
  81. oldValue = CBReadSocketRegister(Socket, CBREG_O2MICRO_ZVCTRL);
  82. oldValue |= ZVCTRL_ZV_ENABLE;
  83. CBWriteSocketRegister(Socket, CBREG_O2MICRO_ZVCTRL, oldValue);
  84. } else {
  85. oldValue = CBReadSocketRegister(Socket, CBREG_O2MICRO_ZVCTRL);
  86. oldValue &= ~ZVCTRL_ZV_ENABLE;
  87. CBWriteSocketRegister(Socket, CBREG_O2MICRO_ZVCTRL, oldValue);
  88. }
  89. return TRUE;
  90. }