2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
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 ata_LibName
[];
24 extern const char ata_LibID
[];
25 extern const int ata_End
;
27 AROS_UFP3(static APTR
, ata_Wait
,
28 AROS_UFPA(void *, dummy
, D0
),
29 AROS_UFPA(BPTR
, segList
, A0
),
30 AROS_UFPA(struct ExecBase
*, SysBase
, A6
));
32 const struct Resident ata_BootWait
=
35 (struct Resident
*)&ata_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
, ata_Wait
,
59 AROS_UFPA(void *, dummy
, D0
),
60 AROS_UFPA(BPTR
, segList
, A0
),
61 AROS_UFPA(struct ExecBase
*, SysBase
, A6
))
65 struct ataBase
*ATABase
;
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 ATABase
= (struct ataBase
*)FindName(&SysBase
->DeviceList
, ata_LibName
);
82 #if defined(__AROSPLATFORM_SMP__)
84 ReleaseSystemLock(&SysBase
->DeviceList
, LOCKF_FORBID
);
93 D(bug("[ATA ] Waiting for device detection to complete...\n"));
94 ObtainSemaphore(&ATABase
->DetectionSem
);
95 ReleaseSemaphore(&ATABase
->DetectionSem
);