patch-2.1.75 linux/init/main.c
Next file: linux/ipc/sem.c
Previous file: linux/include/net/sock.h
Back to the patch index
Back to the overall index
- Lines: 490
- Date:
Sun Dec 21 17:50:46 1997
- Orig file:
v2.1.74/linux/init/main.c
- Orig date:
Fri Dec 19 15:53:05 1997
diff -u --recursive --new-file v2.1.74/linux/init/main.c linux/init/main.c
@@ -33,9 +33,6 @@
#include <linux/major.h>
#include <linux/blk.h>
#include <linux/init.h>
-#ifdef CONFIG_ROOT_NFS
-#include <linux/nfs_fs.h>
-#endif
#include <asm/system.h>
#include <asm/io.h>
@@ -76,6 +73,7 @@
extern void sysctl_init(void);
extern void filescache_init(void);
extern void signals_init(void);
+extern void dquot_init(void);
extern void smp_setup(char *str, int *ints);
extern void no_scroll(char *str, int *ints);
@@ -88,6 +86,9 @@
#ifdef CONFIG_PRINTER
extern void lp_setup(char *str, int *ints);
#endif
+#ifdef CONFIG_JOYSTICK
+extern void js_setup(char *str, int *ints);
+#endif
extern void eth_setup(char *str, int *ints);
#ifdef CONFIG_ARCNET_COM20020
extern void com20020_setup(char *str, int *ints);
@@ -134,10 +135,8 @@
extern void in2000_setup(char *str, int *ints);
extern void NCR53c406a_setup(char *str, int *ints);
extern void wd7000_setup(char *str, int *ints);
-#ifdef NOTDEF
-extern void ppa_setup(char *str, int *ints);
-#endif
extern void scsi_luns_setup(char *str, int *ints);
+extern void scsi_logging_setup(char *str, int *ints);
extern void sound_setup(char *str, int *ints);
extern void reboot_setup(char *str, int *ints);
extern void video_setup(char *str, int *ints);
@@ -259,6 +258,12 @@
#ifdef CONFIG_HFMODEM
extern void hfmodem_setup(char *str, int *ints);
#endif
+#ifdef CONFIG_IP_PNP
+extern void ip_auto_config_setup(char *str, int *ints);
+#endif
+#ifdef CONFIG_ROOT_NFS
+extern void nfs_root_setup(char *str, int *ints);
+#endif
#ifdef CONFIG_FTAPE
extern void ftape_setup(char *str, int *ints);
#endif
@@ -297,13 +302,6 @@
int root_mountflags = MS_RDONLY;
char *execute_command = NULL;
-#ifdef CONFIG_ROOT_NFS
-char nfs_root_name[NFS_ROOT_NAME_LEN] = { "default" };
-char nfs_root_addrs[NFS_ROOT_ADDRS_LEN] = { "" };
-#endif
-
-extern void dquot_init(void);
-
static char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, };
static char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };
@@ -321,6 +319,7 @@
return(cur);
}
+#ifdef CONFIG_PROFILE
__initfunc(static void profile_setup(char *str, int *ints))
{
if (ints[0] > 0)
@@ -332,13 +331,129 @@
prof_shift = 2;
#endif
}
+#endif
+
+
+static struct dev_name_struct {
+ const char *name;
+ const int num;
+} root_dev_names[] __initdata = {
+#ifdef CONFIG_ROOT_NFS
+ { "nfs", 0x00ff },
+#endif
+#ifdef CONFIG_BLK_DEV_IDE
+ { "hda", 0x0300 },
+ { "hdb", 0x0340 },
+ { "hdc", 0x1600 },
+ { "hdd", 0x1640 },
+ { "hde", 0x2100 },
+ { "hdf", 0x2140 },
+ { "hdg", 0x2200 },
+ { "hdh", 0x2240 },
+#endif
+#ifdef CONFIG_BLK_DEV_SD
+ { "sda", 0x0800 },
+ { "sdb", 0x0810 },
+ { "sdc", 0x0820 },
+ { "sdd", 0x0830 },
+ { "sde", 0x0840 },
+#endif
+#ifdef CONFIG_ATARI_ACSI
+ { "ada", 0x1c00 },
+ { "adb", 0x1c10 },
+ { "adc", 0x1c20 },
+ { "add", 0x1c30 },
+ { "ade", 0x1c40 },
+#endif
+#ifdef CONFIG_BLK_DEV_FD
+ { "fd", 0x0200 },
+#endif
+#ifdef CONFIG_BLK_DEV_XD
+ { "xda", 0x0d00 },
+ { "xdb", 0x0d40 },
+#endif
+#ifdef CONFIG_BLK_DEV_RAM
+ { "ram", 0x0100 },
+#endif
+#ifdef CONFIG_BLK_DEV_SR
+ { "scd", 0x0b00 },
+#endif
+#ifdef CONFIG_MCD
+ { "mcd", 0x1700 },
+#endif
+#ifdef CONFIG_CDU535
+ { "cdu535", 0x1800 },
+ { "sonycd", 0x1800 },
+#endif
+#ifdef CONFIG_AZTCD
+ { "aztcd", 0x1d00 },
+#endif
+#ifdef CONFIG_CM206
+ { "cm206cd", 0x2000 },
+#endif
+#ifdef CONFIG_GSCD
+ { "gscd", 0x1000 },
+#endif
+#ifdef CONFIG_SBPCD
+ { "sbpcd", 0x1900 },
+#endif
+#ifdef CONFIG_BLK_DEV_PS2
+ { "eda", 0x2400 },
+ { "eza", 0x2800 },
+#endif
+#ifdef CONFIG_BPCD
+ { "bpcd", 0x2900 },
+#endif
+#if CONFIG_APBLOCK
+ { "apblock", APBLOCK_MAJOR << 8},
+#endif
+#if CONFIG_DDV
+ { "ddv", DDV_MAJOR << 8},
+#endif
+ { NULL, 0 }
+};
+
+__initfunc(static void root_dev_setup(char *line, int *num))
+{
+ int base = 0;
+ if (strncmp(line,"/dev/",5) == 0) {
+ struct dev_name_struct *dev = root_dev_names;
+ line += 5;
+ do {
+ int len = strlen(dev->name);
+ if (strncmp(line,dev->name,len) == 0) {
+ line += len;
+ base = dev->num;
+ break;
+ }
+ dev++;
+ } while (dev->name);
+ }
+ ROOT_DEV = to_kdev_t(base + simple_strtoul(line,NULL,base?10:16));
+}
-struct {
+/*
+ * List of kernel command line parameters. The first table lists parameters
+ * which are subject to values parsing (leading numbers are converted to
+ * an array of ints and chopped off the string), the second table contains
+ * the few exceptions which obey their own syntax rules.
+ */
+
+struct kernel_param {
const char *str;
void (*setup_func)(char *, int *);
-} bootsetups[] __initdata = {
+};
+
+static struct kernel_param cooked_params[] __initdata = {
+/* FIXME: make PNP just become reserve_setup */
+#ifndef CONFIG_KERNEL_PNP_RESOURCE
{ "reserve=", reserve_setup },
+#else
+ { "reserve=", pnp_reserve_setup },
+#endif
+#ifdef CONFIG_PROFILE
{ "profile=", profile_setup },
+#endif
#ifdef __SMP__
{ "nosmp", smp_setup },
{ "maxcpus=", smp_setup },
@@ -389,8 +504,12 @@
#ifdef CONFIG_PRINTER
{ "lp=", lp_setup },
#endif
+#ifdef CONFIG_JOYSTICK
+ { "js=", js_setup },
+#endif
#ifdef CONFIG_SCSI
{ "max_scsi_luns=", scsi_luns_setup },
+ { "scsi_logging=", scsi_logging_setup },
#endif
#ifdef CONFIG_SCSI_ADVANSYS
{ "advansys=", advansys_setup },
@@ -460,9 +579,6 @@
#ifdef CONFIG_SCSI_7000FASST
{ "wd7000=", wd7000_setup},
#endif
-#ifdef NOTDEF /* CONFIG_SCSI_PPA */
- { "ppa=", ppa_setup },
-#endif
#ifdef CONFIG_SCSI_IBMMCA
{ "ibmmcascsi=", ibmmca_scsi_setup },
#endif
@@ -472,7 +588,7 @@
#ifdef CONFIG_BLK_DEV_EZ
{ "ez=", ez_setup },
#endif
-#ifdef CONFIG_BLK_DEV_FD
+#if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_AMIGA_FLOPPY) || defined(CONFIG_ATARI_FLOPPY)
{ "floppy=", floppy_setup },
#endif
#ifdef CONFIG_BLK_DEV_PS2
@@ -599,6 +715,18 @@
{ 0, 0 }
};
+static struct kernel_param raw_params[] __initdata = {
+ { "root=", root_dev_setup },
+#ifdef CONFIG_ROOT_NFS
+ { "nfsroot=", nfs_root_setup },
+ { "nfsaddrs=", ip_auto_config_setup },
+#endif
+#ifdef CONFIG_IP_PNP
+ { "ip=", ip_auto_config_setup },
+#endif
+ { 0, 0 }
+};
+
#ifdef CONFIG_BLK_DEV_RAM
__initfunc(static void ramdisk_start_setup(char *str, int *ints))
{
@@ -623,13 +751,11 @@
if (ints[0] > 0 && ints[1] >= 0)
rd_size = ints[1];
}
-
#endif
__initfunc(static int checksetup(char *line))
{
- int i = 0;
- int ints[11];
+ int i, ints[11];
#ifdef CONFIG_BLK_DEV_IDE
/* ide driver needs the basic string, rather than pre-processed values */
@@ -638,13 +764,19 @@
return 1;
}
#endif
- while (bootsetups[i].str) {
- int n = strlen(bootsetups[i].str);
- if (!strncmp(line,bootsetups[i].str,n)) {
- bootsetups[i].setup_func(get_options(line+n,ints), ints);
+ for (i=0; raw_params[i].str; i++) {
+ int n = strlen(raw_params[i].str);
+ if (!strncmp(line,raw_params[i].str,n)) {
+ raw_params[i].setup_func(line+n, NULL);
+ return 1;
+ }
+ }
+ for (i=0; cooked_params[i].str; i++) {
+ int n = strlen(cooked_params[i].str);
+ if (!strncmp(line,cooked_params[i].str,n)) {
+ cooked_params[i].setup_func(get_options(line+n, ints), ints);
return 1;
}
- i++;
}
return 0;
}
@@ -665,7 +797,7 @@
loops_per_sec = (1<<12);
- printk("Calibrating delay loop.. ");
+ printk("Calibrating delay loop... ");
while (loops_per_sec <<= 1) {
/* wait for "start of" clock tick */
ticks = jiffies;
@@ -696,84 +828,17 @@
/* finally, adjust loops per second in terms of seconds instead of clocks */
loops_per_sec *= HZ;
/* Round the value and print it */
- printk("ok - %lu.%02lu BogoMIPS\n",
+ printk("%lu.%02lu BogoMIPS\n",
(loops_per_sec+2500)/500000,
((loops_per_sec+2500)/5000) % 100);
}
-__initfunc(static void parse_root_dev(char * line))
-{
- int base = 0;
- static struct dev_name_struct {
- const char *name;
- const int num;
- } devices[] = {
- { "nfs", 0x00ff },
- { "hda", 0x0300 },
- { "hdb", 0x0340 },
- { "hdc", 0x1600 },
- { "hdd", 0x1640 },
- { "hde", 0x2100 },
- { "hdf", 0x2140 },
- { "hdg", 0x2200 },
- { "hdh", 0x2240 },
- { "sda", 0x0800 },
- { "sdb", 0x0810 },
- { "sdc", 0x0820 },
- { "sdd", 0x0830 },
- { "sde", 0x0840 },
- { "ada", 0x1c00 },
- { "adb", 0x1c10 },
- { "adc", 0x1c20 },
- { "add", 0x1c30 },
- { "ade", 0x1c40 },
- { "fd", 0x0200 },
- { "xda", 0x0d00 },
- { "xdb", 0x0d40 },
- { "ram", 0x0100 },
- { "scd", 0x0b00 },
- { "mcd", 0x1700 },
- { "cdu535", 0x1800 },
- { "aztcd", 0x1d00 },
- { "cm206cd", 0x2000 },
- { "gscd", 0x1000 },
- { "sbpcd", 0x1900 },
- { "sonycd", 0x1800 },
- { "eda", 0x2400 },
- { "eza", 0x2800 },
- { "bpcd", 0x2900 },
-#if CONFIG_APBLOCK
- { "apblock", APBLOCK_MAJOR << 8},
-#endif
-#if CONFIG_DDV
- { "ddv", DDV_MAJOR << 8},
-#endif
- { NULL, 0 }
- };
-
- if (strncmp(line,"/dev/",5) == 0) {
- struct dev_name_struct *dev = devices;
- line += 5;
- do {
- int len = strlen(dev->name);
- if (strncmp(line,dev->name,len) == 0) {
- line += len;
- base = dev->num;
- break;
- }
- dev++;
- } while (dev->name);
- }
- ROOT_DEV = to_kdev_t(base + simple_strtoul(line,NULL,base?10:16));
-}
-
/*
* This is a simple kernel command line parsing function: it parses
* the command line, and fills in the arguments/environment to init
* as appropriate. Any cmd-line option is taken to be an environment
* variable if it contains the character '='.
*
- *
* This routine also checks for options meant for the kernel.
* These options are not given to init - they are for internal kernel use only.
*/
@@ -793,33 +858,6 @@
/*
* check for kernel options first..
*/
- if (!strncmp(line,"root=",5)) {
- parse_root_dev(line+5);
- continue;
- }
-#ifdef CONFIG_ROOT_NFS
- if (!strncmp(line, "nfsroot=", 8)) {
- int n;
- line += 8;
- ROOT_DEV = MKDEV(UNNAMED_MAJOR, 255);
- if (line[0] == '/' || line[0] == ',' || (line[0] >= '0' && line[0] <= '9')) {
- strncpy(nfs_root_name, line, sizeof(nfs_root_name));
- nfs_root_name[sizeof(nfs_root_name)-1] = '\0';
- continue;
- }
- n = strlen(line) + strlen(NFS_ROOT);
- if (n >= sizeof(nfs_root_name))
- line[sizeof(nfs_root_name) - strlen(NFS_ROOT) - 1] = '\0';
- sprintf(nfs_root_name, NFS_ROOT, line);
- continue;
- }
- if (!strncmp(line, "nfsaddrs=", 9)) {
- line += 9;
- strncpy(nfs_root_addrs, line, sizeof(nfs_root_addrs));
- nfs_root_addrs[sizeof(nfs_root_addrs)-1] = '\0';
- continue;
- }
-#endif
if (!strcmp(line,"ro")) {
root_mountflags |= MS_RDONLY;
continue;
@@ -930,6 +968,7 @@
* Interrupts are still disabled. Do necessary setups, then
* enable them
*/
+ printk(linux_banner);
setup_arch(&command_line, &memory_start, &memory_end);
memory_start = paging_init(memory_start,memory_end);
trap_init();
@@ -941,13 +980,6 @@
init_modules();
#endif
#ifdef CONFIG_PROFILE
- if (!prof_shift)
-#ifdef CONFIG_PROFILE_SHIFT
- prof_shift = CONFIG_PROFILE_SHIFT;
-#else
- prof_shift = 2;
-#endif
-#endif
if (prof_shift) {
prof_buffer = (unsigned int *) memory_start;
/* only text is profiled */
@@ -956,14 +988,18 @@
memory_start += prof_len * sizeof(unsigned int);
memset(prof_buffer, 0, prof_len * sizeof(unsigned int));
}
+#endif
#ifdef CONFIG_SBUS
memory_start = sbus_init(memory_start,memory_end);
#endif
-#ifdef CONFIG_PMAC
+#if defined(CONFIG_PMAC) || defined(CONFIG_CHRP)
memory_start = powermac_init(memory_start, memory_end);
#endif
+#if defined(CONFIG_PCI) && defined(CONFIG_PCI_CONSOLE)
+ memory_start = pci_init(memory_start,memory_end);
+#endif
memory_start = console_init(memory_start,memory_end);
-#ifdef CONFIG_PCI
+#if defined(CONFIG_PCI) && !defined(CONFIG_PCI_CONSOLE)
memory_start = pci_init(memory_start,memory_end);
#endif
#ifdef CONFIG_MCA
@@ -997,10 +1033,8 @@
ipc_init();
#endif
dquot_init();
- sti();
check_bugs();
- printk(linux_banner);
printk("POSIX conformance testing by UNIFIX\n");
#ifdef __SMP__
smp_init();
@@ -1130,7 +1164,7 @@
* trying to recover a really broken machine.
*/
- if(execute_command)
+ if (execute_command)
execve(execute_command,argv_init,envp_init);
execve("/sbin/init",argv_init,envp_init);
execve("/etc/init",argv_init,envp_init);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov