Driver work

This commit is contained in:
kudzu_cp 2010-08-22 23:26:10 +00:00
parent b761ae352b
commit 7ace786eab
9 changed files with 76 additions and 46 deletions

View file

@ -55,6 +55,7 @@
<Compile Include="Heap.cs" />
<Compile Include="IOGroup\Keyboard.cs" />
<Compile Include="IOGroup\PciBus.cs" />
<Compile Include="IOGroup\PciDevice.cs" />
<Compile Include="IOGroup\PIC.cs" />
<Compile Include="INTs.cs" />
<Compile Include="IOGroup\IOGroup.cs" />

View file

@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
namespace Cosmos.Core {
[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple=true)]
public class DeviceIDAttribute : Attribute {
public UInt16 VendorID;
public UInt16 DeviceID;

View file

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Cosmos.Core.IOGroup {
public class PciDevice {
internal PciDevice() {
}
}
}

View file

@ -6,6 +6,17 @@ using Cosmos.Common.Extensions;
namespace Cosmos.Core {
public class PciBus {
public class PciInfo {
public readonly UInt16 VendorID;
public readonly UInt16 DeviceID;
public PciInfo(UInt16 aVendorID, UInt16 aDeviceID) {
VendorID = aVendorID;
DeviceID = aDeviceID;
}
}
static public Action<PciInfo, IOGroup.PciDevice> OnPCIDeviceFound;
protected IOGroup.PciBus IO = new IOGroup.PciBus();
public PciBus() {
@ -50,7 +61,9 @@ namespace Cosmos.Core {
UInt16 xVendorID = (UInt16)(x & 0xFFFF);
UInt16 xDeviceID = (UInt16)(x >> 16);
Global.Dbg.Send("PCI Ven:" + xVendorID.ToHex() + " Dev:" + xDeviceID.ToHex());
var xInfo = new PciInfo(xVendorID, xDeviceID);
var xIO = new IOGroup.PciDevice();
OnPCIDeviceFound(xInfo, xIO);
}

View file

@ -19,51 +19,24 @@
<h3>
VMWare Worksation</h3>
<pre>Intel: 8086
PCI Ven:8086 Dev:7190
PCI Ven:8086 Dev:7191
PCI Ven:8086 Dev:7110
PCI Ven:8086 Dev:7111
PCI Ven:8086 Dev:7113
PCI Ven:8086 Dev:7112</pre>
<pre>PCI Ven:104b Dev:1040</pre>
<pre>PCI Ven:1022 Dev:2000</pre>
<pre>PCI Ven:1274 Dev:1371</pre>
<pre>PCI Ven:15ad Dev:0740
PCI Ven:15ad Dev:0405
PCI Ven:15ad Dev:0790
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:07a0
PCI Ven:15ad Dev:0770</pre>
7190: 440BX/ZX AGPset Host Bridge
7191: 440BX/ZX AGPset PCI-to-PCI bridge
7110: PIIX4/4E/4M ISBridgeA
7111: PIIX4/4E/4M IDE Controller 82371AB/EB/MB
7113: PIIX4/4E/4M Power Management Controller
7112: PIIX4/4E/4M USB Interface</pre>
<pre>Mylex / Buslogic: 104B
1040: BT958 SCSI Host Adaptor</pre>
<pre>Advanced Micro Devices: 1022
2000: PCnet LANCE PCI Ethernet Controller Am79C970/1/2/3/5/6</pre>
<pre>Ensoniq: 1274
1371: AudioPCI ES 1371</pre>
<pre>VMWare: 15AD
0740: VMWare VMCI Bus Device
0405: NVIDIA 9500MGS Graphics
0790: PCI bridge
07A0: (32 instances) EHCI USB Controller
0770: Standard Enhanced PCI to USB Host Controller</pre>
<pre>
</pre>

View file

@ -5,5 +5,10 @@ using System.Text;
namespace Cosmos.Hardware {
public class ATA {
protected Core.IOGroup.PciDevice IO;
public ATA(Core.IOGroup.PciDevice aIO) {
IO = aIO;
}
}
}

View file

@ -74,6 +74,7 @@
<None Include="Cosmos.snk" />
</ItemGroup>
<ItemGroup>
<Content Include="Drivers\ReadMe.html" />
<Content Include="Keyboard.html" />
<Content Include="TextScreen.html" />
</ItemGroup>

View file

@ -0,0 +1,16 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
<p>
Dynamically loaded drivers are contained in this folder. In the future they may
be in different assemblies which are loaded on demand. The drivers in the root
folder are not dynamic, and are drivers that are required for all systems, or
are common bases used by dynamic drivers. For example, ATA exists in the root,
but actual ATA chipsets should exist in this directory.</p>
</body>
</html>

View file

@ -10,11 +10,20 @@ namespace Cosmos.Hardware {
static public Keyboard Keyboard = new Keyboard();
static public PIT PIT = new PIT();
static public TextScreen TextScreen = new TextScreen();
static public ATA ATA;
static public void Init() {
Global.Dbg.Send("Cosmos.Hardware.Global.Init");
Core.PciBus.OnPCIDeviceFound = PCIDeviceFound;
Cosmos.Core.Global.Init();
}
static void PCIDeviceFound(Core.PciBus.PciInfo aInfo, Core.IOGroup.PciDevice aIO) {
// Later we need to dynamically load these, but we need to finish the design first.
if ((aInfo.VendorID == 0x8086) && (aInfo.DeviceID == 0x7111)) {
ATA = new ATA(aIO);
}
}
}
}