11/*
2- Copyright (C) 2014, The AROS Development Team. All rights reserved.
2+ Copyright (C) 2014-2025 , The AROS Development Team. All rights reserved.
33
44 Desc: SuperSpeed USB3.0 hub for Poseidon (based upon hub.class.c by Chris Hodges <chrisly@platon42.de>)
55*/
2323
2424#include LC_LIBDEFS_FILE
2525
26- struct NepClassHub * GM_UNIQUENAME (usbAttemptDeviceBinding )(struct NepHubBase * nh ,struct PsdDevice * pd );
27- struct NepClassHub * GM_UNIQUENAME (usbForceDeviceBinding )(struct NepHubBase * nh ,struct PsdDevice * pd );
28- void GM_UNIQUENAME (usbReleaseDeviceBinding )(struct NepHubBase * nh ,struct NepClassHub * nch );
29-
30- struct NepClassHub * GM_UNIQUENAME (nAllocHub )(void );
31- void GM_UNIQUENAME (nFreeHub )(struct NepClassHub * nch );
32- struct PsdDevice * GM_UNIQUENAME (nConfigurePort )(struct NepClassHub * nch ,UWORD port );
33- LONG GM_UNIQUENAME (nClearPortStatus )(struct NepClassHub * nch ,UWORD port );
34- BOOL GM_UNIQUENAME (nHubSuspendDevice )(struct NepClassHub * nch ,struct PsdDevice * pd );
35- BOOL GM_UNIQUENAME (nHubResumeDevice )(struct NepClassHub * nch ,struct PsdDevice * pd );
36- void GM_UNIQUENAME (nHandleHubMethod )(struct NepClassHub * nch ,struct NepHubMsg * nhm );
26+ struct NepClassHubSS * GM_UNIQUENAME (usbAttemptDeviceBinding )(struct NepHubSSBase * nh ,struct PsdDevice * pd );
27+ struct NepClassHubSS * GM_UNIQUENAME (usbForceDeviceBinding )(struct NepHubSSBase * nh ,struct PsdDevice * pd );
28+ void GM_UNIQUENAME (usbReleaseDeviceBinding )(struct NepHubSSBase * nh ,struct NepClassHubSS * nch );
29+
30+ struct NepClassHubSS * GM_UNIQUENAME (nAllocHub )(void );
31+ void GM_UNIQUENAME (nFreeHub )(struct NepClassHubSS * nch );
32+ struct PsdDevice * GM_UNIQUENAME (nConfigurePort )(struct NepClassHubSS * nch ,UWORD port );
33+ LONG GM_UNIQUENAME (nClearPortStatus )(struct NepClassHubSS * nch ,UWORD port );
34+ BOOL GM_UNIQUENAME (nHubSuspendDevice )(struct NepClassHubSS * nch ,struct PsdDevice * pd );
35+ BOOL GM_UNIQUENAME (nHubResumeDevice )(struct NepClassHubSS * nch ,struct PsdDevice * pd );
36+ void GM_UNIQUENAME (nHandleHubMethod )(struct NepClassHubSS * nch ,struct NepHubSSMsg * nhm );
3737AROS_UFP0 (void ,GM_UNIQUENAME (nHubssTask ));
3838
3939/* /// "Lib Stuff" */
@@ -58,12 +58,12 @@ ADD2INITLIB(GM_UNIQUENAME(libInit), 0)
5858 */
5959
6060/* /// "usbAttemptDeviceBinding()" */
61- struct NepClassHub * GM_UNIQUENAME (usbAttemptDeviceBinding )(struct NepHubBase * nh ,struct PsdDevice * pd ) {
61+ struct NepClassHubSS * GM_UNIQUENAME (usbAttemptDeviceBinding )(struct NepHubSSBase * nh ,struct PsdDevice * pd ) {
6262struct Library * ps ;
6363IPTR devclass ;
6464IPTR issuperspeed = 0 ;
6565
66- //KPRINTF(0, ("usbAttemptDeviceBinding(%p)\n", pd));
66+ //KPRINTF(0, ("hubss:: usbAttemptDeviceBinding(%p)\n", pd));
6767
6868if ((ps = OpenLibrary ("poseidon.library" ,4 ))) {
6969psdGetAttrs (PGA_DEVICE ,pd ,DA_Class ,& devclass ,DA_IsSuperspeed ,& issuperspeed ,TAG_DONE );
@@ -77,22 +77,23 @@ struct NepClassHub * GM_UNIQUENAME(usbAttemptDeviceBinding)(struct NepHubBase *n
7777}
7878
7979/* /// "usbForceDeviceBinding()" */
80- struct NepClassHub * GM_UNIQUENAME (usbForceDeviceBinding )(struct NepHubBase * nh ,struct PsdDevice * pd ) {
80+ struct NepClassHubSS * GM_UNIQUENAME (usbForceDeviceBinding )(struct NepHubSSBase * nh ,struct PsdDevice * pd ) {
8181struct Library * ps ;
82- struct NepClassHub * nch ;
82+ struct NepClassHubSS * nch ;
8383STRPTR devname ;
8484char buf [64 ];
8585struct Task * tmptask ;
8686
87- //KPRINTF(0, ("usbForceDeviceBinding(%p)\n", pd));
87+ //KPRINTF(0, ("hubss:: usbForceDeviceBinding(%p)\n", pd));
8888
8989if ((ps = OpenLibrary ("poseidon.library" ,4 ))) {
9090psdGetAttrs (PGA_DEVICE ,pd ,DA_ProductName ,& devname ,TAG_DONE );
9191
92- if ((nch = psdAllocVec (sizeof (struct NepClassHub )))) {
92+ if ((nch = psdAllocVec (sizeof (struct NepClassHubSS )))) {
9393nch -> nch_HubBase = nh ;
9494nch -> nch_Device = pd ;
9595psdSafeRawDoFmt (buf ,64 ,"hubss.class<%p>" ,nch );
96+
9697nch -> nch_ReadySignal = SIGB_SINGLE ;
9798nch -> nch_ReadySigTask = FindTask (NULL );
9899SetSignal (0 ,SIGF_SINGLE );
@@ -125,7 +126,7 @@ struct NepClassHub * GM_UNIQUENAME(usbForceDeviceBinding)(struct NepHubBase * nh
125126}
126127
127128/* /// "usbReleaseDeviceBinding()" */
128- void GM_UNIQUENAME (usbReleaseDeviceBinding )(struct NepHubBase * nh ,struct NepClassHub * nch ) {
129+ void GM_UNIQUENAME (usbReleaseDeviceBinding )(struct NepHubSSBase * nh ,struct NepClassHubSS * nch ) {
129130struct Library * ps ;
130131STRPTR devname ;
131132
@@ -161,7 +162,7 @@ void GM_UNIQUENAME(usbReleaseDeviceBinding)(struct NepHubBase *nh, struct NepCla
161162}
162163
163164/* /// "usbGetAttrsA()" */
164- AROS_LH3 (LONG ,usbGetAttrsA ,AROS_LHA (ULONG ,type ,D0 ),AROS_LHA (APTR ,usbstruct ,A0 ),AROS_LHA (struct TagItem * ,taglist ,A1 ),LIBBASETYPEPTR ,nh ,5 ,hub ) {
165+ AROS_LH3 (LONG ,usbGetAttrsA ,AROS_LHA (ULONG ,type ,D0 ),AROS_LHA (APTR ,usbstruct ,A0 ),AROS_LHA (struct TagItem * ,taglist ,A1 ),LIBBASETYPEPTR ,nh ,5 ,hubss ) {
165166AROS_LIBFUNC_INIT
166167
167168struct TagItem * ti ;
@@ -218,18 +219,18 @@ AROS_LH3(LONG, usbGetAttrsA, AROS_LHA(ULONG, type, D0), AROS_LHA(APTR, usbstruct
218219}
219220
220221/* /// "usbSetAttrsA()" */
221- AROS_LH3 (LONG ,usbSetAttrsA ,AROS_LHA (ULONG ,type ,D0 ),AROS_LHA (APTR ,usbstruct ,A0 ),AROS_LHA (struct TagItem * ,tags ,A1 ),LIBBASETYPEPTR ,nh ,6 ,hub ) {
222+ AROS_LH3 (LONG ,usbSetAttrsA ,AROS_LHA (ULONG ,type ,D0 ),AROS_LHA (APTR ,usbstruct ,A0 ),AROS_LHA (struct TagItem * ,tags ,A1 ),LIBBASETYPEPTR ,nh ,6 ,hubss ) {
222223AROS_LIBFUNC_INIT
223224
224225return (0 );
225226AROS_LIBFUNC_EXIT
226227}
227228
228229/* /// "usbDoMethodA()" */
229- AROS_LH2 (IPTR ,usbDoMethodA ,AROS_LHA (ULONG ,methodid ,D0 ),AROS_LHA (IPTR * ,methoddata ,A1 ),LIBBASETYPEPTR ,nh ,7 ,hub ) {
230+ AROS_LH2 (IPTR ,usbDoMethodA ,AROS_LHA (ULONG ,methodid ,D0 ),AROS_LHA (IPTR * ,methoddata ,A1 ),LIBBASETYPEPTR ,nh ,7 ,hubss ) {
230231AROS_LIBFUNC_INIT
231232
232- struct NepClassHub * nch ;
233+ struct NepClassHubSS * nch ;
233234
234235KPRINTF (1 , ("Do Method %ld\n" ,methodid ));
235236switch (methodid ) {
@@ -240,7 +241,7 @@ AROS_LH2(IPTR, usbDoMethodA, AROS_LHA(ULONG, methodid, D0), AROS_LHA(IPTR *, met
240241return ((IPTR )GM_UNIQUENAME (usbForceDeviceBinding )(nh , (struct PsdDevice * )methoddata [0 ]));
241242
242243case UCM_ReleaseDeviceBinding :
243- GM_UNIQUENAME (usbReleaseDeviceBinding )(nh , (struct NepClassHub * )methoddata [0 ]);
244+ GM_UNIQUENAME (usbReleaseDeviceBinding )(nh , (struct NepClassHubSS * )methoddata [0 ]);
244245return (TRUE);
245246
246247case UCM_HubPowerCyclePort :
@@ -254,7 +255,7 @@ AROS_LH2(IPTR, usbDoMethodA, AROS_LHA(ULONG, methodid, D0), AROS_LHA(IPTR *, met
254255 }
255256
256257Forbid ();
257- nch = (struct NepClassHub * )nh -> nh_Bindings .lh_Head ;
258+ nch = (struct NepClassHubSS * )nh -> nh_Bindings .lh_Head ;
258259while (nch -> nch_Node .ln_Succ ) {
259260if (nch -> nch_Device == pd ) {
260261KPRINTF (20 , ("HubPowerCycle/DisablePort Dev found (port %ld)!\n" ,port ));
@@ -271,15 +272,15 @@ AROS_LH2(IPTR, usbDoMethodA, AROS_LHA(ULONG, methodid, D0), AROS_LHA(IPTR *, met
271272 }
272273break ;
273274 }
274- nch = (struct NepClassHub * )nch -> nch_Node .ln_Succ ;
275+ nch = (struct NepClassHubSS * )nch -> nch_Node .ln_Succ ;
275276 }
276277Permit ();
277278
278279return (FALSE);
279280 }/* case UCM_HubDisablePort */
280281
281282case UCM_HubClassScan : {
282- nch = (struct NepClassHub * )methoddata [0 ];
283+ nch = (struct NepClassHubSS * )methoddata [0 ];
283284
284285Forbid ();
285286nch -> nch_ClassScan = TRUE;
@@ -298,9 +299,9 @@ AROS_LH2(IPTR, usbDoMethodA, AROS_LHA(ULONG, methodid, D0), AROS_LHA(IPTR *, met
298299case UCM_HubReleaseDevBinding :
299300case UCM_HubSuspendDevice :
300301case UCM_HubResumeDevice : {
301- struct NepHubMsg nhm ;
302+ struct NepHubSSMsg nhm ;
302303struct Library * ps ;
303- nch = (struct NepClassHub * )methoddata [0 ];
304+ nch = (struct NepClassHubSS * )methoddata [0 ];
304305nhm .nhm_Result = (IPTR )NULL ;
305306nhm .nhm_MethodID = methodid ;
306307nhm .nhm_Params = methoddata ;
@@ -311,7 +312,7 @@ AROS_LH2(IPTR, usbDoMethodA, AROS_LHA(ULONG, methodid, D0), AROS_LHA(IPTR *, met
311312GM_UNIQUENAME (nHandleHubMethod )(nch ,& nhm );
312313 }else {
313314nhm .nhm_Msg .mn_ReplyPort = CreateMsgPort ();
314- nhm .nhm_Msg .mn_Length = sizeof (struct NepHubMsg );
315+ nhm .nhm_Msg .mn_Length = sizeof (struct NepHubSSMsg );
315316
316317Forbid ();
317318if (nch -> nch_Task && nhm .nhm_Msg .mn_ReplyPort ) {
@@ -347,7 +348,7 @@ AROS_LH2(IPTR, usbDoMethodA, AROS_LHA(ULONG, methodid, D0), AROS_LHA(IPTR *, met
347348AROS_UFH0 (void ,GM_UNIQUENAME (nHubssTask )) {
348349AROS_USERFUNC_INIT
349350
350- struct NepClassHub * nch ;
351+ struct NepClassHubSS * nch ;
351352struct PsdPipe * pp ;
352353ULONG sigmask ;
353354ULONG sigs ;
@@ -358,7 +359,7 @@ AROS_UFH0(void, GM_UNIQUENAME(nHubssTask)) {
358359ULONG count ;
359360struct PsdDevice * pd ;
360361STRPTR devname ;
361- struct NepHubMsg * nhm ;
362+ struct NepHubSSMsg * nhm ;
362363
363364if ((nch = GM_UNIQUENAME (nAllocHub )())) {
364365Forbid ();
@@ -397,7 +398,7 @@ AROS_UFH0(void, GM_UNIQUENAME(nHubssTask)) {
397398 }
398399sigs = Wait (sigmask );
399400
400- while ((nhm = (struct NepHubMsg * )GetMsg (nch -> nch_CtrlMsgPort ))) {
401+ while ((nhm = (struct NepHubSSMsg * )GetMsg (nch -> nch_CtrlMsgPort ))) {
401402GM_UNIQUENAME (nHandleHubMethod )(nch ,nhm );
402403ReplyMsg ((struct Message * )nhm );
403404 }
@@ -686,11 +687,11 @@ AROS_UFH0(void, GM_UNIQUENAME(nHubssTask)) {
686687}
687688
688689/* /// "nAllocHub()" */
689- struct NepClassHub * GM_UNIQUENAME (nAllocHub )(void ) {
690+ struct NepClassHubSS * GM_UNIQUENAME (nAllocHub )(void ) {
690691struct UsbSSHubDesc * usshd ;
691692//struct UsbStdBOSDesc *usbosd;
692693struct Task * thistask ;
693- struct NepClassHub * nch ;
694+ struct NepClassHubSS * nch ;
694695struct UsbHubStatus uhhs ;
695696APTR parenthub ;
696697LONG ioerr ;
@@ -925,7 +926,7 @@ struct NepClassHub * GM_UNIQUENAME(nAllocHub)(void) {
925926}
926927
927928/* /// "nFreeHub()" */
928- void GM_UNIQUENAME (nFreeHub )(struct NepClassHub * nch ) {
929+ void GM_UNIQUENAME (nFreeHub )(struct NepClassHubSS * nch ) {
929930UWORD num ;
930931LONG ioerr ;
931932struct PsdDevice * pd ;
@@ -990,7 +991,7 @@ void GM_UNIQUENAME(nFreeHub)(struct NepClassHub *nch) {
990991/* *** HUBSS Class *** */
991992
992993/* /// "nClearPortStatus()" */
993- LONG GM_UNIQUENAME (nClearPortStatus )(struct NepClassHub * nch ,UWORD port ) {
994+ LONG GM_UNIQUENAME (nClearPortStatus )(struct NepClassHubSS * nch ,UWORD port ) {
994995LONG ioerr ;
995996
996997psdPipeSetup (nch -> nch_EP0Pipe ,URTF_CLASS |URTF_OTHER ,USR_CLEAR_FEATURE ,UFS_C_PORT_CONNECTION , (ULONG )port );
@@ -1030,7 +1031,7 @@ LONG GM_UNIQUENAME(nClearPortStatus)(struct NepClassHub *nch, UWORD port) {
10301031}
10311032
10321033/* /// "nConfigurePort()" */
1033- struct PsdDevice * GM_UNIQUENAME (nConfigurePort )(struct NepClassHub * nch ,UWORD port ) {
1034+ struct PsdDevice * GM_UNIQUENAME (nConfigurePort )(struct NepClassHubSS * nch ,UWORD port ) {
10341035LONG ioerr ;
10351036LONG delayretries ;
10361037LONG resetretries ;
@@ -1236,7 +1237,7 @@ struct PsdDevice * GM_UNIQUENAME(nConfigurePort)(struct NepClassHub *nch, UWORD
12361237}
12371238
12381239/* /// "nHandleHubMethod()" */
1239- void GM_UNIQUENAME (nHandleHubMethod )(struct NepClassHub * nch ,struct NepHubMsg * nhm ) {
1240+ void GM_UNIQUENAME (nHandleHubMethod )(struct NepClassHubSS * nch ,struct NepHubSSMsg * nhm ) {
12401241ULONG num ;
12411242struct PsdDevice * pd ;
12421243nhm -> nhm_Result = 0 ;
@@ -1305,7 +1306,7 @@ void GM_UNIQUENAME(nHandleHubMethod)(struct NepClassHub *nch, struct NepHubMsg *
13051306}
13061307
13071308/* /// "nHubSuspendDevice()" */
1308- BOOL GM_UNIQUENAME (nHubSuspendDevice )(struct NepClassHub * nch ,struct PsdDevice * pd ) {
1309+ BOOL GM_UNIQUENAME (nHubSuspendDevice )(struct NepClassHubSS * nch ,struct PsdDevice * pd ) {
13091310APTR binding = NULL ;
13101311APTR puc = NULL ;
13111312ULONG num ;
@@ -1334,7 +1335,7 @@ BOOL GM_UNIQUENAME(nHubSuspendDevice)(struct NepClassHub *nch, struct PsdDevice
13341335}
13351336
13361337/* /// "nHubResumeDevice()" */
1337- BOOL GM_UNIQUENAME (nHubResumeDevice )(struct NepClassHub * nch ,struct PsdDevice * pd ) {
1338+ BOOL GM_UNIQUENAME (nHubResumeDevice )(struct NepClassHubSS * nch ,struct PsdDevice * pd ) {
13381339ULONG num ;
13391340BOOL result = FALSE;
13401341LONG ioerr ;