direct-io.hg
changeset 3334:60e5912b6b28
bitkeeper revision 1.1159.170.68 (41d2b498y1kgB6L3q_YXZmDzui_mSQ)
Pull command-line option declarations to files in which they are used,
rather than having a single list of them in common/kernel.c.
Pull command-line option declarations to files in which they are used,
rather than having a single list of them in common/kernel.c.
author | kaf24@scramble.cl.cam.ac.uk |
---|---|
date | Wed Dec 29 13:43:52 2004 +0000 (2004-12-29) |
parents | 5ed086e1cfd0 |
children | a3b623535680 |
files | xen/arch/x86/domain.c xen/arch/x86/io_apic.c xen/arch/x86/pdb-stub.c xen/arch/x86/setup.c xen/arch/x86/traps.c xen/common/kernel.c xen/common/page_alloc.c xen/common/physdev.c xen/common/schedule.c xen/common/trace.c xen/drivers/char/console.c xen/drivers/char/serial.c xen/include/xen/init.h |
line diff
1.1 --- a/xen/arch/x86/domain.c Wed Dec 29 11:16:06 2004 +0000 1.2 +++ b/xen/arch/x86/domain.c Wed Dec 29 13:43:52 2004 +0000 1.3 @@ -12,6 +12,7 @@ 1.4 */ 1.5 1.6 #include <xen/config.h> 1.7 +#include <xen/init.h> 1.8 #include <xen/lib.h> 1.9 #include <xen/errno.h> 1.10 #include <xen/sched.h> 1.11 @@ -34,6 +35,10 @@ 1.12 #include <xen/elf.h> 1.13 #include <xen/multicall.h> 1.14 1.15 +/* opt_noreboot: If true, machine will need manual reset on error. */ 1.16 +static int opt_noreboot = 0; 1.17 +boolean_param("noreboot", opt_noreboot); 1.18 + 1.19 #if !defined(CONFIG_X86_64BITMODE) 1.20 /* No ring-3 access in initial page tables. */ 1.21 #define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED) 1.22 @@ -110,7 +115,6 @@ static inline void kb_wait(void) 1.23 1.24 void machine_restart(char * __unused) 1.25 { 1.26 - extern int opt_noreboot; 1.27 #ifdef CONFIG_SMP 1.28 int cpuid; 1.29 #endif
2.1 --- a/xen/arch/x86/io_apic.c Wed Dec 29 11:16:06 2004 +0000 2.2 +++ b/xen/arch/x86/io_apic.c Wed Dec 29 13:43:52 2004 +0000 2.3 @@ -1830,7 +1830,12 @@ int io_apic_set_pci_routing (int ioapic, 2.4 2.5 #endif /*CONFIG_ACPI_BOOT*/ 2.6 2.7 -extern char opt_leveltrigger[], opt_edgetrigger[]; 2.8 +/* opt_leveltrigger, opt_edgetrigger: Force an IO-APIC-routed IRQ to be */ 2.9 +/* level- or edge-triggered. */ 2.10 +/* Example: 'leveltrigger=4,5,6,20 edgetrigger=21'. */ 2.11 +static char opt_leveltrigger[30] = "", opt_edgetrigger[30] = ""; 2.12 +string_param("leveltrigger", opt_leveltrigger); 2.13 +string_param("edgetrigger", opt_edgetrigger); 2.14 2.15 static int __init ioapic_trigger_setup(void) 2.16 {
3.1 --- a/xen/arch/x86/pdb-stub.c Wed Dec 29 11:16:06 2004 +0000 3.2 +++ b/xen/arch/x86/pdb-stub.c Wed Dec 29 13:43:52 2004 +0000 3.3 @@ -22,6 +22,10 @@ 3.4 #include <xen/serial.h> 3.5 #include <xen/softirq.h> 3.6 3.7 +/* opt_pdb: Name of serial port for Xen pervasive debugger (and enable pdb) */ 3.8 +static unsigned char opt_pdb[10] = "none"; 3.9 +string_param("pdb", opt_pdb); 3.10 + 3.11 #define PDB_DEBUG_TRACE 3.12 #ifdef PDB_DEBUG_TRACE 3.13 #define TRC(_x) _x 3.14 @@ -1241,8 +1245,6 @@ void pdb_handle_debug_trap(struct xen_re 3.15 3.16 void initialize_pdb() 3.17 { 3.18 - extern char opt_pdb[]; 3.19 - 3.20 /* Certain state must be initialised even when PDB will not be used. */ 3.21 memset((void *) &breakpoints, 0, sizeof(breakpoints)); 3.22 INIT_LIST_HEAD(&breakpoints.list);
4.1 --- a/xen/arch/x86/setup.c Wed Dec 29 11:16:06 2004 +0000 4.2 +++ b/xen/arch/x86/setup.c Wed Dec 29 13:43:52 2004 +0000 4.3 @@ -16,14 +16,33 @@ 4.4 #include <asm/domain_page.h> 4.5 #include <asm/pdb.h> 4.6 4.7 +/* opt_noht: If true, Hyperthreading is ignored. */ 4.8 +int opt_noht = 0; 4.9 +boolean_param("noht", opt_noht); 4.10 + 4.11 +/* opt_noacpi: If true, ACPI tables are not parsed. */ 4.12 +static int opt_noacpi = 0; 4.13 +boolean_param("noacpi", opt_noacpi); 4.14 + 4.15 +/* opt_nosmp: If true, secondary processors are ignored. */ 4.16 +static int opt_nosmp = 0; 4.17 +boolean_param("nosmp", opt_nosmp); 4.18 + 4.19 +/* opt_ignorebiostables: If true, ACPI and MP tables are ignored. */ 4.20 +/* NB. This flag implies 'nosmp' and 'noacpi'. */ 4.21 +static int opt_ignorebiostables = 0; 4.22 +boolean_param("ignorebiostables", opt_ignorebiostables); 4.23 + 4.24 +/* opt_watchdog: If true, run a watchdog NMI on each processor. */ 4.25 +static int opt_watchdog = 0; 4.26 +boolean_param("watchdog", opt_watchdog); 4.27 + 4.28 extern void arch_init_memory(void); 4.29 extern void init_IRQ(void); 4.30 extern void trap_init(void); 4.31 extern void time_init(void); 4.32 extern void ac_timer_init(void); 4.33 extern void initialize_keytable(); 4.34 -extern int opt_nosmp, opt_watchdog, opt_noacpi; 4.35 -extern int opt_ignorebiostables; 4.36 extern int do_timer_lists_from_pit; 4.37 4.38 char ignore_irq13; /* set if exception 16 works */
5.1 --- a/xen/arch/x86/traps.c Wed Dec 29 11:16:06 2004 +0000 5.2 +++ b/xen/arch/x86/traps.c Wed Dec 29 13:43:52 2004 +0000 5.3 @@ -52,6 +52,19 @@ 5.4 #include <asm/i387.h> 5.5 #include <asm/debugger.h> 5.6 5.7 +/* 5.8 + * opt_nmi: one of 'ignore', 'dom0', or 'fatal'. 5.9 + * fatal: Xen prints diagnostic message and then hangs. 5.10 + * dom0: The NMI is virtualised to DOM0. 5.11 + * ignore: The NMI error is cleared and ignored. 5.12 + */ 5.13 +#ifdef NDEBUG 5.14 +char opt_nmi[10] = "dom0"; 5.15 +#else 5.16 +char opt_nmi[10] = "fatal"; 5.17 +#endif 5.18 +string_param("nmi", opt_nmi); 5.19 + 5.20 #if defined(__i386__) 5.21 5.22 #define GUEST_FAULT(_r) (likely(VM86_MODE(_r) || !RING_0(_r)))
6.1 --- a/xen/common/kernel.c Wed Dec 29 11:16:06 2004 +0000 6.2 +++ b/xen/common/kernel.c Wed Dec 29 13:43:52 2004 +0000 6.3 @@ -9,6 +9,7 @@ 6.4 6.5 #include <stdarg.h> 6.6 #include <xen/config.h> 6.7 +#include <xen/init.h> 6.8 #include <xen/lib.h> 6.9 #include <xen/errno.h> 6.10 #include <xen/spinlock.h> 6.11 @@ -26,6 +27,17 @@ 6.12 #include <asm/domain_page.h> 6.13 #include <public/dom0_ops.h> 6.14 6.15 +/* opt_dom0_mem: Kilobytes of memory allocated to domain 0. */ 6.16 +static unsigned int opt_dom0_mem = 16000; 6.17 +integer_param("dom0_mem", opt_dom0_mem); 6.18 + 6.19 +/* 6.20 + * opt_xenheap_megabytes: Size of Xen heap in megabytes, excluding the 6.21 + * pfn_info table and allocation bitmap. 6.22 + */ 6.23 +static unsigned int opt_xenheap_megabytes = XENHEAP_DEFAULT_MB; 6.24 +integer_param("xenheap_megabytes", opt_xenheap_megabytes); 6.25 + 6.26 unsigned long xenheap_phys_end; 6.27 6.28 xmem_cache_t *domain_struct_cachep; 6.29 @@ -33,111 +45,14 @@ struct domain *dom0; 6.30 6.31 vm_assist_info_t vm_assist_info[MAX_VMASST_TYPE + 1]; 6.32 6.33 -struct e820entry { 6.34 - unsigned long addr_lo, addr_hi; /* start of memory segment */ 6.35 - unsigned long size_lo, size_hi; /* size of memory segment */ 6.36 - unsigned long type; /* type of memory segment */ 6.37 -}; 6.38 - 6.39 void start_of_day(void); 6.40 6.41 -/* opt_console: comma-separated list of console outputs. */ 6.42 -unsigned char opt_console[30] = "com1,vga"; 6.43 -/* opt_conswitch: a character pair controlling console switching. */ 6.44 -/* Char 1: CTRL+<char1> is used to switch console input between Xen and DOM0 */ 6.45 -/* Char 2: If this character is 'x', then do not auto-switch to DOM0 when it */ 6.46 -/* boots. Any other value, or omitting the char, enables auto-switch */ 6.47 -unsigned char opt_conswitch[5] = "a"; /* NB. '`' would disable switching. */ 6.48 -/* opt_com[12]: Config serial port with a string <baud>,DPS,<io-base>,<irq>. */ 6.49 -unsigned char opt_com1[30] = "", opt_com2[30] = ""; 6.50 -/* opt_dom0_mem: Kilobytes of memory allocated to domain 0. */ 6.51 -unsigned int opt_dom0_mem = 16000; 6.52 -/* opt_noht: If true, Hyperthreading is ignored. */ 6.53 -int opt_noht=0; 6.54 -/* opt_noacpi: If true, ACPI tables are not parsed. */ 6.55 -int opt_noacpi=0; 6.56 -/* opt_nosmp: If true, secondary processors are ignored. */ 6.57 -int opt_nosmp=0; 6.58 -/* opt_noreboot: If true, machine will need manual reset on error. */ 6.59 -int opt_noreboot=0; 6.60 -/* opt_ignorebiostables: If true, ACPI and MP tables are ignored. */ 6.61 -/* NB. This flag implies 'nosmp' and 'noacpi'. */ 6.62 -int opt_ignorebiostables=0; 6.63 -/* opt_watchdog: If true, run a watchdog NMI on each processor. */ 6.64 -int opt_watchdog=0; 6.65 -/* opt_pdb: Name of serial port for Xen pervasive debugger (and enable pdb) */ 6.66 -unsigned char opt_pdb[10] = "none"; 6.67 -/* opt_tbuf_size: trace buffer size (in pages) */ 6.68 -unsigned int opt_tbuf_size = 10; 6.69 -/* opt_sched: scheduler - default to Borrowed Virtual Time */ 6.70 -char opt_sched[10] = "bvt"; 6.71 -/* opt_physdev_dom0_hide: list of PCI slots to hide from domain 0. */ 6.72 -/* Format is '(%02x:%02x.%1x)(%02x:%02x.%1x)' and so on. */ 6.73 -char opt_physdev_dom0_hide[200] = ""; 6.74 -/* opt_leveltrigger, opt_edgetrigger: Force an IO-APIC-routed IRQ to be */ 6.75 -/* level- or edge-triggered. */ 6.76 -/* Example: 'leveltrigger=4,5,6,20 edgetrigger=21'. */ 6.77 -char opt_leveltrigger[30] = "", opt_edgetrigger[30] = ""; 6.78 -/* 6.79 - * opt_xenheap_megabytes: Size of Xen heap in megabytes, excluding the 6.80 - * pfn_info table and allocation bitmap. 6.81 - */ 6.82 -unsigned int opt_xenheap_megabytes = XENHEAP_DEFAULT_MB; 6.83 -/* 6.84 - * opt_nmi: one of 'ignore', 'dom0', or 'fatal'. 6.85 - * fatal: Xen prints diagnostic message and then hangs. 6.86 - * dom0: The NMI is virtualised to DOM0. 6.87 - * ignore: The NMI error is cleared and ignored. 6.88 - */ 6.89 -#ifdef NDEBUG 6.90 -char opt_nmi[10] = "dom0"; 6.91 -#else 6.92 -char opt_nmi[10] = "fatal"; 6.93 -#endif 6.94 -/* 6.95 - * Comma-separated list of hexadecimal page numbers containing bad bytes. 6.96 - * e.g. 'badpage=0x3f45,0x8a321'. 6.97 - */ 6.98 -char opt_badpage[100] = ""; 6.99 - 6.100 -static struct { 6.101 - unsigned char *name; 6.102 - enum { OPT_STR, OPT_UINT, OPT_BOOL } type; 6.103 - void *var; 6.104 - unsigned int len; 6.105 -} opts[] = { 6.106 -#define V(_x) &_x, sizeof(_x) 6.107 - { "console", OPT_STR, V(opt_console) }, 6.108 - { "conswitch", OPT_STR, V(opt_conswitch) }, 6.109 - { "com1", OPT_STR, V(opt_com1) }, 6.110 - { "com2", OPT_STR, V(opt_com2) }, 6.111 - { "dom0_mem", OPT_UINT, V(opt_dom0_mem) }, 6.112 - { "noht", OPT_BOOL, V(opt_noht) }, 6.113 - { "noacpi", OPT_BOOL, V(opt_noacpi) }, 6.114 - { "nosmp", OPT_BOOL, V(opt_nosmp) }, 6.115 - { "noreboot", OPT_BOOL, V(opt_noreboot) }, 6.116 - { "ignorebiostables", OPT_BOOL, V(opt_ignorebiostables) }, 6.117 - { "watchdog", OPT_BOOL, V(opt_watchdog) }, 6.118 - { "pdb", OPT_STR, V(opt_pdb) }, 6.119 - { "tbuf_size", OPT_UINT, V(opt_tbuf_size) }, 6.120 - { "sched", OPT_STR, V(opt_sched) }, 6.121 - { "physdev_dom0_hide", OPT_STR, V(opt_physdev_dom0_hide) }, 6.122 - { "leveltrigger", OPT_STR, V(opt_leveltrigger) }, 6.123 - { "edgetrigger", OPT_STR, V(opt_edgetrigger) }, 6.124 - { "xenheap_megabytes", OPT_UINT, V(opt_xenheap_megabytes) }, 6.125 - { "nmi", OPT_STR, V(opt_nmi) }, 6.126 - { "badpage", OPT_STR, V(opt_badpage) }, 6.127 - { NULL, 0, NULL, 0 } 6.128 -}; 6.129 - 6.130 - 6.131 void cmain(multiboot_info_t *mbi) 6.132 { 6.133 unsigned long max_page; 6.134 unsigned char *cmdline; 6.135 module_t *mod = (module_t *)__va(mbi->mods_addr); 6.136 void *heap_start; 6.137 - int i; 6.138 unsigned long max_mem; 6.139 unsigned long dom0_memory_start, dom0_memory_end; 6.140 unsigned long initial_images_start, initial_images_end; 6.141 @@ -147,35 +62,42 @@ void cmain(multiboot_info_t *mbi) 6.142 if ( cmdline != NULL ) 6.143 { 6.144 unsigned char *opt_end, *opt; 6.145 - while ( *cmdline == ' ' ) cmdline++; 6.146 + struct kernel_param *param; 6.147 + while ( *cmdline == ' ' ) 6.148 + cmdline++; 6.149 cmdline = strchr(cmdline, ' '); /* skip the image name */ 6.150 while ( cmdline != NULL ) 6.151 { 6.152 - while ( *cmdline == ' ' ) cmdline++; 6.153 - if ( *cmdline == '\0' ) break; 6.154 + while ( *cmdline == ' ' ) 6.155 + cmdline++; 6.156 + if ( *cmdline == '\0' ) 6.157 + break; 6.158 opt_end = strchr(cmdline, ' '); 6.159 - if ( opt_end != NULL ) *opt_end++ = '\0'; 6.160 + if ( opt_end != NULL ) 6.161 + *opt_end++ = '\0'; 6.162 opt = strchr(cmdline, '='); 6.163 - if ( opt != NULL ) *opt++ = '\0'; 6.164 - for ( i = 0; opts[i].name != NULL; i++ ) 6.165 + if ( opt != NULL ) 6.166 + *opt++ = '\0'; 6.167 + for ( param = &__setup_start; param != &__setup_end; param++ ) 6.168 { 6.169 - if ( strcmp(opts[i].name, cmdline ) != 0 ) continue; 6.170 - switch ( opts[i].type ) 6.171 + if ( strcmp(param->name, cmdline ) != 0 ) 6.172 + continue; 6.173 + switch ( param->type ) 6.174 { 6.175 case OPT_STR: 6.176 if ( opt != NULL ) 6.177 { 6.178 - strncpy(opts[i].var, opt, opts[i].len); 6.179 - ((char *)opts[i].var)[opts[i].len-1] = '\0'; 6.180 + strncpy(param->var, opt, param->len); 6.181 + ((char *)param->var)[param->len-1] = '\0'; 6.182 } 6.183 break; 6.184 case OPT_UINT: 6.185 if ( opt != NULL ) 6.186 - *(unsigned int *)opts[i].var = 6.187 + *(unsigned int *)param->var = 6.188 simple_strtol(opt, (char **)&opt, 0); 6.189 break; 6.190 case OPT_BOOL: 6.191 - *(int *)opts[i].var = 1; 6.192 + *(int *)param->var = 1; 6.193 break; 6.194 } 6.195 }
7.1 --- a/xen/common/page_alloc.c Wed Dec 29 11:16:06 2004 +0000 7.2 +++ b/xen/common/page_alloc.c Wed Dec 29 13:43:52 2004 +0000 7.3 @@ -30,7 +30,12 @@ 7.4 #include <xen/irq.h> 7.5 #include <asm/domain_page.h> 7.6 7.7 -extern char opt_badpage[]; 7.8 +/* 7.9 + * Comma-separated list of hexadecimal page numbers containing bad bytes. 7.10 + * e.g. 'badpage=0x3f45,0x8a321'. 7.11 + */ 7.12 +static char opt_badpage[100] = ""; 7.13 +string_param("badpage", opt_badpage); 7.14 7.15 /********************* 7.16 * ALLOCATION BITMAP
8.1 --- a/xen/common/physdev.c Wed Dec 29 11:16:06 2004 +0000 8.2 +++ b/xen/common/physdev.c Wed Dec 29 13:43:52 2004 +0000 8.3 @@ -19,6 +19,7 @@ 8.4 */ 8.5 8.6 #include <xen/config.h> 8.7 +#include <xen/init.h> 8.8 #include <xen/lib.h> 8.9 #include <xen/types.h> 8.10 #include <xen/sched.h> 8.11 @@ -697,11 +698,15 @@ long do_physdev_op(physdev_op_t *uop) 8.12 return ret; 8.13 } 8.14 8.15 +/* opt_physdev_dom0_hide: list of PCI slots to hide from domain 0. */ 8.16 +/* Format is '(%02x:%02x.%1x)(%02x:%02x.%1x)' and so on. */ 8.17 +static char opt_physdev_dom0_hide[200] = ""; 8.18 +string_param("physdev_dom0_hide", opt_physdev_dom0_hide); 8.19 + 8.20 /* Test if boot params specify this device should NOT be visible to DOM0 8.21 * (e.g. so that another domain can control it instead) */ 8.22 int pcidev_dom0_hidden(struct pci_dev *dev) 8.23 { 8.24 - extern char opt_physdev_dom0_hide[]; 8.25 char cmp[10] = "(.......)"; 8.26 8.27 strncpy(&cmp[1], dev->slot_name, 7);
9.1 --- a/xen/common/schedule.c Wed Dec 29 11:16:06 2004 +0000 9.2 +++ b/xen/common/schedule.c Wed Dec 29 13:43:52 2004 +0000 9.3 @@ -28,6 +28,10 @@ 9.4 #include <xen/trace.h> 9.5 #include <public/sched_ctl.h> 9.6 9.7 +/* opt_sched: scheduler - default to Borrowed Virtual Time */ 9.8 +static char opt_sched[10] = "bvt"; 9.9 +string_param("sched", opt_sched); 9.10 + 9.11 /*#define WAKE_HISTO*/ 9.12 /*#define BLOCKTIME_HISTO*/ 9.13 9.14 @@ -481,8 +485,6 @@ void __init scheduler_init(void) 9.15 9.16 schedule_data[0].idle = &idle0_task; 9.17 9.18 - extern char opt_sched[]; 9.19 - 9.20 for ( i = 0; schedulers[i] != NULL; i++ ) 9.21 { 9.22 ops = *schedulers[i];
10.1 --- a/xen/common/trace.c Wed Dec 29 11:16:06 2004 +0000 10.2 +++ b/xen/common/trace.c Wed Dec 29 13:43:52 2004 +0000 10.3 @@ -28,6 +28,10 @@ 10.4 #include <asm/atomic.h> 10.5 #include <public/dom0_ops.h> 10.6 10.7 +/* opt_tbuf_size: trace buffer size (in pages) */ 10.8 +static unsigned int opt_tbuf_size = 10; 10.9 +integer_param("tbuf_size", opt_tbuf_size); 10.10 + 10.11 /* Pointers to the meta-data objects for all system trace buffers */ 10.12 struct t_buf *t_bufs[NR_CPUS]; 10.13 10.14 @@ -43,7 +47,6 @@ int tb_init_done = 0; 10.15 */ 10.16 void init_trace_bufs(void) 10.17 { 10.18 - extern int opt_tbuf_size; 10.19 int i, order; 10.20 unsigned long nr_pages; 10.21 char *rawbuf; 10.22 @@ -102,10 +105,8 @@ void init_trace_bufs(void) 10.23 */ 10.24 int get_tb_info(dom0_gettbufs_t *st) 10.25 { 10.26 - if(tb_init_done) 10.27 + if ( tb_init_done ) 10.28 { 10.29 - extern unsigned int opt_tbuf_size; 10.30 - 10.31 st->mach_addr = __pa(t_bufs[0]); 10.32 st->size = opt_tbuf_size * PAGE_SIZE; 10.33
11.1 --- a/xen/drivers/char/console.c Wed Dec 29 11:16:06 2004 +0000 11.2 +++ b/xen/drivers/char/console.c Wed Dec 29 13:43:52 2004 +0000 11.3 @@ -8,6 +8,7 @@ 11.4 11.5 #include <stdarg.h> 11.6 #include <xen/config.h> 11.7 +#include <xen/init.h> 11.8 #include <xen/lib.h> 11.9 #include <xen/errno.h> 11.10 #include <xen/event.h> 11.11 @@ -17,7 +18,16 @@ 11.12 #include <xen/keyhandler.h> 11.13 #include <asm/uaccess.h> 11.14 11.15 -extern unsigned char opt_console[], opt_conswitch[]; 11.16 +/* opt_console: comma-separated list of console outputs. */ 11.17 +static unsigned char opt_console[30] = "com1,vga"; 11.18 +string_param("console", opt_console); 11.19 + 11.20 +/* opt_conswitch: a character pair controlling console switching. */ 11.21 +/* Char 1: CTRL+<char1> is used to switch console input between Xen and DOM0 */ 11.22 +/* Char 2: If this character is 'x', then do not auto-switch to DOM0 when it */ 11.23 +/* boots. Any other value, or omitting the char, enables auto-switch */ 11.24 +static unsigned char opt_conswitch[5] = "a"; 11.25 +string_param("conswitch", opt_conswitch); 11.26 11.27 static int xpos, ypos; 11.28 static unsigned char *video = __va(0xB8000);
12.1 --- a/xen/drivers/char/serial.c Wed Dec 29 11:16:06 2004 +0000 12.2 +++ b/xen/drivers/char/serial.c Wed Dec 29 13:43:52 2004 +0000 12.3 @@ -9,6 +9,7 @@ 12.4 */ 12.5 12.6 #include <xen/config.h> 12.7 +#include <xen/init.h> 12.8 #include <xen/irq.h> 12.9 #include <xen/keyhandler.h> 12.10 #include <asm/pdb.h> 12.11 @@ -17,6 +18,11 @@ 12.12 #include <xen/serial.h> 12.13 #include <asm/io.h> 12.14 12.15 +/* opt_com[12]: Config serial port with a string <baud>,DPS,<io-base>,<irq>. */ 12.16 +static unsigned char opt_com1[30] = "", opt_com2[30] = ""; 12.17 +string_param("com1", opt_com1); 12.18 +string_param("com2", opt_com2); 12.19 + 12.20 /* Register offsets */ 12.21 #define RBR 0x00 /* receive buffer */ 12.22 #define THR 0x00 /* transmit holding */ 12.23 @@ -280,8 +286,6 @@ static void uart_config_stage2(uart_t *u 12.24 12.25 void serial_init_stage1(void) 12.26 { 12.27 - extern unsigned char opt_com1[], opt_com2[]; 12.28 - 12.29 parse_port_config(opt_com1, &com[0]); 12.30 parse_port_config(opt_com2, &com[1]); 12.31
13.1 --- a/xen/include/xen/init.h Wed Dec 29 11:16:06 2004 +0000 13.2 +++ b/xen/include/xen/init.h Wed Dec 29 13:43:52 2004 +0000 13.3 @@ -38,8 +38,6 @@ 13.4 * Also note, that this data cannot be "const". 13.5 */ 13.6 13.7 -#ifndef MODULE 13.8 - 13.9 #ifndef __ASSEMBLY__ 13.10 13.11 /* 13.12 @@ -50,99 +48,64 @@ typedef void (*exitcall_t)(void); 13.13 13.14 extern initcall_t __initcall_start, __initcall_end; 13.15 13.16 -#define __initcall(fn) \ 13.17 - static initcall_t __initcall_##fn __init_call = fn 13.18 -#define __exitcall(fn) \ 13.19 - static exitcall_t __exitcall_##fn __exit_call = fn 13.20 +#define __initcall(fn) \ 13.21 + static initcall_t __initcall_##fn __init_call = fn 13.22 +#define __exitcall(fn) \ 13.23 + static exitcall_t __exitcall_##fn __exit_call = fn 13.24 13.25 /* 13.26 * Used for kernel command line parameter setup 13.27 */ 13.28 struct kernel_param { 13.29 - const char *str; 13.30 - int (*setup_func)(char *); 13.31 + const char *name; 13.32 + enum { OPT_STR, OPT_UINT, OPT_BOOL } type; 13.33 + void *var; 13.34 + unsigned int len; 13.35 }; 13.36 13.37 extern struct kernel_param __setup_start, __setup_end; 13.38 13.39 -#define __setup(str, fn) \ 13.40 - static char __setup_str_##fn[] __initdata = str; \ 13.41 - static struct kernel_param __setup_##fn __attribute_used__ __initsetup = { __setup_str_##fn, fn } 13.42 +#define boolean_param(_name, _var) \ 13.43 + static char __setup_str_##_var[] __initdata = _name; \ 13.44 + static struct kernel_param __setup_##_var __attribute_used__ \ 13.45 + __initsetup = { __setup_str_##_var, OPT_BOOL, &_var, sizeof(_var) } 13.46 +#define integer_param(_name, _var) \ 13.47 + static char __setup_str_##_var[] __initdata = _name; \ 13.48 + static struct kernel_param __setup_##_var __attribute_used__ \ 13.49 + __initsetup = { __setup_str_##_var, OPT_UINT, &_var, sizeof(_var) } 13.50 +#define string_param(_name, _var) \ 13.51 + static char __setup_str_##_var[] __initdata = _name; \ 13.52 + static struct kernel_param __setup_##_var __attribute_used__ \ 13.53 + __initsetup = { __setup_str_##_var, OPT_STR, &_var, sizeof(_var) } 13.54 13.55 +#define __setup(_name, _fn) 13.56 + 13.57 #endif /* __ASSEMBLY__ */ 13.58 13.59 /* 13.60 * Mark functions and data as being only used at initialization 13.61 * or exit time. 13.62 */ 13.63 -#define __init __attribute__ ((__section__ (".text.init"))) 13.64 -#define __exit __attribute_used__ __attribute__ ((__section__(".text.exit"))) 13.65 -#define __initdata __attribute__ ((__section__ (".data.init"))) 13.66 -#define __exitdata __attribute_used__ __attribute__ ((__section__ (".data.exit"))) 13.67 -#define __initsetup __attribute_used__ __attribute__ ((__section__ (".setup.init"))) 13.68 -#define __init_call __attribute_used__ __attribute__ ((__section__ (".initcall.init"))) 13.69 -#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit"))) 13.70 +#define __init \ 13.71 + __attribute__ ((__section__ (".text.init"))) 13.72 +#define __exit \ 13.73 + __attribute_used__ __attribute__ ((__section__(".text.exit"))) 13.74 +#define __initdata \ 13.75 + __attribute__ ((__section__ (".data.init"))) 13.76 +#define __exitdata \ 13.77 + __attribute_used__ __attribute__ ((__section__ (".data.exit"))) 13.78 +#define __initsetup \ 13.79 + __attribute_used__ __attribute__ ((__section__ (".setup.init"))) 13.80 +#define __init_call \ 13.81 + __attribute_used__ __attribute__ ((__section__ (".initcall.init"))) 13.82 +#define __exit_call \ 13.83 + __attribute_used__ __attribute__ ((__section__ (".exitcall.exit"))) 13.84 13.85 /* For assembly routines */ 13.86 #define __INIT .section ".text.init","ax" 13.87 #define __FINIT .previous 13.88 #define __INITDATA .section ".data.init","aw" 13.89 13.90 -/** 13.91 - * module_init() - driver initialization entry point 13.92 - * @x: function to be run at kernel boot time or module insertion 13.93 - * 13.94 - * module_init() will add the driver initialization routine in 13.95 - * the "__initcall.int" code segment if the driver is checked as 13.96 - * "y" or static, or else it will wrap the driver initialization 13.97 - * routine with init_module() which is used by insmod and 13.98 - * modprobe when the driver is used as a module. 13.99 - */ 13.100 -#define module_init(x) __initcall(x); 13.101 - 13.102 -/** 13.103 - * module_exit() - driver exit entry point 13.104 - * @x: function to be run when driver is removed 13.105 - * 13.106 - * module_exit() will wrap the driver clean-up code 13.107 - * with cleanup_module() when used with rmmod when 13.108 - * the driver is a module. If the driver is statically 13.109 - * compiled into the kernel, module_exit() has no effect. 13.110 - */ 13.111 -#define module_exit(x) __exitcall(x); 13.112 - 13.113 -#else 13.114 - 13.115 -#define __init 13.116 -#define __exit 13.117 -#define __initdata 13.118 -#define __exitdata 13.119 -#define __initcall(fn) 13.120 -/* For assembly routines */ 13.121 -#define __INIT 13.122 -#define __FINIT 13.123 -#define __INITDATA 13.124 - 13.125 -/* These macros create a dummy inline: gcc 2.9x does not count alias 13.126 - as usage, hence the `unused function' warning when __init functions 13.127 - are declared static. We use the dummy __*_module_inline functions 13.128 - both to kill the warning and check the type of the init/cleanup 13.129 - function. */ 13.130 -typedef int (*__init_module_func_t)(void); 13.131 -typedef void (*__cleanup_module_func_t)(void); 13.132 -#define module_init(x) \ 13.133 - int init_module(void) __attribute__((alias(#x))); \ 13.134 - static inline __init_module_func_t __init_module_inline(void) \ 13.135 - { return x; } 13.136 -#define module_exit(x) \ 13.137 - void cleanup_module(void) __attribute__((alias(#x))); \ 13.138 - static inline __cleanup_module_func_t __cleanup_module_inline(void) \ 13.139 - { return x; } 13.140 - 13.141 -#define __setup(str,func) /* nothing */ 13.142 - 13.143 -#endif 13.144 - 13.145 #ifdef CONFIG_HOTPLUG 13.146 #define __devinit 13.147 #define __devinitdata 13.148 @@ -155,16 +118,4 @@ typedef void (*__cleanup_module_func_t)( 13.149 #define __devexitdata __exitdata 13.150 #endif 13.151 13.152 -/* Functions marked as __devexit may be discarded at kernel link time, depending 13.153 - on config options. Newer versions of binutils detect references from 13.154 - retained sections to discarded sections and flag an error. Pointers to 13.155 - __devexit functions must use __devexit_p(function_name), the wrapper will 13.156 - insert either the function_name or NULL, depending on the config options. 13.157 - */ 13.158 -#if defined(MODULE) || defined(CONFIG_HOTPLUG) 13.159 -#define __devexit_p(x) x 13.160 -#else 13.161 -#define __devexit_p(x) NULL 13.162 -#endif 13.163 - 13.164 #endif /* _LINUX_INIT_H */