Hardware/WinRing0.cs
changeset 196 5e9a8595296c
parent 195 0ee888c485d5
child 201 958e9fe8afdf
     1.1 --- a/Hardware/WinRing0.cs	Tue Sep 21 20:32:36 2010 +0000
     1.2 +++ b/Hardware/WinRing0.cs	Wed Sep 22 19:12:12 2010 +0000
     1.3 @@ -87,8 +87,6 @@
     1.4        UIntPtr threadAffinityMask);
     1.5      public delegate byte ReadIoPortByteDelegate(ushort port);
     1.6      public delegate void WriteIoPortByteDelegate(ushort port, byte value);
     1.7 -    public delegate uint FindPciDeviceByIdDelegate(ushort vendorId, 
     1.8 -      ushort deviceId, byte index);
     1.9      public delegate bool ReadPciConfigDwordExDelegate(uint pciAddress, 
    1.10        uint regAddress, out uint value);
    1.11      public delegate bool WritePciConfigDwordExDelegate(uint pciAddress, 
    1.12 @@ -114,8 +112,6 @@
    1.13        CreateDelegate<ReadIoPortByteDelegate>("ReadIoPortByte");
    1.14      public static readonly WriteIoPortByteDelegate WriteIoPortByte =
    1.15        CreateDelegate<WriteIoPortByteDelegate>("WriteIoPortByte");
    1.16 -    public static readonly FindPciDeviceByIdDelegate FindPciDeviceById =
    1.17 -      CreateDelegate<FindPciDeviceByIdDelegate>("FindPciDeviceById");
    1.18      public static readonly ReadPciConfigDwordExDelegate ReadPciConfigDwordEx =
    1.19        CreateDelegate<ReadPciConfigDwordExDelegate>("ReadPciConfigDwordEx");
    1.20      public static readonly WritePciConfigDwordExDelegate WritePciConfigDwordEx =
    1.21 @@ -164,6 +160,13 @@
    1.22  
    1.23      public static void ReleaseIsaBusMutex() {
    1.24        isaBusMutex.ReleaseMutex();
    1.25 -    }    
    1.26 +    }
    1.27 +
    1.28 +    public const uint InvalidPciAddress = 0xFFFFFFFF;
    1.29 +
    1.30 +    public static uint GetPciAddress(byte bus, byte device, byte function)	{
    1.31 +      return 
    1.32 +        (uint)(((bus & 0xFF) << 8) | ((device & 0x1F) << 3) | (function & 7));
    1.33 +    }
    1.34    }
    1.35  }