Added a Claimed property to PCIDevice class to indicate that this PCI device has infact been claimed by a driver

Updated Network Card drivers and VMWare SVGA test driver to update and use the Claimed property from above
This commit is contained in:
sschocke_cp 2009-08-26 14:40:23 +00:00
parent 4d95a63619
commit 39ab2ac233
5 changed files with 89 additions and 73 deletions

View file

@ -30,6 +30,9 @@ namespace Cosmos.Hardware.Network.Devices.AMDPCNetII
} }
pciCard = device; pciCard = device;
// We are handling this device
pciCard.Claimed = true;
// Setup interrupt handling // Setup interrupt handling
//Interrupts.IRQ09 += HandleNetworkInterrupt; //Interrupts.IRQ09 += HandleNetworkInterrupt;
Interrupts.AddIRQHandler(device.InterruptLine, HandleNetworkInterrupt); Interrupts.AddIRQHandler(device.InterruptLine, HandleNetworkInterrupt);
@ -133,7 +136,7 @@ namespace Cosmos.Hardware.Network.Devices.AMDPCNetII
Console.WriteLine("Scanning for AMD PCNet cards..."); Console.WriteLine("Scanning for AMD PCNet cards...");
foreach (PCIDevice device in Cosmos.Hardware.PCIBus.Devices) foreach (PCIDevice device in Cosmos.Hardware.PCIBus.Devices)
{ {
if ((device.VendorID == 0x1022) && (device.DeviceID == 0x2000)) if ((device.VendorID == 0x1022) && (device.DeviceID == 0x2000) && (device.Claimed == false))
{ {
AMDPCNet nic = new AMDPCNet(device); AMDPCNet nic = new AMDPCNet(device);

View file

@ -32,6 +32,9 @@ namespace Cosmos.Hardware.Network.Devices.RTL8139
} }
pciCard = device; pciCard = device;
// We are handling this device
pciCard.Claimed = true;
// Setup interrupt handling // Setup interrupt handling
//Interrupts.IRQ11 += HandleNetworkInterrupt; //Interrupts.IRQ11 += HandleNetworkInterrupt;
Interrupts.AddIRQHandler(device.InterruptLine, HandleNetworkInterrupt); Interrupts.AddIRQHandler(device.InterruptLine, HandleNetworkInterrupt);
@ -87,7 +90,7 @@ namespace Cosmos.Hardware.Network.Devices.RTL8139
foreach (PCIDevice device in Cosmos.Hardware.PCIBus.Devices) foreach (PCIDevice device in Cosmos.Hardware.PCIBus.Devices)
{ {
//DebugWriteLine("VendorID: " + device.VendorID + " - DeviceID: " + device.DeviceID); //DebugWriteLine("VendorID: " + device.VendorID + " - DeviceID: " + device.DeviceID);
if ((device.VendorID == 0x10EC) && (device.DeviceID == 0x8139)) if ((device.VendorID == 0x10EC) && (device.DeviceID == 0x8139) && (device.Claimed == false))
{ {
RTL8139 nic = new RTL8139(device); RTL8139 nic = new RTL8139(device);

View file

@ -26,6 +26,9 @@ namespace Cosmos.Hardware.Network.Devices.ViaRhine
} }
pciCard = device; pciCard = device;
// We are handling this device
pciCard.Claimed = true;
// Setup interrupt handling // Setup interrupt handling
//Interrupts.IRQ10 += HandleNetworkInterrupt; //Interrupts.IRQ10 += HandleNetworkInterrupt;
Interrupts.AddIRQHandler(device.InterruptLine, HandleNetworkInterrupt); Interrupts.AddIRQHandler(device.InterruptLine, HandleNetworkInterrupt);
@ -127,7 +130,7 @@ namespace Cosmos.Hardware.Network.Devices.ViaRhine
Console.WriteLine("Scanning for VIA Rhine-II cards..."); Console.WriteLine("Scanning for VIA Rhine-II cards...");
foreach (PCIDevice device in Cosmos.Hardware.PCIBus.Devices) foreach (PCIDevice device in Cosmos.Hardware.PCIBus.Devices)
{ {
if ((device.VendorID == 0x1106) && (device.DeviceID == 0x3065)) if ((device.VendorID == 0x1106) && (device.DeviceID == 0x3065) && (device.Claimed == false))
{ {
VT6102 nic = new VT6102(device); VT6102 nic = new VT6102(device);

View file

@ -6723,6 +6723,7 @@ namespace Cosmos.Hardware {
this.Bus = bus; this.Bus = bus;
this.Slot = slot; this.Slot = slot;
this.Function = function; this.Function = function;
this.Claimed = false;
} }
private bool NeedsIO = false; private bool NeedsIO = false;
@ -6789,6 +6790,10 @@ namespace Cosmos.Hardware {
return IOMaps[index]; return IOMaps[index];
} }
/// <summary>
/// Has this device been claimed a driver
/// </summary>
public bool Claimed { get; set; }
/// <summary> /// <summary>
/// The bus the device is on /// The bus the device is on
/// </summary> /// </summary>

View file

@ -228,7 +228,7 @@ namespace Cosmos.Playground.SSchocke
Console.WriteLine("Scanning for VMWare SVGA cards..."); Console.WriteLine("Scanning for VMWare SVGA cards...");
foreach (PCIDevice device in Cosmos.Hardware.PCIBus.Devices) foreach (PCIDevice device in Cosmos.Hardware.PCIBus.Devices)
{ {
if ((device.VendorID == 0x15AD) && (device.DeviceID == 0x0405)) if ((device.VendorID == 0x15AD) && (device.DeviceID == 0x0405) && (device.Claimed == false))
{ {
Console.WriteLine("Found VMWare SVGA on PCI " + device.Bus + ":" + device.Slot + ":" + device.Function); Console.WriteLine("Found VMWare SVGA on PCI " + device.Bus + ":" + device.Slot + ":" + device.Function);
Console.WriteLine("VGA IRQ: " + device.InterruptLine); Console.WriteLine("VGA IRQ: " + device.InterruptLine);
@ -336,6 +336,8 @@ namespace Cosmos.Playground.SSchocke
return; return;
} }
this.pciDev.Claimed = true;
if (deviceVersionID >= SVGA_ID_1) if (deviceVersionID >= SVGA_ID_1)
{ {
this.capabilities = readSVGARegister(SVGA_REG.CAPABILITIES); this.capabilities = readSVGARegister(SVGA_REG.CAPABILITIES);