Skip to content

Commit c194895

Browse files
committed
Set sagasd.device to DIRECT_ACCESS (non removable) to support boot from SD with SFS1.280
1 parent 4b6b501 commit c194895

12 files changed

Lines changed: 83 additions & 72 deletions

File tree

arch/m68k-amiga/devs/sagasd/sagasd_device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ static LONG SAGASD_PerformIO(struct IORequest *io)
668668
geom->dg_TrackSectors = SAGASD_SECTORS;
669669
geom->dg_BufMemType = MEMF_PUBLIC;
670670
geom->dg_DeviceType = DG_DIRECT_ACCESS;
671-
geom->dg_Flags = DGF_REMOVABLE;
671+
geom->dg_Flags = 0; //DGF_REMOVABLE; [WD]: We need to clear this to allow SFS to boot from SD-Card
672672
iostd->io_Actual = sizeof(*geom);
673673
err = 0;
674674
debug("\t[%s] geom->dg_SectorSize = %10ld", __FUNCTION__ , geom->dg_SectorSize);

rom/dos/cliinit.c

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright © 1995-2020, The AROS Development Team. All rights reserved.
2+
Copyright 1995-2020, The AROS Development Team. All rights reserved.
33
$Id$
44
55
Desc:
@@ -157,7 +157,7 @@ static LONG internalBootCliHandler(void);
157157

158158
DeleteMsgPort(reply_mp);
159159

160-
D(bug("Dos/CliInit: Process returned Res1=%ld, Res2=%ld\n", Res1, Res2));
160+
DD(bug("Dos/CliInit: Process returned Res1=%ld, Res2=%ld\n", Res1, Res2));
161161

