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.

122 lines
2.5 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 "bootx86.h"
  16. #include "arc.h"
  17. #include "ixfwhal.h"
  18. #include "eisa.h"
  19. PADAPTER_OBJECT
  20. IopAllocateAdapter(
  21. IN ULONG MapRegistersPerChannel,
  22. IN PVOID AdapterBaseVa,
  23. IN PVOID ChannelNumber
  24. )
  25. /*++
  26. Routine Description:
  27. This routine allocates and initializes an adapter object to represent an
  28. adapter or a DMA controller on the system. If no map registers are required
  29. then a standalone adapter object is allocated with no master adapter.
  30. If map registers are required, then a master adapter object is used to
  31. allocate the map registers. For Isa systems these registers are really
  32. phyically contiguous memory pages.
  33. Arguments:
  34. MapRegistersPerChannel - Specifies the number of map registers that each
  35. channel provides for I/O memory mapping.
  36. AdapterBaseVa - Address of the the DMA controller.
  37. ChannelNumber - Unused.
  38. Return Value:
  39. The function value is a pointer to the allocate adapter object.
  40. --*/
  41. {
  42. PADAPTER_OBJECT AdapterObject;
  43. CSHORT Size;
  44. UNREFERENCED_PARAMETER( MapRegistersPerChannel );
  45. UNREFERENCED_PARAMETER( ChannelNumber );
  46. //
  47. // Determine the size of the adapter.
  48. //
  49. Size = sizeof( ADAPTER_OBJECT );
  50. //
  51. // Now create the adapter object.
  52. //
  53. AdapterObject = FwAllocateHeap(Size);
  54. //
  55. // If the adapter object was successfully created, then attempt to insert
  56. // it into the the object table.
  57. //
  58. if (AdapterObject) {
  59. RtlZeroMemory(AdapterObject, Size);
  60. //
  61. // Initialize the adapter object itself.
  62. //
  63. AdapterObject->Type = IO_TYPE_ADAPTER;
  64. AdapterObject->Size = Size;
  65. AdapterObject->MapRegistersPerChannel = 0;
  66. AdapterObject->AdapterBaseVa = AdapterBaseVa;
  67. AdapterObject->PagePort = NULL;
  68. AdapterObject->AdapterInUse = FALSE;
  69. } else {
  70. //
  71. // An error was incurred for some reason. Set the return value
  72. // to NULL.
  73. //
  74. return(NULL);
  75. }
  76. return AdapterObject;
  77. }