some fixes to accented characters
[tangerine.git] / rom / expansion / addbootnode.c
blob35bdf67487253393b01492c7fccfeca6c80c31ed
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Add a bootable device into the system.
6 Lang: english
7 */
9 #include "expansion_intern.h"
10 #include <exec/memory.h>
11 #include <exec/execbase.h>
12 #include <dos/filehandler.h>
13 #include <proto/exec.h>
15 /*****************************************************************************
17 NAME */
18 #include <libraries/configvars.h>
19 #include <proto/expansion.h>
21 AROS_LH4(BOOL, AddBootNode,
23 /* SYNOPSIS */
24 AROS_LHA(LONG , bootPri, D0),
25 AROS_LHA(ULONG , flags, D1),
26 AROS_LHA(struct DeviceNode *, deviceNode, A0),
27 AROS_LHA(struct ConfigDev *, configDev, A1),
29 /* LOCATION */
30 struct ExpansionBase *, ExpansionBase, 6, Expansion)
32 /* FUNCTION
33 AddBootNode() will add a device into the system. It does this in
34 one of two ways:
36 1. If DOS is running, add the device to DOS's list of devices
37 immediately.
38 2. Otherwise, save the information for later use by DOS, possibly
39 as a boot device.
41 This allows device drivers to add devices into the systems disk
42 device list at any time, without having to worry about whether DOS
43 is available.
45 If a device is added before DOS is running, then it is possible for
46 the device to be used as a boot device. This allows for the user
47 to choose which device he/she wishes to boot from, and even which
48 OS they may wish to boot from.
50 The bootstrap will attempt to boot from the highest priority device
51 on the Expansion eb_BootNode list, and if that fails continue
52 through the list until it can succeed.
54 Floppy disk devices should always be given the highest priority, to
55 allow a user to prevent a hard disk or network boot by inserting a
56 floppy disk.
58 AddBootNode() will also perform a second bit of magic, that if there
59 is no filesystem specified for this device, (ie dn_SegList, dn_Task
60 and dn_Handler are all NULL), then the standard DOS filesystem
61 will be used for this device.
63 INPUTS
64 bootPri - a BYTE describing the boot priority for this disk.
65 Recommended priorities are:
67 +5 - unit 0 on the floppy disk. The floppy
68 should be the highest priority.
69 0 - standard hard disk priority
70 -5 - recommended for a network disk
71 -128 - don't bother trying
73 flags - Additional information:
75 ADNF_STARTPROC (bit 0)-
76 if set this will cause AddBootNode() to start
77 a filesystem handler for the device node from
78 the information contained in the deviceNode
79 packet. This bit is only useful when there is
80 no running handler for this task (ie dn_Task
81 is NULL).
83 deviceNode - DOS device node for this device. Typically created
84 by MakeDosNode().
86 configDev - A valid expansion board ConfigDev structure, this
87 is required for an autoboot before DOS is running.
88 If left NULL, this will make the node non-bootable.
90 RESULT
91 TRUE if everything was ok,
92 FALSE if for some reason we failed (lack of memory etc).
94 NOTES
95 The address of the ConfigDev structure is stored in the ln_Name
96 field of the BootNode structure.
98 EXAMPLE
100 BUGS
102 SEE ALSO
103 AddDosNode()
105 INTERNALS
107 HISTORY
109 *****************************************************************************/
111 AROS_LIBFUNC_INIT
113 struct BootNode *bn;
115 /* This basically uses AddDosNode() to do all its work, however we
116 ourselves have to add the bootnode. Unfortunately
119 /* Is this enough of a test? */
120 if(FindName((struct List *)&SysBase->LibList, "dos.library") == NULL)
122 if((bn = AllocMem(sizeof(struct BootNode), MEMF_CLEAR|MEMF_PUBLIC)))
124 bn->bn_Node.ln_Name = (STRPTR)configDev;
125 bn->bn_Node.ln_Type = NT_BOOTNODE;
126 bn->bn_Node.ln_Pri = bootPri;
127 bn->bn_Flags = flags;
128 bn->bn_DeviceNode = deviceNode;
130 Enqueue( &ExpansionBase->MountList, (struct Node *)bn );
132 else
133 return FALSE;
136 /* We now let AddDosNode() do all the hard work */
137 return AddDosNode(bootPri, flags, deviceNode);
139 AROS_LIBFUNC_EXIT
140 } /* AddBootNode */