* Copyright (c) 1990 The Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* @(#)autoconf.c 5.5 (Berkeley) %G%
* Setup the system to run on the current machine.
* Configure() is called at boot time and initializes the vba
* device tables and the memory controller monitoring. Available
* devices are determined (from possibilities mentioned in ioconf.c),
* and the drivers are initialized.
* The following several variables are related to
* the configuration process, and are used in initializing
int dkn
; /* number of iostat dk numbers assigned so far */
int cold
; /* cold start flag initialized in locore.s */
* Determine i/o configuration for a machine.
if ((boothowto
& RB_ASKNAME
) == 0)
* Configure swap area and related system
* parameter based on device(s) used.
* Configure swap space and related parameters.
register struct swdevt
*swp
;
for (swp
= swdevt
; swp
->sw_dev
> 0; swp
++)
if ( swp
->sw_dev
< 0 || swp
->sw_dev
> nblkdev
) break;
if (bdevsw
[major(swp
->sw_dev
)].d_psize
) {
(*bdevsw
[major(swp
->sw_dev
)].d_psize
)(swp
->sw_dev
);
(swp
->sw_nblks
== 0 || swp
->sw_nblks
> nblks
))
if (dumplo
== 0 && bdevsw
[major(dumpdev
)].d_psize
)
dumplo
= (*bdevsw
[major(dumpdev
)].d_psize
)(dumpdev
) - physmem
;
#define DOSWAP /* change swdevt, argdev, and dumpdev too */
u_long bootdev
; /* should be dev_t, but not until 32 bits */
static char devname
[][2] = {
#define PARTITIONMASK 0x7
* Attempt to find the device from which we were booted.
* If we can do so, and not instructed not to do so,
* change rootdev to correspond to the load device.
int majdev
, mindev
, unit
, part
, adaptor
;
if (boothowto
& RB_DFLTROOT
||
(bootdev
& B_MAGICMASK
) != (u_long
)B_DEVMAGIC
)
majdev
= (bootdev
>> B_TYPESHIFT
) & B_TYPEMASK
;
if (majdev
> sizeof(devname
) / sizeof(devname
[0]))
adaptor
= (bootdev
>> B_ADAPTORSHIFT
) & B_ADAPTORMASK
;
part
= (bootdev
>> B_PARTITIONSHIFT
) & B_PARTITIONMASK
;
unit
= (bootdev
>> B_UNITSHIFT
) & B_UNITMASK
;
mindev
= (unit
<< PARTITIONSHIFT
) + part
;
rootdev
= makedev(majdev
, mindev
);
* If the original rootdev is the same as the one
* just calculated, don't need to adjust the swap configuration.
printf("changing root device to %c%c%d%c\n",
devname
[majdev
][0], devname
[majdev
][1],
mindev
>> PARTITIONSHIFT
, part
+ 'a');
mindev
&= ~PARTITIONMASK
;
for (swp
= swdevt
; swp
->sw_dev
; swp
++) {
if (majdev
== major(swp
->sw_dev
) &&
mindev
== (minor(swp
->sw_dev
) & ~PARTITIONMASK
)) {
swdevt
[0].sw_dev
= swp
->sw_dev
;
* If argdev and dumpdev were the same as the old primary swap
* device, move them to the new primary swap device.
dumpdev
= swdevt
[0].sw_dev
;
argdev
= swdevt
[0].sw_dev
;