162162
/* Did we succeed? */
163163
if (Res1 == DOSTRUE)
@@ -248,27 +248,27 @@ static void internalPatchBootNode(struct FileSysResource *fsr, struct DeviceNode
248248
/* If the DosType is 0 and dn_Handler == BNULL, use the default handler */
249249
if (de->de_DosType == 0 && dn->dn_Handler == BNULL)
250250
{
251-
D(bug("Dos/CliInit: Neither DosType nor Handler specified, using default filesystem\n"));
251+
DD(bug("Dos/CliInit: Neither DosType nor Handler specified, using default filesystem\n"));
252252
dn->dn_SegList = defseg;
253253
dn->dn_GlobalVec = (BPTR)-1;
254254
return;
255255
}
256256

257257
/* If no FileSysResource, nothing to do */
258258
if (fsr == NULL) {
259-
D(bug("Dos/CliInit: No FileSystem.resource, not patching DeviceNode %p\n", dn));
259+
DD(bug("Dos/CliInit: No FileSystem.resource, not patching DeviceNode %p\n", dn));
260260
return;
261261
}
262262

263-
D(bug("Dos/CliInit: Looking for patches for DeviceNode %p\n", dn));
263+
DD(bug("Dos/CliInit: Looking for patches for DeviceNode %p\n", dn));
264264

265265
/*
266266
* internalMatchFileSystemResourceHandler looks up the filesystem
267267
*/
268268
fse = internalMatchFileSystemResourceHandler(fsr, de->de_DosType, dn->dn_Handler);
269269
if (fse != NULL)
270270
{
271-
D(bug("Dos/CliInit: found 0x%p in FileSystem.resource\n", fse));
271+
DD(bug("Dos/CliInit: found 0x%p in FileSystem.resource\n", fse));
272272
PRINT_DOSTYPE(fse->fse_DosType);
273273

274274
dn->dn_SegList = fse->fse_SegList;
@@ -296,7 +296,7 @@ static struct MsgPort *mountBootNode(struct DeviceNode *dn, struct FileSysResour
296296
if ((dn == NULL) || (dn->dn_Name == BNULL))
297297
return NULL;
298298

299-
D(bug("Dos/CliInit: Mounting 0x%p (%b)...\n", dn, dn->dn_Name));
299+
DD(bug("Dos/CliInit: Mounting 0x%p (%b)...\n", dn, dn->dn_Name));
300300

301301
/* Check if the device is already in DOS list */
302302
dl = LockDosList(LDF_DEVICES | LDF_READ);
@@ -312,7 +312,7 @@ static struct MsgPort *mountBootNode(struct DeviceNode *dn, struct FileSysResour
312312
/* Found in DOS list? Do nothing. */
313313
if (dl)
314314
{
315-
D(bug("Dos/CliInit: Found in DOS list, nothing to do\n"));
315+
DD(bug("Dos/CliInit: Found in DOS list, nothing to do\n"));
316316
return dl->dol_Task;
317317
}
318318

@@ -322,7 +322,7 @@ static struct MsgPort *mountBootNode(struct DeviceNode *dn, struct FileSysResour
322322
if (!dn->dn_Handler && !dn->dn_SegList)
323323
{
324324
/* Don't know how to mount? Error... */
325-
D(bug("Dos/CliInit: Don't know how to mount\n"));
325+
DD(bug("Dos/CliInit: Don't know how to mount\n"));
326326
return NULL;
327327
}
328328

@@ -333,18 +333,18 @@ static struct MsgPort *mountBootNode(struct DeviceNode *dn, struct FileSysResour
333333
* a) On the Amiga ADNF_STARTPROC was not present in KS 1.3 and earlier, there was no deferred mount.
334334
* b) In fact if we have something in ExpansionBase, we for sure want it to be mounted.
335335
*/
336-
D(bug("Dos/CliInit: Added to DOS list, starting up handler...\n"));
336+
DD(bug("Dos/CliInit: Added to DOS list, starting up handler...\n"));
337337

338338
if (RunHandler(dn, NULL, DOSBase))
339339
{
340-
D(bug("dn->dn_Task = 0x%p\n", dn->dn_Task));
340+
DD(bug("dn->dn_Task = 0x%p\n", dn->dn_Task));
341341
return dn->dn_Task;
342342
}
343343

344-
D(bug("Failed\n"));
344+
DD(bug("Failed\n"));
345345
RemDosEntry((struct DosList *)dn);
346346
}
347-
D(else bug("Dos/CliInit: AddDosEntry() failed\n"));
347+
DD(else bug("Dos/CliInit: AddDosEntry() failed\n"));
348348

349349
/*
350350
* TODO: AddDosEntry() can fail in case of duplicate name. In this case it would be useful
@@ -376,7 +376,7 @@ static BPTR internalBootLock(struct DosLibrary *DOSBase, struct ExpansionBase *E
376376
*/
377377
ObtainSemaphore(&IntExpBase(ExpansionBase)->BootSemaphore);
378378
bn = (struct BootNode *)GetHead(&ExpansionBase->MountList);
379-
D(bug("Dos/CliInit: MountList head: 0x%p\n", bn));
379+
DD(bug("Dos/CliInit: MountList head: 0x%p\n", bn));
380380

381381
if (bn == NULL)
382382
{
@@ -394,7 +394,7 @@ static BPTR internalBootLock(struct DosLibrary *DOSBase, struct ExpansionBase *E
394394
return BNULL;
395395
}
396396

397-
D(bug("Dos/CliInit: %b (%d) appears usable\n", dn->dn_Name, bn->bn_Node.ln_Pri));
397+
DD(bug("Dos/CliInit: %b (%d) appears usable\n", dn->dn_Name, bn->bn_Node.ln_Pri));
398398

399399
/* Try to find a Lock for 'name:' */
400400
name_len = AROS_BSTR_strlen(dn->dn_Name);
@@ -407,10 +407,10 @@ static BPTR internalBootLock(struct DosLibrary *DOSBase, struct ExpansionBase *E
407407
CopyMem(AROS_BSTR_ADDR(dn->dn_Name), name, name_len);
408408
name[name_len+0] = ':';
409409
name[name_len+1] = 0;
410-
D(bug("Dos/CliInit: Attempt to Lock(\"%s\")... ", name));
410+
DD(bug("Dos/CliInit: Attempt to Lock(\"%s\")... ", name));
411411

412412
lock = Lock(name, SHARED_LOCK);
413-
D(bug("=> 0x%p\n", BADDR(lock)));
413+
DD(bug("=> 0x%p\n", BADDR(lock)));
414414

415415
if (lock != BNULL)
416416
{
@@ -435,11 +435,11 @@ static BPTR internalBootLock(struct DosLibrary *DOSBase, struct ExpansionBase *E
435435
SIPTR dead;
436436

437437
/* Darn. Not bootable. Try to unmount it. */
438-
D(bug("Dos/CliInit: Does not have a bootable filesystem, unmounting...\n"));
438+
DD(bug("Dos/CliInit: Does not have a bootable filesystem, unmounting...\n"));
439439

440440
/* It's acceptable if this fails */
441441
dead = DoPkt(mp, ACTION_DIE, 0, 0, 0, 0, 0);
442-
D(bug("Dos/CliInit: ACTION_DIE returned %ld\n", dead));
442+
DD(bug("Dos/CliInit: ACTION_DIE returned %ld\n", dead));
443443

444444
if (dead)
445445
{
@@ -500,7 +500,7 @@ static LONG internalBootCliHandler(void)
500500

501501
DOSBase = (APTR)TaggedOpenLibrary(TAGGEDOPEN_DOS);
502502
if (DOSBase == NULL) {
503-
D(bug("Dos/CliInit: failed to open dos.library!\n"));
503+
DD(bug("Dos/CliInit: failed to open dos.library!\n"));
504504
Alert(AT_DeadEnd | AG_OpenLib | AO_DOSLib);
505505
}
506506

@@ -518,7 +518,7 @@ static LONG internalBootCliHandler(void)
518518

519519
/* Find and Lock the proposed boot device */
520520
lock = internalBootLock(DOSBase, ExpansionBase, fsr);
521-
D(bug("Dos/CliInit: Proposed SYS: lock is: %p\n", BADDR(lock)));
521+
DD(bug("Dos/CliInit: Proposed SYS: lock is: %p\n", BADDR(lock)));
522522
if (lock == BNULL)
523523
err = IoErr();
524524
}
@@ -556,7 +556,7 @@ static LONG internalBootCliHandler(void)
556556
lock = Lock("SYS:", SHARED_LOCK);
557557
if (lock == BNULL)
558558
{
559-
D(bug("DOS/CliInit: Impossible! The SYS: assign failed!\n"));
559+
DD(bug("DOS/CliInit: Impossible! The SYS: assign failed!\n"));
560560
Alert(AT_DeadEnd | AG_BadParm | AN_DOSLib);
561561
}
562562

@@ -592,11 +592,11 @@ static LONG internalBootCliHandler(void)
592592
* This means the handler needs to be loaded from disk (fat-handler for example).
593593
* Here we can already do it.
594594
*/
595-
D(bug("Dos/CliInit: Assigns done, mount remaining handlers...\n"));
595+
DD(bug("Dos/CliInit: Assigns done, mount remaining handlers...\n"));
596596

597597
BootFlags = IntExpBase(ExpansionBase)->BootFlags;
598598
Flags = ExpansionBase->Flags;
599-
D(bug("Dos/CliInit: BootFlags 0x%lx Flags 0x%x\n", BootFlags, Flags));
599+
DD(bug("Dos/CliInit: BootFlags 0x%lx Flags 0x%x\n", BootFlags, Flags));
600600

601601
ForeachNodeSafe(&ExpansionBase->MountList, bn, tmpbn)
602602
{
@@ -617,14 +617,14 @@ static LONG internalBootCliHandler(void)
617617
bootProc->pr_WindowPtr = bootWin;
618618

619619
/* Init all the RTF_AFTERDOS code, since we now have SYS:, the dos devices, and all the other assigns */
620-
D(bug("Dos/CliInit: Calling InitCode(RTF_AFTERDOS, 0)\n"));
620+
DD(bug("Dos/CliInit: Calling InitCode(RTF_AFTERDOS, 0)\n"));
621621
InitCode(RTF_AFTERDOS, 0);
622622

623623
/* Call the platform-overridable portions */
624-
D(bug("Dos/CliInit: Calling __dos_Boot(%p, 0x%lx, 0x%x)\n", DOSBase, BootFlags, Flags));
624+
DD(bug("Dos/CliInit: Calling __dos_Boot(%p, 0x%lx, 0x%x)\n", DOSBase, BootFlags, Flags));
625625
__dos_Boot(DOSBase, BootFlags, Flags);
626626

627-
D(bug("Dos/CliInit: Boot sequence exited\n"));
627+
DD(bug("Dos/CliInit: Boot sequence exited\n"));
628628
CloseLibrary((APTR)DOSBase);
629629

630630
/* And exit... */

rom/dos/close.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
/*
2-
Copyright © 1995-2013, The AROS Development Team. All rights reserved.
2+
Copyright 1995-2013, The AROS Development Team. All rights reserved.
33
$Id$
44
55
Desc:
66
Lang: English
77
*/
88

9+
#include <aros/debug.h>
910
#include <proto/exec.h>
1011
#include <dos/dosextens.h>
1112

1213
#include <proto/dos.h>
1314
#include "dos_intern.h"
14-
#include <aros/debug.h>
15+
1516

1617
/*****************************************************************************
1718

rom/dos/dos_intern.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
#if DEBUG
3131
#define DD(x) x
32-
#define D(x)
32+
#define D(x)
3333
#define bug kprintf
3434
#else
3535
#define D(x)

rom/dos/fs_driver.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright © 2011-2014, The AROS Development Team. All rights reserved.
2+
Copyright 2011-2014, The AROS Development Team. All rights reserved.
33
$Id$
44
55
Desc: Low-level filesystem access functions, packet version
@@ -16,6 +16,8 @@
1616

1717
LONG fs_LocateObject(BPTR *ret, struct MsgPort *port, BPTR parent, CONST_STRPTR name, LONG accessMode, struct DosLibrary *DOSBase)
1818
{
19+
D(bug("[fs_driver] fs_LocateObject('%s', %d)\n", name, accessMode));
20+
1921
SIPTR error = 0;
2022
BSTR bstrname = C2BSTR(name);
2123

@@ -25,6 +27,8 @@ LONG fs_LocateObject(BPTR *ret, struct MsgPort *port, BPTR parent, CONST_STRPTR
2527
*ret = (BPTR)dopacket3(DOSBase, &error, port, ACTION_LOCATE_OBJECT, parent, bstrname, accessMode);
2628
FREEC2BSTR(bstrname);
2729

30+
D(bug("[fs_driver] fs_LocateObject returned %p, error=%d\n", *ret, error));
31+
2832
return (*ret) ? 0 : error;
2933
}
3034

rom/dos/getdeviceproc.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright © 1995-2017, The AROS Development Team. All rights reserved.
2+
Copyright 1995-2017, The AROS Development Team. All rights reserved.
33
$Id$
44
55
Desc: GetDeviceProc() - Find the filesystem for a path.
@@ -70,12 +70,9 @@ static struct DevProc *deviceproc_internal(struct DosLibrary *DOSBase, CONST_STR
7070
D(bug("[GetDeviceProc] '%s':0x%p\n", name, dp));
7171
dp2 = deviceproc_internal(DOSBase, name, dp);
7272

73-
#if DEBUG
74-
bug("[GetDeviceProc] = 0x%p", dp2);
75-
if (dp2)
76-
bug(", port=0x%p lock=0x%p dv=0x%p\n", dp2->dvp_Port, dp2->dvp_Lock, dp2->dvp_DevNode);
77-
RawPutChar('\n');
78-
#endif
73+
D(bug("[GetDeviceProc] = 0x%p", dp2);)
74+
D(if (dp2) D(bug(", port=0x%p lock=0x%p dv=0x%p\n", dp2->dvp_Port, dp2->dvp_Lock, dp2->dvp_DevNode);))
75+
D(RawPutChar('\n');)
7976

8077
return dp2;
8178

rom/dos/lock.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright © 1995-2011, The AROS Development Team. All rights reserved.
2+
Copyright 1995-2011, The AROS Development Team. All rights reserved.
33
$Id$
44
55
Desc: Locks a file or directory.
@@ -176,11 +176,16 @@ static LONG InternalLock(CONST_STRPTR name, LONG accessMode,
176176
return ret;
177177

178178
filename = strchr(name, ':');
179+
180+
D(bug("[Lock] '%s' accessMode=%d, soft_nesting=%d, filename=%s\n", name, accessMode, soft_nesting, filename));
181+
179182
if (!filename)
180183
{
181184
struct MsgPort *port;
182185
BPTR lock;
183186

187+
D(bug("[Lock] No FileName in path, using current directory\n"));
188+
184189
/* No ':' in the pathname, path is relative to current directory */
185190
cur = me->pr_CurrentDir;
186191
if (cur && cur != (BPTR)-1) {
@@ -197,6 +202,7 @@ static LONG InternalLock(CONST_STRPTR name, LONG accessMode,
197202
else
198203
{
199204
filename++;
205+
D(bug("[Lock] FileName in path, using device %s\n", filename));
200206
do
201207
{
202208
if ((dvp = GetDeviceProc(name, dvp)) == NULL)
@@ -211,23 +217,14 @@ static LONG InternalLock(CONST_STRPTR name, LONG accessMode,
211217

212218
if (error == ERROR_NO_MORE_ENTRIES)
213219
error = me->pr_Result2 = ERROR_OBJECT_NOT_FOUND;
214-
215-
#ifndef __mc68000
216-
/* FIXME: On Linux hosted we sometimes get ERROR_IS_SOFTLINK with dvp == NULL,
217-
* which causes segfaults below if we don't change "error". Adding !dvp below
218-
* is probably a hack.
219-
*
220-
* This is wrong, GetDeviceProc() can return other errors than ERROR_OBJECT_NOT_FOUND.
221-
*/
222-
if (!dvp)
223-
error = me->pr_Result2 = ERROR_OBJECT_NOT_FOUND;
224-
#endif
225220
}
226221

227222
if (error == ERROR_IS_SOFT_LINK)
228223
{
229224
STRPTR softname = ResolveSoftlink(cur, dvp, name, DOSBase);
230225

226+
D(bug("[Lock] Softlink resolved to %s\n", softname));
227+
231228
if (softname)
232229
{
233230
BPTR olddir = BNULL;
@@ -242,6 +239,7 @@ static LONG InternalLock(CONST_STRPTR name, LONG accessMode,
242239
{
243240
olddir = me->pr_CurrentDir;
244241
error = RootDir(dvp, DOSBase);
242+
D(bug("[Lock] Changed current directory to %p, error=%d\n", me->pr_CurrentDir, error));
245243
}
246244
else
247245
error = 0;
@@ -266,6 +264,8 @@ static LONG InternalLock(CONST_STRPTR name, LONG accessMode,
266264

267265
if (error)
268266
{
267+
D(bug("[Lock] failed, err=%d\n", error));
268+
269269
SetIoErr(error);
270270
ret = DOSFALSE;
271271
}

rom/dos/namefrom.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
/*
2-
Copyright © 1995-2007, The AROS Development Team. All rights reserved.
2+
Copyright 1995-2007, The AROS Development Team. All rights reserved.
33
$Id$
44
55
Desc: Retrieve the full pathname from a lock or a filehandle.
66
Lang: english
77
*/
88

9+
#include <aros/debug.h>
910
#include <proto/exec.h>
1011
#include "dos_intern.h"
1112
#include <proto/dos.h>
12-
#include <aros/debug.h>
13+
1314

1415
BOOL namefrom_internal(struct DosLibrary *DOSBase, BPTR lock, STRPTR buffer, LONG length)
1516
{

0 commit comments

Comments
 (0)