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.

126 lines
2.6 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. ixphwsup.c
  5. Abstract:
  6. This module contains the IopXxx routines for the NT I/O system that
  7. are hardware dependent. Were these routines not hardware dependent,
  8. they would normally reside in the internal.c module.
  9. Author:
  10. Darryl E. Havens (darrylh) 11-Apr-1990
  11. Environment:
  12. Kernel mode, local to I/O system
  13. Revision History:
  14. --*/
  15. #include "bootia64.h"
  16. #include "arc.h"
  17. #include "ixfwhal.h"
  18. #if defined(NEC_98)
  19. #include "nec98.h"
  20. #else //NEC_98
  21. #include "eisa.h"
  22. #endif //NEC_98
  23. PADAPTER_OBJECT
  24. IopAllocateAdapter(
  25. IN ULONG MapRegistersPerChannel,
  26. IN PVOID AdapterBaseVa,
  27. IN PVOID ChannelNumber
  28. )
  29. /*++
  30. Routine Description:
  31. This routine allocates and initializes an adapter object to represent an
  32. adapter or a DMA controller on the system. If no map registers are required
  33. then a standalone adapter object is allocated with no master adapter.
  34. If map registers are required, then a master adapter object is used to
  35. allocate the map registers. For Isa systems these registers are really
  36. phyically contiguous memory pages.
  37. Arguments:
  38. MapRegistersPerChannel - Specifies the number of map registers that each
  39. channel provides for I/O memory mapping.
  40. AdapterBaseVa - Address of the the DMA controller.
  41. ChannelNumber - Unused.
  42. Return Value:
  43. The function value is a pointer to the allocate adapter object.
  44. --*/
  45. {
  46. PADAPTER_OBJECT AdapterObject;
  47. CSHORT Size;
  48. UNREFERENCED_PARAMETER( ChannelNumber );
  49. UNREFERENCED_PARAMETER( MapRegistersPerChannel );
  50. //
  51. // Determine the size of the adapter.
  52. //
  53. Size = sizeof( ADAPTER_OBJECT );
  54. //
  55. // Now create the adapter object.
  56. //
  57. AdapterObject = FwAllocateHeap(Size);
  58. //
  59. // If the adapter object was successfully created, then attempt to insert
  60. // it into the the object table.
  61. //
  62. if (AdapterObject) {
  63. RtlZeroMemory(AdapterObject, Size);
  64. //
  65. // Initialize the adapter object itself.
  66. //
  67. AdapterObject->Type = IO_TYPE_ADAPTER;
  68. AdapterObject->Size = Size;
  69. AdapterObject->MapRegistersPerChannel = 0;
  70. AdapterObject->AdapterBaseVa = AdapterBaseVa;
  71. AdapterObject->PagePort = NULL;
  72. AdapterObject->AdapterInUse = FALSE;
  73. } else {
  74. //
  75. // An error was incurred for some reason. Set the return value
  76. // to NULL.
  77. //
  78. return(NULL);
  79. }
  80. return AdapterObject;
  81. }