2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id: bootwait.c 55802 2019-03-08 21:47:59Z wawa $
6 #include <aros/debug.h>
7 #include <proto/exec.h>
9 #include <aros/asmcall.h>
10 #include <exec/resident.h>
11 #include <libraries/expansionbase.h>
13 #include LC_LIBDEFS_FILE
17 #if defined(__AROSPLATFORM_SMP__)
18 #include <aros/types/spinlock_s.h>
19 #include <proto/execlock.h>
20 #include <resources/execlock.h>
23 extern const char scsi_LibName
[];
24 extern const char scsi_LibID
[];
25 extern const int scsi_End
;
27 AROS_UFP3(static APTR
, scsi_Wait
,
28 AROS_UFPA(void *, dummy
, D0
),
29 AROS_UFPA(BPTR
, segList
, A0
),
30 AROS_UFPA(struct ExecBase
*, SysBase
, A6
));
32 const struct Resident scsi_BootWait
=
35 (struct Resident
*)&scsi_BootWait
,
40 -49, /* dosboot.resource is -50 */
47 * The purpose of this delay is to wait until device detection is done
48 * before boot sequence enters DOS bootstrap. Without this we reach the
49 * bootstrap earlier than devices are detected (and BootNodes inserted).
50 * As a result, we end up in unbootable system.
51 * Actually, i dislike this solution a bit. I think something else has
52 * to be implemented. However i do not know what. Even if we rewrite
53 * adding BootNodes, bootmenu still has to wait until all nodes are added.
54 * Making device detection synchronous is IMHO not a good option, it will
55 * increase booting time of our OS.
58 AROS_UFH3(static APTR
, scsi_Wait
,
59 AROS_UFPA(void *, dummy
, D0
),
60 AROS_UFPA(BPTR
, segList
, A0
),
61 AROS_UFPA(struct ExecBase
*, SysBase
, A6
))
65 struct scsiBase
*SCSIBase
;
66 #if defined(__AROSPLATFORM_SMP__)
67 void *ExecLockBase
= OpenResource("execlock.resource");
70 #if defined(__AROSPLATFORM_SMP__)
72 ObtainSystemLock(&SysBase
->DeviceList
, SPINLOCK_MODE_READ
, LOCKF_FORBID
);
79 /* We do not want to deal with IORequest and units, so just FindName() */
80 SCSIBase
= (struct scsiBase
*)FindName(&SysBase
->DeviceList
, scsi_LibName
);
82 #if defined(__AROSPLATFORM_SMP__)
84 ReleaseSystemLock(&SysBase
->DeviceList
, LOCKF_FORBID
);
93 D(bug("[SCSI ] Waiting for device detection to complete...\n"));
94 ObtainSemaphore(&SCSIBase
->DetectionSem
);
95 ReleaseSemaphore(&SCSIBase
->DetectionSem
);