PageRenderTime 41ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/verify/src/Checked/Drivers/Network/Intel/IntelResources.cs

#
C# | 208 lines | 154 code | 38 blank | 16 comment | 0 complexity | d4fc93a595962d39eb1d7217018025d6 MD5 | raw file
  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Microsoft Research Singularity
  4. //
  5. // Copyright (c) Microsoft Corporation. All rights reserved.
  6. //
  7. // #define TYAN_MOTHERBOARD_HACK
  8. using Microsoft.Singularity.Channels;
  9. //using Microsoft.Singularity.Configuration;
  10. using Microsoft.Singularity.Directory;
  11. //using Microsoft.Singularity.Extending;
  12. using Microsoft.Singularity.Io;
  13. using Microsoft.Singularity.Io.Net;
  14. //using Microsoft.SingSharp.Reflection;
  15. using Microsoft.Singularity.Drivers;
  16. using System;
  17. //[assembly: Transform(typeof(DriverResourceTransform))]
  18. namespace Microsoft.Singularity.Drivers.Network.Intel
  19. {
  20. internal enum CardType : int
  21. {
  22. I82541PI,
  23. I82545GM
  24. }
  25. // Common interface for all intel resource classes
  26. internal interface IntelResources
  27. {
  28. IoMemoryRange imr {
  29. get;
  30. }
  31. IoIrqRange irq {
  32. get;
  33. }
  34. string CardName {
  35. get;
  36. }
  37. CardType CardType {
  38. get;
  39. }
  40. TRef/*<ExtensionContract.Exp>*/ ec {
  41. get;
  42. }
  43. TRef/*<ServiceProviderContract.Exp>*/ nicsp {
  44. get;
  45. }
  46. }
  47. #if false
  48. // Intel Pro/1000 GT - 82541 PI
  49. [DriverCategory]
  50. [Signature("pci/ven_8086&dev_107c&cc_0200")]
  51. internal class Intel82541piResources : DriverCategoryDeclaration, IntelResources
  52. {
  53. #if !TYAN_MOTHERBOARD_HACK
  54. [IoMemoryRange(0, Default = 0xfebe0000, Length = 0x20000)]
  55. internal IoMemoryRange imrField;
  56. [IoMemoryRange(1, Default = 0xfebe0000, Length = 0x20000)]
  57. internal IoMemoryRange flashField; // this is unused, but we must declare itres
  58. [IoPortRange(2, Default = 0xec00, Length = 0x40)]
  59. internal IoPortRange ioPortCsrField;
  60. [IoIrqRange(6, Default = 0x05, Shared = true)]
  61. internal IoIrqRange irqField;
  62. #else
  63. [IoMemoryRange(0, Default = 0xb0320000, Length = 0x20000)]
  64. internal IoMemoryRange imrField;
  65. [IoMemoryRange(1, Default = 0xb0300000, Length = 0x20000)]
  66. internal IoMemoryRange flashField; // this is unused, but we must declare itres
  67. [IoPortRange(2, Default = 0x3000, Length = 0x40)]
  68. internal IoPortRange ioPortCsrField;
  69. [IoIrqRange(6, Default = 0x05, Shared = true)]
  70. internal IoIrqRange irqField;
  71. #endif
  72. [ExtensionEndpoint]
  73. internal TRef/*<ExtensionContract.Exp>*/ ecField;
  74. [ServiceEndpoint(typeof(NicDeviceContract))]
  75. internal TRef/*<ServiceProviderContract.Exp>*/ nicspField;
  76. // proerties
  77. public IoMemoryRange imr {
  78. get {
  79. return imrField;
  80. }
  81. }
  82. public IoIrqRange irq {
  83. get{
  84. return irqField;
  85. }
  86. }
  87. public TRef/*<ExtensionContract.Exp>*/ ec {
  88. get{
  89. return ecField;
  90. }
  91. }
  92. public TRef/*<ServiceProviderContract.Exp>*/ nicsp {
  93. get{
  94. return nicspField;
  95. }
  96. }
  97. public string CardName
  98. {
  99. get {
  100. return "82541 PI";
  101. }
  102. }
  103. public CardType CardType
  104. {
  105. get {
  106. return CardType.I82541PI;
  107. }
  108. }
  109. internal int DriverMain(string instance)
  110. {
  111. return IntelController.DriverMain(this);
  112. }
  113. }
  114. // Intel Pro/1000 GT 82545 GM
  115. [DriverCategory]
  116. [Signature("pci/ven_8086&dev_1026&cc_0200")]
  117. internal class Intel82545gmResources : DriverCategoryDeclaration, IntelResources
  118. {
  119. [IoMemoryRange(0, Default = 0xfebe0000, Length = 0x20000)]
  120. internal readonly IoMemoryRange imrField;
  121. [IoMemoryRange(1, Default = 0xfebe0000, Length = 0x10000)]
  122. internal readonly IoMemoryRange flashField; // this is unused, but we must declare itres
  123. [IoPortRange(2, Default = 0xec00, Length = 0x40)]
  124. internal readonly IoPortRange ioPortCsrField;
  125. [IoIrqRange(6, Default = 0x05, Shared = true)]
  126. internal readonly IoIrqRange irqField;
  127. [ExtensionEndpoint]
  128. internal TRef/*<ExtensionContract.Exp>*/ ecField;
  129. [ServiceEndpoint(typeof(NicDeviceContract))]
  130. internal TRef/*<ServiceProviderContract.Exp>*/ nicspField;
  131. // proerties
  132. public IoMemoryRange imr {
  133. get {
  134. return imrField;
  135. }
  136. }
  137. public IoIrqRange irq {
  138. get{
  139. return irqField;
  140. }
  141. }
  142. public TRef/*<ExtensionContract.Exp>*/ ec {
  143. get{
  144. return ecField;
  145. }
  146. }
  147. public TRef/*<ServiceProviderContract.Exp>*/ nicsp {
  148. get{
  149. return nicspField;
  150. }
  151. }
  152. public string CardName
  153. {
  154. get {
  155. return "82545 GM";
  156. }
  157. }
  158. public CardType CardType
  159. {
  160. get {
  161. return CardType.I82545GM;
  162. }
  163. }
  164. internal int DriverMain(string instance)
  165. {
  166. return IntelController.DriverMain(this);
  167. }
  168. }
  169. #endif
  170. }