Commit 58c2daa8 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Listen for PreReset service and do a soft reset

Simulate the effects of a hard reset by globally resetting the controller. This fixes a problem with some brands of drive when the ROM is softloaded and the drives don't get long enough to retrain before SATADriver starts a 2nd time.

Version 0.08. Tagged as 'SATADriver-0_08'
parent 2ae663b1
/* (0.07)
/* (0.08)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.07
#define Module_MajorVersion_CMHG 0.08
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 22 Aug 2017
#define Module_Date_CMHG 12 Jun 2018
#define Module_MajorVersion "0.07"
#define Module_Version 7
#define Module_MajorVersion "0.08"
#define Module_Version 8
#define Module_MinorVersion ""
#define Module_Date "22 Aug 2017"
#define Module_Date "12 Jun 2018"
#define Module_ApplicationDate "22-Aug-17"
#define Module_ApplicationDate "12-Jun-18"
#define Module_ComponentName "SATADriver"
#define Module_ComponentPath "cddl/RiscOS/Sources/HWSupport/ATA/SATADriver"
#define Module_FullVersion "0.07"
#define Module_HelpVersion "0.07 (22 Aug 2017)"
#define Module_LibraryVersionInfo "0:7"
#define Module_FullVersion "0.08"
#define Module_HelpVersion "0.08 (12 Jun 2018)"
#define Module_LibraryVersionInfo "0:8"
......@@ -125,6 +125,21 @@ void module_service(int service_number, _kernel_swi_regs *r, void *pw)
}
break;
}
case Service_PreReset:
{
if (g_ahci.valid)
{
hba_regset_t *hba = g_ahci.dev->dev.address;
/* Manually reset the controller here. This implicitly stops the controller
* from interrupting so it's OK to leave the trampoline installed by device_added().
* Don't worry about freeing memory since we're about to reboot. */
hba->ghc |= GHC_HR;
g_ahci.valid = false;
}
break;
}
}
}
......
......@@ -30,7 +30,7 @@ initialisation-code: module_initialise
finalisation-code: module_finalise
service-call-handler: module_service Service_ModulePostInit
service-call-handler: module_service Service_ModulePostInit Service_PreReset
title-string: Module_ComponentName
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment