Don't pass a nam2blk around at all; just have setroot() and friends reference
dev_name2blk[] directly. Addresses PR #7622 (ITOH Yasufumi), although in a different way.
This commit is contained in:
parent
12006f3c05
commit
d76e7b8c6d
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.33 1999/02/23 03:20:00 thorpej Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.34 1999/06/07 20:16:09 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.33 1999/02/23 03:20:00 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.34 1999/06/07 20:16:09 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -69,16 +69,6 @@ struct bootdev_data *bootdev_data;
|
||||
void parse_prom_bootdev __P((void));
|
||||
int atoi __P((char *));
|
||||
|
||||
struct devnametobdevmaj alpha_nam2blk[] = {
|
||||
{ "st", 2 },
|
||||
{ "cd", 3 },
|
||||
{ "md", 6 },
|
||||
{ "sd", 8 },
|
||||
{ "fd", 0 },
|
||||
{ "wd", 4 },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
/*
|
||||
* configure:
|
||||
* called at boot time, configure all devices on system
|
||||
@ -115,7 +105,7 @@ cpu_rootconf()
|
||||
if (booted_device == NULL)
|
||||
printf("WARNING: can't figure what device matches \"%s\"\n",
|
||||
bootinfo.booted_dev);
|
||||
setroot(booted_device, booted_partition, alpha_nam2blk);
|
||||
setroot(booted_device, booted_partition);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.63 1999/04/01 00:17:46 thorpej Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.64 1999/06/07 20:16:10 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Christian E. Hopps
|
||||
@ -50,13 +50,6 @@ int mbmatch __P((struct device *, struct cfdata *, void *));
|
||||
int cold; /* 1 if still booting */
|
||||
#include <sys/kernel.h>
|
||||
|
||||
struct devnametobdevmaj amiga_nam2blk[] = {
|
||||
{ "fd", 2 },
|
||||
{ "sd", 4 },
|
||||
{ "cd", 7 },
|
||||
{ "md", 15 },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
u_long boot_partition;
|
||||
|
||||
/*
|
||||
@ -126,7 +119,7 @@ cpu_rootconf()
|
||||
#ifdef DEBUG_KERNEL_START
|
||||
printf("survived findroot()\n");
|
||||
#endif
|
||||
setroot(booted_device, booted_partition, amiga_nam2blk);
|
||||
setroot(booted_device, booted_partition);
|
||||
#ifdef DEBUG_KERNEL_START
|
||||
printf("survived setroot()\n");
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.29 1999/02/07 09:34:58 jonathan Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.30 1999/06/07 20:16:10 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994-1998 Mark Brinicombe.
|
||||
@ -84,17 +84,6 @@ static void get_device __P((char *name, struct device **devpp, int *partp));
|
||||
static void set_root_device __P((void));
|
||||
#endif
|
||||
|
||||
/* Table major numbers for the device names, NULL terminated */
|
||||
|
||||
struct devnametobdevmaj arm32_nam2blk[] = {
|
||||
{ "wd", 16 },
|
||||
{ "fd", 17 },
|
||||
{ "md", 18 },
|
||||
{ "sd", 24 },
|
||||
{ "cd", 26 },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
#ifndef MEMORY_DISK_IS_ROOT
|
||||
/* Decode a device name to a major and minor number */
|
||||
|
||||
@ -114,10 +103,10 @@ get_device(name, devpp, partp)
|
||||
if (strncmp(name, "/dev/", 5) == 0)
|
||||
name += 5;
|
||||
|
||||
for (loop = 0; arm32_nam2blk[loop].d_name != NULL; ++loop) {
|
||||
if (strncmp(name, arm32_nam2blk[loop].d_name,
|
||||
strlen(arm32_nam2blk[loop].d_name)) == 0) {
|
||||
name += strlen(arm32_nam2blk[loop].d_name);
|
||||
for (loop = 0; dev_name2blk[loop].d_name != NULL; ++loop) {
|
||||
if (strncmp(name, dev_name2blk[loop].d_name,
|
||||
strlen(dev_name2blk[loop].d_name)) == 0) {
|
||||
name += strlen(dev_name2blk[loop].d_name);
|
||||
unit = part = 0;
|
||||
|
||||
cp = name;
|
||||
@ -130,7 +119,7 @@ get_device(name, devpp, partp)
|
||||
part = *cp - 'a';
|
||||
else if (*cp != '\0' && *cp != ' ')
|
||||
return;
|
||||
sprintf(buf, "%s%d", arm32_nam2blk[loop].d_name, unit);
|
||||
sprintf(buf, "%s%d", dev_name2blk[loop].d_name, unit);
|
||||
for (dv = alldevs.tqh_first; dv != NULL;
|
||||
dv = dv->dv_list.tqe_next) {
|
||||
if (strcmp(buf, dv->dv_xname) == 0) {
|
||||
@ -175,7 +164,7 @@ cpu_rootconf()
|
||||
printf("boot device: %s\n",
|
||||
booted_device != NULL ? booted_device->dv_xname : "<unknown>");
|
||||
#endif
|
||||
setroot(booted_device, booted_partition, arm32_nam2blk);
|
||||
setroot(booted_device, booted_partition);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.28 1998/09/02 11:24:16 leo Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.29 1999/06/07 20:16:10 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Leo Weppelman
|
||||
@ -51,15 +51,6 @@ extern int cold; /* 1 if still booting (locore.s) */
|
||||
int atari_realconfig;
|
||||
#include <sys/kernel.h>
|
||||
|
||||
struct devnametobdevmaj atari_nam2blk[] = {
|
||||
{ "md", 1 },
|
||||
{ "fd", 2 },
|
||||
{ "sd", 4 },
|
||||
{ "cd", 6 },
|
||||
{ "wd", 14 },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
/*
|
||||
* called at boot time, configure all devices on system
|
||||
*/
|
||||
@ -83,7 +74,7 @@ cpu_rootconf()
|
||||
int booted_partition;
|
||||
|
||||
findroot(&booted_device, &booted_partition);
|
||||
setroot(booted_device, booted_partition, atari_nam2blk);
|
||||
setroot(booted_device, booted_partition);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.1 1997/10/14 06:47:20 sakamoto Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.2 1999/06/07 20:16:10 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -68,16 +68,6 @@ void findroot __P((struct device **, int *));
|
||||
*/
|
||||
extern int cold; /* cold start flag initialized in locore.s */
|
||||
|
||||
struct devnametobdevmaj bebox_nam2blk[] = {
|
||||
{ "wd", 0 },
|
||||
{ "sd", 4 },
|
||||
{ "cd", 6 },
|
||||
{ "mcd", 7 },
|
||||
{ "fd", 2 },
|
||||
{ "md", 17 },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
/*
|
||||
* Determine i/o configuration for a machine.
|
||||
*/
|
||||
@ -108,7 +98,7 @@ cpu_rootconf()
|
||||
printf("boot device: %s\n",
|
||||
booted_device ? booted_device->dv_xname : "<unknown>");
|
||||
|
||||
setroot(booted_device, booted_partition, bebox_nam2blk);
|
||||
setroot(booted_device, booted_partition);
|
||||
}
|
||||
|
||||
u_long bootdev = 0; /* should be dev_t, but not until 32 bits */
|
||||
@ -141,16 +131,16 @@ findroot(devpp, partp)
|
||||
return;
|
||||
|
||||
majdev = (bootdev >> B_TYPESHIFT) & B_TYPEMASK;
|
||||
for (i = 0; bebox_nam2blk[i].d_name != NULL; i++)
|
||||
if (majdev == bebox_nam2blk[i].d_maj)
|
||||
for (i = 0; dev_name2blk[i].d_name != NULL; i++)
|
||||
if (majdev == dev_name2blk[i].d_maj)
|
||||
break;
|
||||
if (bebox_nam2blk[i].d_name == NULL)
|
||||
if (dev_name2blk[i].d_name == NULL)
|
||||
return;
|
||||
|
||||
part = (bootdev >> B_PARTITIONSHIFT) & B_PARTITIONMASK;
|
||||
unit = (bootdev >> B_UNITSHIFT) & B_UNITMASK;
|
||||
|
||||
sprintf(buf, "%s%d", bebox_nam2blk[i].d_name, unit);
|
||||
sprintf(buf, "%s%d", dev_name2blk[i].d_name, unit);
|
||||
for (dv = alldevs.tqh_first; dv != NULL;
|
||||
dv = dv->dv_list.tqe_next) {
|
||||
if (strcmp(buf, dv->dv_xname) == 0) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.45 1999/04/10 17:31:02 kleink Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.46 1999/06/07 20:16:10 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
@ -255,14 +255,6 @@ mainbussearch(parent, cf, aux)
|
||||
return (0);
|
||||
}
|
||||
|
||||
struct devnametobdevmaj hp300_nam2blk[] = {
|
||||
{ "ct", 0 },
|
||||
{ "rd", 2 },
|
||||
{ "sd", 4 },
|
||||
{ "md", 14 },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
/*
|
||||
* Determine the device configuration for the running system.
|
||||
*/
|
||||
@ -369,7 +361,7 @@ cpu_rootconf()
|
||||
if (booted_device != NULL && booted_device->dv_class == DV_TAPE)
|
||||
boothowto |= RB_ASKNAME;
|
||||
|
||||
setroot(dv, booted_partition, hp300_nam2blk);
|
||||
setroot(dv, booted_partition);
|
||||
|
||||
/*
|
||||
* Set bootdev based on what we found as the root.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.37 1999/04/01 00:37:50 thorpej Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.38 1999/06/07 20:16:11 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -78,16 +78,6 @@ extern int i386_ndisks;
|
||||
*/
|
||||
extern int cold; /* cold start flag initialized in locore.s */
|
||||
|
||||
struct devnametobdevmaj i386_nam2blk[] = {
|
||||
{ "wd", 0 },
|
||||
{ "sd", 4 },
|
||||
{ "cd", 6 },
|
||||
{ "mcd", 7 },
|
||||
{ "fd", 2 },
|
||||
{ "md", 17 },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
/*
|
||||
* Determine i/o configuration for a machine.
|
||||
*/
|
||||
@ -126,7 +116,7 @@ cpu_rootconf()
|
||||
printf("boot device: %s\n",
|
||||
booted_device ? booted_device->dv_xname : "<unknown>");
|
||||
|
||||
setroot(booted_device, booted_partition, i386_nam2blk);
|
||||
setroot(booted_device, booted_partition);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -197,7 +187,7 @@ matchbiosdisks()
|
||||
"%s%d", dv->dv_cfdata->cf_driver->cd_name,
|
||||
dv->dv_unit);
|
||||
|
||||
for (d = i386_nam2blk; d->d_name &&
|
||||
for (d = dev_name2blk; d->d_name &&
|
||||
strcmp(d->d_name, dv->dv_cfdata->cf_driver->cd_name);
|
||||
d++);
|
||||
if (d->d_name == NULL)
|
||||
@ -282,7 +272,7 @@ match_harddisk(dv, bid)
|
||||
/*
|
||||
* lookup major number for disk block device
|
||||
*/
|
||||
i = i386_nam2blk;
|
||||
i = dev_name2blk;
|
||||
while (i->d_name &&
|
||||
strcmp(i->d_name, dv->dv_cfdata->cf_driver->cd_name))
|
||||
i++;
|
||||
@ -437,16 +427,16 @@ found:
|
||||
return;
|
||||
|
||||
majdev = (bootdev >> B_TYPESHIFT) & B_TYPEMASK;
|
||||
for (i = 0; i386_nam2blk[i].d_name != NULL; i++)
|
||||
if (majdev == i386_nam2blk[i].d_maj)
|
||||
for (i = 0; dev_name2blk[i].d_name != NULL; i++)
|
||||
if (majdev == dev_name2blk[i].d_maj)
|
||||
break;
|
||||
if (i386_nam2blk[i].d_name == NULL)
|
||||
if (dev_name2blk[i].d_name == NULL)
|
||||
return;
|
||||
|
||||
part = (bootdev >> B_PARTITIONSHIFT) & B_PARTITIONMASK;
|
||||
unit = (bootdev >> B_UNITSHIFT) & B_UNITMASK;
|
||||
|
||||
sprintf(buf, "%s%d", i386_nam2blk[i].d_name, unit);
|
||||
sprintf(buf, "%s%d", dev_name2blk[i].d_name, unit);
|
||||
for (dv = alldevs.tqh_first; dv != NULL;
|
||||
dv = dv->dv_list.tqe_next) {
|
||||
if (strcmp(buf, dv->dv_xname) == 0) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.50 1999/02/18 07:32:56 scottr Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.51 1999/06/07 20:16:11 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -76,14 +76,6 @@ int booted_partition;
|
||||
static void findbootdev __P((void));
|
||||
static int target_to_unit __P((u_long, u_long, u_long));
|
||||
|
||||
struct devnametobdevmaj mac68k_nam2blk[] = {
|
||||
{ "sd", 4 },
|
||||
{ "cd", 6 },
|
||||
{ "md", 13 },
|
||||
{ "fd", 21 },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
/*
|
||||
* configure:
|
||||
* called at boot time, configure all devices on the system
|
||||
@ -111,7 +103,7 @@ cpu_rootconf()
|
||||
printf("boot device: %s\n",
|
||||
booted_device ? booted_device->dv_xname : "<unknown>");
|
||||
|
||||
setroot(booted_device, booted_partition, mac68k_nam2blk);
|
||||
setroot(booted_device, booted_partition);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -131,10 +123,10 @@ findbootdev()
|
||||
booted_partition = 0; /* Assume root is on partition a */
|
||||
|
||||
major = B_TYPE(bootdev);
|
||||
for (i = 0; mac68k_nam2blk[i].d_name != NULL; i++)
|
||||
if (major == mac68k_nam2blk[i].d_maj)
|
||||
for (i = 0; dev_name2blk[i].d_name != NULL; i++)
|
||||
if (major == dev_name2blk[i].d_maj)
|
||||
break;
|
||||
if (mac68k_nam2blk[i].d_name == NULL)
|
||||
if (dev_name2blk[i].d_name == NULL)
|
||||
return;
|
||||
|
||||
unit = B_UNIT(bootdev);
|
||||
@ -143,7 +135,7 @@ findbootdev()
|
||||
unit = target_to_unit(-1, unit, 0);
|
||||
bootdev |= (unit << B_UNITSHIFT);
|
||||
|
||||
sprintf(buf, "%s%d", mac68k_nam2blk[i].d_name, unit);
|
||||
sprintf(buf, "%s%d", dev_name2blk[i].d_name, unit);
|
||||
for (dv = alldevs.tqh_first; dv != NULL;
|
||||
dv = dv->dv_list.tqe_next) {
|
||||
if (strcmp(buf, dv->dv_xname) == 0) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.11 1999/05/01 10:37:57 tsubai Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.12 1999/06/07 20:16:11 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
@ -117,7 +117,7 @@ cpu_rootconf()
|
||||
printf("boot device: %s\n",
|
||||
booted_device ? booted_device->dv_xname : "<unknown>");
|
||||
|
||||
setroot(booted_device, booted_partition, dev_name2blk);
|
||||
setroot(booted_device, booted_partition);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.19 1999/02/20 00:12:02 scw Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.20 1999/06/07 20:16:11 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -176,14 +176,6 @@ mainbus_print(aux, cp)
|
||||
return (UNCONF);
|
||||
}
|
||||
|
||||
struct devnametobdevmaj mvme68k_nam2blk[] = {
|
||||
{ "sd", 4 },
|
||||
{ "st", 7 },
|
||||
{ "cd", 8 },
|
||||
{ "md", 9 },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
/*
|
||||
* Determine mass storage and memory configuration for a machine.
|
||||
*/
|
||||
@ -208,7 +200,7 @@ cpu_rootconf()
|
||||
printf("boot device: %s\n",
|
||||
(booted_device) ? booted_device->dv_xname : "<unknown>");
|
||||
|
||||
setroot(booted_device, 0, mvme68k_nam2blk);
|
||||
setroot(booted_device, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.3 1998/09/03 13:18:44 tsubai Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.4 1999/06/07 20:16:12 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -124,7 +124,7 @@ cpu_rootconf()
|
||||
printf("boot device: %s\n",
|
||||
booted_device ? booted_device->dv_xname : "<unknown>");
|
||||
|
||||
setroot(booted_device, booted_partition, dev_name2blk);
|
||||
setroot(booted_device, booted_partition);
|
||||
}
|
||||
|
||||
u_long bootdev = 0; /* should be dev_t, but not until 32 bits */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.3 1999/01/31 06:59:30 dbj Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.4 1999/06/07 20:16:12 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -147,14 +147,6 @@ mainbus_print(aux, cp)
|
||||
return (UNCONF);
|
||||
}
|
||||
|
||||
struct devnametobdevmaj next68k_nam2blk[] = {
|
||||
{ "sd", 4 },
|
||||
{ "st", 5 },
|
||||
{ "cd", 6 },
|
||||
{ "md", 13 },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
/*
|
||||
* Determine mass storage and memory configuration for a machine.
|
||||
*/
|
||||
@ -184,7 +176,7 @@ cpu_rootconf()
|
||||
printf("boot device: %s\n",
|
||||
(booted_device) ? booted_device->dv_xname : "<unknown>");
|
||||
|
||||
setroot(booted_device, 0, next68k_nam2blk);
|
||||
setroot(booted_device, 0);
|
||||
}
|
||||
|
||||
#if 0 /* @@@ Does anything use this? Is it a required interface? */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.5 1998/02/24 05:49:28 mycroft Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.6 1999/06/07 20:16:12 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
@ -47,14 +47,6 @@ void findroot __P((void));
|
||||
struct device *booted_device; /* boot device */
|
||||
int booted_partition; /* ...and partition on that device */
|
||||
|
||||
struct devnametobdevmaj powerpc_nam2blk[] = {
|
||||
{ "ofdisk", 0 },
|
||||
#ifdef notyet
|
||||
{ "md", XXX },
|
||||
#endif
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
/*
|
||||
* Determine device configuration for a machine.
|
||||
*/
|
||||
@ -81,7 +73,7 @@ cpu_rootconf()
|
||||
printf("boot device: %s\n",
|
||||
booted_device ? booted_device->dv_xname : "<unknown>");
|
||||
|
||||
setroot(booted_device, booted_partition, powerpc_nam2blk);
|
||||
setroot(booted_device, booted_partition);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.28 1997/03/26 22:39:07 gwr Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.29 1999/06/07 20:16:12 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -63,14 +63,6 @@ extern int cold; /* cold start flag initialized in locore.s */
|
||||
u_long bootdev = 0; /* should be dev_t, but not until 32 bits */
|
||||
struct device *booted_device; /* boot device, set by dk_establish */
|
||||
|
||||
struct devnametobdevmaj pc532_nam2blk[] = {
|
||||
{ "sd", 0 },
|
||||
{ "st", 2 },
|
||||
{ "md", 3 },
|
||||
{ "cd", 4 },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
/*
|
||||
* Determine i/o configuration for a machine.
|
||||
*/
|
||||
@ -106,5 +98,5 @@ cpu_rootconf()
|
||||
printf("boot device: %s\n",
|
||||
booted_device ? booted_device->dv_xname : "<unknown>");
|
||||
|
||||
setroot(booted_device, booted_partition, pc532_nam2blk);
|
||||
setroot(booted_device, booted_partition);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.8 1997/06/16 07:35:46 jonathan Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.9 1999/06/07 20:16:12 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -73,18 +73,6 @@ void findroot __P((struct device **devpp, int *partp));
|
||||
int getpno __P((char **cp));
|
||||
|
||||
|
||||
struct devnametobdevmaj pica_nam2blk[] = {
|
||||
{ "sd", 0 },
|
||||
{ "cd", 3 },
|
||||
{ "fd", 7 },
|
||||
#ifdef notyet
|
||||
{ "md", XXX },
|
||||
#endif
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Configure all devices found that we know about.
|
||||
* This is done at boot time.
|
||||
@ -111,7 +99,7 @@ cpu_rootconf()
|
||||
printf("boot device: %s\n",
|
||||
booted_device ? booted_device->dv_xname : "<unknown>");
|
||||
|
||||
setroot(booted_device, booted_partition, pica_nam2blk);
|
||||
setroot(booted_device, booted_partition);
|
||||
}
|
||||
|
||||
u_long bootdev; /* should be dev_t, but not until 32 bits */
|
||||
@ -144,16 +132,16 @@ findroot(devpp, partp)
|
||||
return;
|
||||
|
||||
majdev = B_TYPE(bootdev);
|
||||
for (i = 0; pica_nam2blk[i].d_name != NULL; i++)
|
||||
if (majdev == pica_nam2blk[i].d_maj)
|
||||
for (i = 0; dev_name2blk[i].d_name != NULL; i++)
|
||||
if (majdev == dev_name2blk[i].d_maj)
|
||||
break;
|
||||
if (pica_nam2blk[i].d_name == NULL)
|
||||
if (dev_name2blk[i].d_name == NULL)
|
||||
return;
|
||||
|
||||
part = B_PARTITION(bootdev);
|
||||
unit = B_UNIT(bootdev);
|
||||
|
||||
sprintf(buf, "%s%d", pica_nam2blk[i].d_name, unit);
|
||||
sprintf(buf, "%s%d", dev_name2blk[i].d_name, unit);
|
||||
for (dv = alldevs.tqh_first; dv != NULL;
|
||||
dv = dv->dv_list.tqe_next) {
|
||||
if (strcmp(buf, dv->dv_xname) == 0) {
|
||||
@ -185,9 +173,9 @@ makebootdev(cp)
|
||||
dv[1] = *cp;
|
||||
unit = getpno(&cp);
|
||||
|
||||
for (majdev = 0; majdev < sizeof(pica_nam2blk)/sizeof(pica_nam2blk[0]); majdev++)
|
||||
if (dv[0] == pica_nam2blk[majdev].d_name[0] &&
|
||||
dv[1] == pica_nam2blk[majdev].d_name[1] &&
|
||||
for (majdev = 0; majdev < sizeof(dev_name2blk)/sizeof(dev_name2blk[0]); majdev++)
|
||||
if (dv[0] == dev_name2blk[majdev].d_name[0] &&
|
||||
dv[1] == dev_name2blk[majdev].d_name[1] &&
|
||||
cp[0] == ')')
|
||||
bootdev = MAKEBOOTDEV(majdev, 0, ctrl, unit,0);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.35 1999/05/31 07:42:56 nisimura Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.36 1999/06/07 20:16:13 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -43,7 +43,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.35 1999/05/31 07:42:56 nisimura Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.36 1999/06/07 20:16:13 thorpej Exp $");
|
||||
|
||||
/*
|
||||
* Setup the system to run on the current machine.
|
||||
@ -140,7 +140,7 @@ cpu_rootconf()
|
||||
printf("boot device: %s\n",
|
||||
booted_device ? booted_device->dv_xname : "<unknown>");
|
||||
|
||||
setroot(booted_device, booted_partition, dev_name2blk);
|
||||
setroot(booted_device, booted_partition);
|
||||
}
|
||||
|
||||
u_long bootdev = 0; /* should be dev_t, but not until 32 bits */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.119 1999/05/27 14:20:10 pk Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.120 1999/06/07 20:16:13 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996
|
||||
@ -856,7 +856,7 @@ cpu_rootconf()
|
||||
printf("\n");
|
||||
cnpollc(0);
|
||||
}
|
||||
setroot(bootdv, bootpartition, dev_name2blk);
|
||||
setroot(bootdv, bootpartition);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.18 1999/06/04 13:55:37 mrg Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.19 1999/06/07 20:16:13 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996
|
||||
@ -518,7 +518,7 @@ cpu_rootconf()
|
||||
bootdv = bp == NULL ? NULL : bp->dev;
|
||||
bootpartition = bp == NULL ? 0 : bp->val[2];
|
||||
|
||||
setroot(bootdv, bootpartition, dev_name2blk);
|
||||
setroot(bootdv, bootpartition);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.51 1998/02/08 05:02:51 gwr Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.52 1999/06/07 20:16:13 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
@ -162,19 +162,6 @@ bus_print(args, name)
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
/*
|
||||
* Support code to find the boot device.
|
||||
*/
|
||||
|
||||
static struct devnametobdevmaj nam2blk[] = {
|
||||
{ "xy", 3 },
|
||||
{ "sd", 7 },
|
||||
{ "xd", 10 },
|
||||
{ "md", 13 },
|
||||
{ "cd", 18 },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
/* This takes the args: name, ctlr, unit */
|
||||
typedef struct device * (*findfunc_t) __P((char *, int, int));
|
||||
|
||||
@ -248,7 +235,7 @@ cpu_rootconf()
|
||||
}
|
||||
|
||||
printf("boot device: %s%s\n", devname, partname);
|
||||
setroot(boot_device, boot_partition, nam2blk);
|
||||
setroot(boot_device, boot_partition);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.37 1999/02/02 18:37:20 ragge Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.38 1999/06/07 20:16:14 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
|
||||
@ -64,17 +64,6 @@ struct device *booted_from;
|
||||
|
||||
#define MAINBUS 0
|
||||
|
||||
struct devnametobdevmaj vax_nam2blk[] = {
|
||||
{ "hp", 0 },
|
||||
{ "ra", 9 },
|
||||
{ "rx", 12 },
|
||||
{ "rd", 19 },
|
||||
{ "sd", 20 },
|
||||
{ "cd", 22 },
|
||||
{ "md", 23 },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
void
|
||||
configure()
|
||||
{
|
||||
@ -108,7 +97,7 @@ cpu_rootconf()
|
||||
printf("boot device: %s\n",
|
||||
booted_device ? booted_device->dv_xname : "<unknown>");
|
||||
|
||||
setroot(booted_device, booted_partition, vax_nam2blk);
|
||||
setroot(booted_device, booted_partition);
|
||||
}
|
||||
|
||||
int mainbus_print __P((void *, const char *));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.18 1999/03/30 04:25:36 minoura Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.19 1999/06/07 20:16:14 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Leo Weppelman
|
||||
@ -63,11 +63,6 @@ extern int cold; /* 1 if still booting (locore.s) */
|
||||
int x68k_realconfig;
|
||||
#include <sys/kernel.h>
|
||||
|
||||
struct devnametobdevmaj x68k_nam2blk[] = {
|
||||
X68K_BOOT_DEV_LIST,
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
/*
|
||||
* called at boot time, configure all devices on system
|
||||
*/
|
||||
@ -98,7 +93,7 @@ cpu_rootconf()
|
||||
printf("boot device: %s\n",
|
||||
booted_device ? booted_device->dv_xname : "<unknown>");
|
||||
|
||||
setroot(booted_device, booted_partition, x68k_nam2blk);
|
||||
setroot(booted_device, booted_partition);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
@ -194,16 +189,16 @@ findroot(devpp, partp)
|
||||
*partp = B_X68K_SCSI_PART(bootdev);
|
||||
return;
|
||||
}
|
||||
for (i = 0; x68k_nam2blk[i].d_name != NULL; i++)
|
||||
if (majdev == x68k_nam2blk[i].d_maj)
|
||||
for (i = 0; dev_name2blk[i].d_name != NULL; i++)
|
||||
if (majdev == dev_name2blk[i].d_maj)
|
||||
break;
|
||||
if (x68k_nam2blk[i].d_name == NULL)
|
||||
if (dev_name2blk[i].d_name == NULL)
|
||||
return;
|
||||
|
||||
part = B_PARTITION(bootdev);
|
||||
unit = B_UNIT(bootdev);
|
||||
|
||||
sprintf(buf, "%s%d", x68k_nam2blk[i].d_name, unit);
|
||||
sprintf(buf, "%s%d", dev_name2blk[i].d_name, unit);
|
||||
|
||||
if ((*devpp = find_dev_byname(buf)) != NULL)
|
||||
*partp = part;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: init_main.c,v 1.151 1999/05/13 21:58:37 thorpej Exp $ */
|
||||
/* $NetBSD: init_main.c,v 1.152 1999/06/07 20:16:09 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Christopher G. Demetriou. All rights reserved.
|
||||
@ -367,7 +367,7 @@ main()
|
||||
printf("cannot mount root, error = %d\n", error);
|
||||
boothowto |= RB_ASKNAME;
|
||||
setroot(root_device,
|
||||
(rootdev != NODEV) ? DISKPART(rootdev) : 0, NULL);
|
||||
(rootdev != NODEV) ? DISKPART(rootdev) : 0);
|
||||
}
|
||||
} while (error != 0);
|
||||
mountroothook_destroy();
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_subr.c,v 1.50 1999/06/02 05:53:56 lukem Exp $ */
|
||||
/* $NetBSD: kern_subr.c,v 1.51 1999/06/07 20:16:09 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
|
||||
@ -107,12 +107,10 @@
|
||||
#include <net/if.h>
|
||||
|
||||
/* XXX these should eventually move to subr_autoconf.c */
|
||||
static int findblkmajor __P((const char *, struct devnametobdevmaj *));
|
||||
static const char *findblkname __P((int, struct devnametobdevmaj *));
|
||||
static struct device *getdisk __P((char *, int, int,
|
||||
struct devnametobdevmaj *, dev_t *, int));
|
||||
static struct device *parsedisk __P((char *, int, int,
|
||||
struct devnametobdevmaj *, dev_t *));
|
||||
static int findblkmajor __P((const char *));
|
||||
static const char *findblkname __P((int));
|
||||
static struct device *getdisk __P((char *, int, int, dev_t *, int));
|
||||
static struct device *parsedisk __P((char *, int, int, dev_t *));
|
||||
static int getstr __P((char *, int));
|
||||
|
||||
int
|
||||
@ -405,10 +403,9 @@ static struct device fakemdrootdev[NMD];
|
||||
#endif
|
||||
|
||||
void
|
||||
setroot(bootdv, bootpartition, nam2blk)
|
||||
setroot(bootdv, bootpartition)
|
||||
struct device *bootdv;
|
||||
int bootpartition;
|
||||
struct devnametobdevmaj *nam2blk;
|
||||
{
|
||||
struct device *dv;
|
||||
int len, print_newline = 0;
|
||||
@ -426,14 +423,6 @@ setroot(bootdv, bootpartition, nam2blk)
|
||||
const char *deffsname;
|
||||
struct vfsops *vops;
|
||||
extern int (*mountroot) __P((void));
|
||||
static struct devnametobdevmaj *last_nam2blk;
|
||||
|
||||
if (nam2blk == NULL) {
|
||||
if (last_nam2blk == NULL)
|
||||
panic("setroot: no name to bdev major map");
|
||||
nam2blk = last_nam2blk;
|
||||
}
|
||||
last_nam2blk = nam2blk;
|
||||
|
||||
#ifdef MEMORY_DISK_HOOKS
|
||||
for (i = 0; i < NMD; i++) {
|
||||
@ -506,15 +495,13 @@ setroot(bootdv, bootpartition, nam2blk)
|
||||
}
|
||||
if (len > 0 && buf[len - 1] == '*') {
|
||||
buf[--len] = '\0';
|
||||
dv = getdisk(buf, len, 1, nam2blk,
|
||||
&nrootdev, 0);
|
||||
dv = getdisk(buf, len, 1, &nrootdev, 0);
|
||||
if (dv != NULL) {
|
||||
rootdv = dv;
|
||||
break;
|
||||
}
|
||||
}
|
||||
dv = getdisk(buf, len, bootpartition, nam2blk,
|
||||
&nrootdev, 0);
|
||||
dv = getdisk(buf, len, bootpartition, &nrootdev, 0);
|
||||
if (dv != NULL) {
|
||||
rootdv = dv;
|
||||
break;
|
||||
@ -557,7 +544,7 @@ setroot(bootdv, bootpartition, nam2blk)
|
||||
dumpspec = "none";
|
||||
goto havedump;
|
||||
}
|
||||
dv = getdisk(buf, len, 1, nam2blk, &ndumpdev, 1);
|
||||
dv = getdisk(buf, len, 1, &ndumpdev, 1);
|
||||
if (dv) {
|
||||
dumpdv = dv;
|
||||
break;
|
||||
@ -616,7 +603,7 @@ setroot(bootdv, bootpartition, nam2blk)
|
||||
*/
|
||||
rootdv = bootdv;
|
||||
|
||||
majdev = findblkmajor(bootdv->dv_xname, nam2blk);
|
||||
majdev = findblkmajor(bootdv->dv_xname);
|
||||
if (majdev >= 0) {
|
||||
/*
|
||||
* Root is on a disk. `bootpartition' is root.
|
||||
@ -643,7 +630,7 @@ setroot(bootdv, bootpartition, nam2blk)
|
||||
goto haveroot;
|
||||
}
|
||||
|
||||
rootdevname = findblkname(major(rootdev), nam2blk);
|
||||
rootdevname = findblkname(major(rootdev));
|
||||
if (rootdevname == NULL) {
|
||||
printf("unknown device major 0x%x\n", rootdev);
|
||||
boothowto |= RB_ASKNAME;
|
||||
@ -735,7 +722,7 @@ setroot(bootdv, bootpartition, nam2blk)
|
||||
goto nodumpdev;
|
||||
}
|
||||
|
||||
dumpdevname = findblkname(major(dumpdev), nam2blk);
|
||||
dumpdevname = findblkname(major(dumpdev));
|
||||
if (dumpdevname == NULL)
|
||||
goto nodumpdev;
|
||||
memset(buf, 0, sizeof(buf));
|
||||
@ -772,43 +759,34 @@ setroot(bootdv, bootpartition, nam2blk)
|
||||
}
|
||||
|
||||
static int
|
||||
findblkmajor(name, nam2blk)
|
||||
findblkmajor(name)
|
||||
const char *name;
|
||||
struct devnametobdevmaj *nam2blk;
|
||||
{
|
||||
int i;
|
||||
|
||||
if (nam2blk == NULL)
|
||||
return (-1);
|
||||
|
||||
for (i = 0; nam2blk[i].d_name != NULL; i++)
|
||||
if (strncmp(name, nam2blk[i].d_name,
|
||||
strlen(nam2blk[i].d_name)) == 0)
|
||||
return (nam2blk[i].d_maj);
|
||||
for (i = 0; dev_name2blk[i].d_name != NULL; i++)
|
||||
if (strncmp(name, dev_name2blk[i].d_name,
|
||||
strlen(dev_name2blk[i].d_name)) == 0)
|
||||
return (dev_name2blk[i].d_maj);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
const char *
|
||||
findblkname(maj, nam2blk)
|
||||
findblkname(maj)
|
||||
int maj;
|
||||
struct devnametobdevmaj *nam2blk;
|
||||
{
|
||||
int i;
|
||||
|
||||
if (nam2blk == NULL)
|
||||
return (NULL);
|
||||
|
||||
for (i = 0; nam2blk[i].d_name != NULL; i++)
|
||||
if (nam2blk[i].d_maj == maj)
|
||||
return (nam2blk[i].d_name);
|
||||
for (i = 0; dev_name2blk[i].d_name != NULL; i++)
|
||||
if (dev_name2blk[i].d_maj == maj)
|
||||
return (dev_name2blk[i].d_name);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static struct device *
|
||||
getdisk(str, len, defpart, nam2blk, devp, isdump)
|
||||
getdisk(str, len, defpart, devp, isdump)
|
||||
char *str;
|
||||
int len, defpart;
|
||||
struct devnametobdevmaj *nam2blk;
|
||||
dev_t *devp;
|
||||
int isdump;
|
||||
{
|
||||
@ -817,7 +795,7 @@ getdisk(str, len, defpart, nam2blk, devp, isdump)
|
||||
int i;
|
||||
#endif
|
||||
|
||||
if ((dv = parsedisk(str, len, defpart, nam2blk, devp)) == NULL) {
|
||||
if ((dv = parsedisk(str, len, defpart, devp)) == NULL) {
|
||||
printf("use one of:");
|
||||
#ifdef MEMORY_DISK_HOOKS
|
||||
if (isdump == 0)
|
||||
@ -841,10 +819,9 @@ getdisk(str, len, defpart, nam2blk, devp, isdump)
|
||||
}
|
||||
|
||||
static struct device *
|
||||
parsedisk(str, len, defpart, nam2blk, devp)
|
||||
parsedisk(str, len, defpart, devp)
|
||||
char *str;
|
||||
int len, defpart;
|
||||
struct devnametobdevmaj *nam2blk;
|
||||
dev_t *devp;
|
||||
{
|
||||
struct device *dv;
|
||||
@ -882,7 +859,7 @@ parsedisk(str, len, defpart, nam2blk, devp)
|
||||
#ifdef MEMORY_DISK_HOOKS
|
||||
gotdisk:
|
||||
#endif
|
||||
majdev = findblkmajor(dv->dv_xname, nam2blk);
|
||||
majdev = findblkmajor(dv->dv_xname);
|
||||
if (majdev < 0)
|
||||
panic("parsedisk");
|
||||
*devp = MAKEDISKDEV(majdev, dv->dv_unit, part);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: conf.h,v 1.66 1998/12/18 16:55:39 drochner Exp $ */
|
||||
/* $NetBSD: conf.h,v 1.67 1999/06/07 20:16:08 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
@ -519,7 +519,7 @@ struct devnametobdevmaj {
|
||||
#ifdef _KERNEL
|
||||
extern struct devnametobdevmaj dev_name2blk[];
|
||||
struct device;
|
||||
void setroot __P((struct device *, int, struct devnametobdevmaj *));
|
||||
void setroot __P((struct device *, int));
|
||||
void swapconf __P((void));
|
||||
#endif /* _KERNEL */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user