GitLab has been upgraded to 13.3.6. If you encounter any issues mail code@riscosopen.org

Commit 07e72b27 authored by Jeffrey Lee's avatar Jeffrey Lee

Fix hang on boot

Detail:
  c/cmodule - Add a re-entrancy check to USB driver initialisation; due to recent kernel changes we're now getting the "USBDriver has started" service call during the middle of our call to USBDriver_Register (called from our own initialisation callback). Without the re-entrancy check the system was getting confused and sending a duff transfer request to DWCDriver, resulting in a hang somewhere in the driver logic.
Admin:
  Tested on Raspberry Pi
  Machine no longer stops after "mod init done" is displayed


Version 0.10. Tagged as 'DWCDriver-0_10'
parent d854b974
/* (0.09)
/* (0.10)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.09
#define Module_MajorVersion_CMHG 0.10
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 17 Sep 2012
#define Module_Date_CMHG 30 Mar 2013
#define Module_MajorVersion "0.09"
#define Module_Version 9
#define Module_MajorVersion "0.10"
#define Module_Version 10
#define Module_MinorVersion ""
#define Module_Date "17 Sep 2012"
#define Module_Date "30 Mar 2013"
#define Module_ApplicationDate "17-Sep-12"
#define Module_ApplicationDate "30-Mar-13"
#define Module_ComponentName "DWCDriver"
#define Module_ComponentPath "mixed/RiscOS/Sources/HWSupport/USB/Controllers/DWCDriver"
#define Module_FullVersion "0.09"
#define Module_HelpVersion "0.09 (17 Sep 2012)"
#define Module_LibraryVersionInfo "0:9"
#define Module_FullVersion "0.10"
#define Module_HelpVersion "0.10 (30 Mar 2013)"
#define Module_LibraryVersionInfo "0:10"
......@@ -74,6 +74,7 @@ int dma_offset; /* ARM phys addr -> DMA addr offset */
static dwc_softc_t dwc_soft; /* Bus device we register with USBDriver */
static struct device * usb_soft=NULL; /* Device handle from USBDriver */
static bool driver_init=false; /* True/false for whether DWC layer is initialised */
static bool registering=false; /* True/false for whether we're in the middle of registering. Avoids nested registration attempt during ROM init. */
#ifdef DWCDRIVER_DEBUG
int dwcdebug; /* Debug level */
......@@ -94,8 +95,10 @@ static _kernel_oserror* register_bus(void *in,struct device **out)
if(version < RISCOS_USBDRIVER_API_VERSION)
return (_kernel_oserror*)"\0\0\0\0USBDriver too old";
/* Now attempt to register */
registering = true;
e = _swix(USBDriver_RegisterBus, _INR(0,1)|_OUT(0),in,RISCOS_USBDRIVER_API_VERSION,out);
if(e) *out = NULL;
registering = false;
return e;
}
......@@ -325,7 +328,7 @@ void module_services(int service_number, _kernel_swi_regs *r, void *pw)
switch (r->r[0])
{
case Service_USBDriver_Starting:
if (usb_soft == NULL)
if ((usb_soft == NULL) && !registering)
{
_kernel_oserror *e = init_driver();
if(e)
......
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