Ejemplo n.º 1
0
status_t
AHCIPort::ResetPort(bool forceDeviceReset)
{
    if (!fTestUnitReadyActive)
        TRACE("AHCIPort::ResetPort port %d\n", fIndex);

    // stop DMA engine
    fRegs->cmd &= ~PORT_CMD_ST;
    FlushPostedWrites();

    if (wait_until_clear(&fRegs->cmd, PORT_CMD_CR, 500000) < B_OK) {
        TRACE("AHCIPort::ResetPort port %d error DMA engine doesn't stop\n",
              fIndex);
    }

    bool deviceBusy = fRegs->tfd & (ATA_BSY | ATA_DRQ);

    if (!fTestUnitReadyActive) {
        TRACE("AHCIPort::ResetPort port %d, deviceBusy %d, "
              "forceDeviceReset %d\n", fIndex, deviceBusy, forceDeviceReset);
    }

    if (deviceBusy || forceDeviceReset)
        ResetDevice();

    // start DMA engine
    fRegs->cmd |= PORT_CMD_ST;
    FlushPostedWrites();

    return PostReset();
}
Ejemplo n.º 2
0
// Recover from a lost device
bool D3D9Renderer::Reset() {
  XTRACE_FUNCTION;

  if (!CanReset()) {
    return false;
  }

  PreReset();

  D3DPRESENT_PARAMETERS Params;
  GetPresentParams(Params);

  XTRACE_BEGIN(ResetDevice);
  const HRESULT hr = m_D3DDevice->Reset(&Params);
  if (hr != D3D_OK) {
    return false;
  }
  XTRACE_END;

  m_DeviceLost = false;
  PostReset();

  return true;
}