public void Write32(AcpiObject.RegionSpace regionSpace, ulong offset, uint value) { #if DUMP_RAW_READ_WRITES DebugStub.WriteLine("ACPI write: space: " + regionSpace + ", offset: " + offset + ", bytes: " + 4 + ", value: " + value.ToString("X")); #endif switch (regionSpace) { case AcpiObject.RegionSpace.SystemMemory: IoMemory region = IoMemory.MapPhysicalMemory(offset, 4, true /*readable*/, true /*writable*/); region.Write32(0, value); break; case AcpiObject.RegionSpace.SystemIO: IoPort port = new IoPort((ushort)offset, 4, Access.ReadWrite); port.Write32(value); break; case AcpiObject.RegionSpace.PCI_Config: pciConfigAddressPort.Write32(PciConfigEnableMask | (uint)offset); pciConfigDataPort.Write32(value); break; default: throw new Exception("Unimplemented operation region type" + regionSpace); } }
public byte Read8(AcpiObject.RegionSpace regionSpace, ulong offset) { byte result; switch (regionSpace) { case AcpiObject.RegionSpace.SystemMemory: // TODO: This is a first stab - ideally the AcpiObject.OperationRegion // ought to be holding onto an IoMemoryRange and passing it in repeatedly. IoMemory region = IoMemory.MapPhysicalMemory(offset, 1, true /*readable*/, false /*writable*/); result = region.Read8(0); break; case AcpiObject.RegionSpace.SystemIO: IoPort port = new IoPort((ushort)offset, 1, Access.Read); result = port.Read8(); break; case AcpiObject.RegionSpace.PCI_Config: pciConfigAddressPort.Write32(PciConfigEnableMask | (uint)offset); result = pciConfigDataPort.Read8(); break; default: throw new Exception("Unimplemented operation region type" + regionSpace); } #if DUMP_RAW_READ_WRITES DebugStub.WriteLine("ACPI read: space: " + regionSpace + ", offset: " + offset + ", bytes: " + 1 + ", result: " + result.ToString("X")); #endif return(result); }
public void BmPrepareController(IdeRequest !ideRequest) { // Perform steps 1 and 2 above: set up PRD, clear // error snd interrupt // Init. Scatter Gather List Register uint thePrd = FillPrdTable(ideRequest); prdPort.Write32(thePrd); // Clear Errors byte status = (byte)(BUSMASTER_STATUS_MASK_INTERRUPT | BUSMASTER_STATUS_MASK_ERROR); statusPort.Write8(status); return; } // BmPrepareController