GitLab has been upgraded to 13.3.6. If you encounter any issues mail

Commit cdcbfd8a authored by Jeffrey Lee's avatar Jeffrey Lee

Add re-entrancy check to USBDriver registration

  c/cmodule - Added a re-entrancy check to USBDriver registration, to avoid any shenanigans if we receive "USBDriver has started" service calls while in the middle of registering
  Tested on BB-xM
  Doesn't fix any known MUSBDriver-related issue, but is the same fix as was made to DWCDriver after the above-mentioned problem was found to be the cause of a hang on boot in recent Pi ROMs

Version 0.19. Tagged as 'MUSBDriver-0_19'
parent a846826b
/* (0.18)
/* (0.19)
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
#define Module_MajorVersion_CMHG 0.18
#define Module_MajorVersion_CMHG 0.19
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 24 Sep 2012
#define Module_Date_CMHG 30 Mar 2013
#define Module_MajorVersion "0.18"
#define Module_Version 18
#define Module_MajorVersion "0.19"
#define Module_Version 19
#define Module_MinorVersion ""
#define Module_Date "24 Sep 2012"
#define Module_Date "30 Mar 2013"
#define Module_ApplicationDate "24-Sep-12"
#define Module_ApplicationDate "30-Mar-13"
#define Module_ComponentName "MUSBDriver"
#define Module_ComponentPath "mixed/RiscOS/Sources/HWSupport/USB/Controllers/MUSBDriver"
#define Module_FullVersion "0.18"
#define Module_HelpVersion "0.18 (24 Sep 2012)"
#define Module_LibraryVersionInfo "0:18"
#define Module_FullVersion "0.19"
#define Module_HelpVersion "0.19 (30 Mar 2013)"
#define Module_LibraryVersionInfo "0:19"
......@@ -71,6 +71,7 @@ musb_softc_t musb_soft;
static struct device * usb_soft=NULL;
static volatile musb_regs *musb_base;
static bool driver_init=false;
static bool registering=false; /* True/false for whether we're in the middle of registering. Avoids nested registration attempt during ROM init. */
extern int * init_veneer (void);
......@@ -85,8 +86,10 @@ static _kernel_oserror* register_bus(void *in,struct device **out)
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;
......@@ -326,7 +329,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)
dprintf (("", "Registering with USB driver from svcecall\n"));
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