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

/base/Kernel/Singularity/Io/PnpConfig.cs

#
C# | 83 lines | 60 code | 10 blank | 13 comment | 11 complexity | 80b35ddf56f7b117a7e7f3a51ad5fd50 MD5 | raw file
  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Microsoft Research Singularity
  4. //
  5. // Copyright (c) Microsoft Corporation. All rights reserved.
  6. //
  7. // File: PnpConfig.cs
  8. //
  9. // Note:
  10. //
  11. using System;
  12. using System.Text;
  13. using System.Collections;
  14. using Microsoft.Singularity;
  15. namespace Microsoft.Singularity.Io
  16. {
  17. [CLSCompliant(false)]
  18. public class PnpConfig : IoConfig
  19. {
  20. internal PnpConfig(String[] ids, IoRange[] ranges, IoRange [] fixedRanges)
  21. {
  22. this.Ids = ids;
  23. this.DynamicRanges = ranges;
  24. this.FixedRanges = fixedRanges;
  25. }
  26. // HACK: switched from internal to public
  27. public PnpConfig(String[] ids, IoRange[] ranges)
  28. {
  29. this.Ids = ids;
  30. this.DynamicRanges = ranges;
  31. this.FixedRanges = null;
  32. }
  33. public PnpConfig(String[] ids, ArrayList rangeList)
  34. {
  35. this.Ids = ids;
  36. this.FixedRanges = null;
  37. if (rangeList != null) {
  38. DynamicRanges = new IoRange [rangeList.Count];
  39. int o = 0;
  40. // We copy out in the following order: IoMemory, Ports, IRQ,
  41. // DMA.
  42. for (int i = 0; i < rangeList.Count; i++) {
  43. if (rangeList[i] is IoMemoryRange) {
  44. DynamicRanges[o++] = (IoRange)rangeList[i];
  45. }
  46. }
  47. for (int i = 0; i < rangeList.Count; i++) {
  48. if (rangeList[i] is IoPortRange) {
  49. DynamicRanges[o++] = (IoRange)rangeList[i];
  50. }
  51. }
  52. for (int i = 0; i < rangeList.Count; i++) {
  53. if (rangeList[i] is IoIrqRange) {
  54. DynamicRanges[o++] = (IoRange)rangeList[i];
  55. }
  56. }
  57. for (int i = 0; i < rangeList.Count; i++) {
  58. if (rangeList[i] is IoDmaRange) {
  59. DynamicRanges[o++] = (IoRange)rangeList[i];
  60. }
  61. }
  62. }
  63. else {
  64. DynamicRanges = new IoRange [0];
  65. }
  66. Tracing.Log(Tracing.Audit, "{0}", ToPrint());
  67. }
  68. public override string ToString()
  69. {
  70. return "[PNP " + this.Ids[0] + "]";
  71. }
  72. }
  73. } // end namespace Microsoft.Singularity.Io