示例#1
0
        public bool Reset()
        {
            var acpi = DeviceService.GetFirstDevice <IACPI>(DeviceStatus.Online).DeviceDriver as IACPI;

            if (acpi == null)
            {
                return(false);
            }

            BaseIOPortWrite address = acpi.ResetAddress;
            byte            value   = acpi.ResetValue;

            if (address != null)
            {
                address.Write8(value);

                // Map memory
                Pointer         ptr            = HAL.GetPhysicalMemory((Pointer)(uint)address.Address, 1).Address;
                BaseIOPortWrite mappedResetReg = HAL.GetWriteIOPort((ushort)ptr);

                mappedResetReg.Write8(value);

                // Write to PCI Configuration Space (we're actually writing on the host bridge controller)
                // TODO: Fix

                /*var controller = DeviceService.GetFirstDevice<IHostBridgeController>(DeviceStatus.Online).DeviceDriver as IHostBridgeController;
                 *
                 * controller.SetCPUResetInformation((byte)address.Address, value);
                 * controller.CPUReset();*/

                return(true);
            }

            return(false);
        }
 /// <summary>
 /// Gets the IO port.
 /// </summary>
 /// <param name="region">The region.</param>
 /// <param name="index">The index.</param>
 /// <returns></returns>
 public BaseIOPortWrite GetIOPortWrite(byte region, ushort index)
 {
     return(HAL.GetWriteIOPort((ushort)(ioPortRegions[region].BaseIOPort + index)));
 }
示例#3
0
 /// <summary>
 /// Gets the IO port.
 /// </summary>
 /// <param name="index">The region.</param>
 /// <param name="offset">The index.</param>
 /// <returns></returns>
 public BaseIOPortWrite GetIOPortWrite(byte index, ushort offset)
 {
     return(HAL.GetWriteIOPort((ushort)(ioPortRegions[index].BaseIOPort + offset)));
 }