Commit 61ff395b authored by ROOL's avatar ROOL 🤖

Improve response USBDriver finalisation

Detail:
  Listen for Service_USB_USBDriverDead then shut down the driver, rather than Service_ModulePostFinal.
  Take care to preserve the other softc members that the module only captures during init - otherwise subsequently these are all zero.
  Ensure the returned status is defined if USBDriver_InsertTransfer fails (because USBDriver has gone).
Admin:
  Submission from Colin Granville.

Version 0.41. Tagged as 'EHCIDriver-0_41'
parent 8f5d35d2
/* (0.40)
/* (0.41)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.40
#define Module_MajorVersion_CMHG 0.41
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 18 Nov 2017
#define Module_Date_CMHG 27 Jan 2018
#define Module_MajorVersion "0.40"
#define Module_Version 40
#define Module_MajorVersion "0.41"
#define Module_Version 41
#define Module_MinorVersion ""
#define Module_Date "18 Nov 2017"
#define Module_Date "27 Jan 2018"
#define Module_ApplicationDate "18-Nov-17"
#define Module_ApplicationDate "27-Jan-18"
#define Module_ComponentName "EHCIDriver"
#define Module_ComponentPath "mixed/RiscOS/Sources/HWSupport/USB/Controllers/EHCIDriver"
#define Module_FullVersion "0.40"
#define Module_HelpVersion "0.40 (18 Nov 2017)"
#define Module_LibraryVersionInfo "0:40"
#define Module_FullVersion "0.41"
#define Module_HelpVersion "0.41 (27 Jan 2018)"
#define Module_LibraryVersionInfo "0:41"
......@@ -411,7 +411,7 @@ int bus_space_read_1 (bus_space_tag_t iot, bus_space_handle_t ioh, int o)
usbd_status
usb_insert_transfer(usbd_xfer_handle xfer)
{
usbd_status status;
usbd_status status = USBD_CANCELLED; /* Should _swix() error */
_swix (USBDriver_InsertTransfer, _IN (0) | _OUT (0), xfer, &status);
return status;
}
......
......@@ -495,19 +495,31 @@ void module_services(int service_number, _kernel_swi_regs *r, void *pw)
}
}
break;
case Service_USB_USBDriverDying:
dprintf (("", "Deregistering with USB driver\n"));
/* USBDriver will do the deregistering at this point, since
its SWIs are not active anymore */
ehci_detach(&ehci_soft,0);
ehci_shutdown(&ehci_soft);
case Service_USB_USBDriverDead:
{
int irqdevno, flags;
u_int ncomp;
dprintf (("", "USB driver is dead, shutting down\n"));
/* USBDriver finalised - no more communication with USBDriver possible */
ehci_detach (&ehci_soft,0);
ehci_shutdown (&ehci_soft);
usb_soft = NULL;
/* Preserve members deduced in module_init(), wipe everything else */
irqdevno = ehci_soft.sc_irqdevno;
flags = ehci_soft.sc_flags;
ncomp = ehci_soft.sc_ncomp;
memset (&ehci_soft, 0, sizeof ehci_soft);
sprintf (ehci_soft.sc_bus.bdev.dv_xname, "EHCI%d", instance);
ehci_soft.sc_irqdevno = irqdevno;
ehci_soft.sc_flags = flags;
ehci_soft.sc_ncomp = ncomp;
name_root_hub (pci_device);
ehci_init (&ehci_soft);
break;
default:break;
}
default:
break;
}
break;
case Service_PreReset:
......
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