Skip to content

Commit d6713b4

Browse files
Roman ZippelLinus Torvalds
authored andcommitted
m68k: early parameter support
Add early parameter support and convert current users to it. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent f8744bc commit d6713b4

8 files changed

Lines changed: 77 additions & 106 deletions

File tree

‎arch/m68k/amiga/config.c‎

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ static char *amiga_models[] __initdata = {
7979

8080
static char amiga_model_name[13] = "Amiga ";
8181

82-
extern char m68k_debug_device[];
83-
8482
static void amiga_sched_init(irq_handler_t handler);
8583
/* amiga specific irq functions */
8684
extern void amiga_init_IRQ(void);
@@ -95,12 +93,10 @@ static unsigned int amiga_get_ss(void);
9593
extern void amiga_mksound(unsigned int count, unsigned int ticks);
9694
static void amiga_reset(void);
9795
extern void amiga_init_sound(void);
98-
static void amiga_savekmsg_init(void);
9996
static void amiga_mem_console_write(struct console *co, const char *b,
10097
unsigned int count);
10198
void amiga_serial_console_write(struct console *co, const char *s,
10299
unsigned int count);
103-
static void amiga_debug_init(void);
104100
#ifdef CONFIG_HEARTBEAT
105101
static void amiga_heartbeat(int on);
106102
#endif
@@ -370,7 +366,6 @@ void __init config_amiga(void)
370366
{
371367
int i;
372368

373-
amiga_debug_init();
374369
amiga_identify();
375370

376371
/* Yuk, we don't have PCI memory */
@@ -458,17 +453,6 @@ void __init config_amiga(void)
458453
/* initialize chipram allocator */
459454
amiga_chip_init();
460455

461-
/* debugging using chipram */
462-
if (!strcmp(m68k_debug_device, "mem")) {
463-
if (!AMIGAHW_PRESENT(CHIP_RAM))
464-
printk("Warning: no chipram present for debugging\n");
465-
else {
466-
amiga_savekmsg_init();
467-
amiga_console_driver.write = amiga_mem_console_write;
468-
register_console(&amiga_console_driver);
469-
}
470-
}
471-
472456
/* our beloved beeper */
473457
if (AMIGAHW_PRESENT(AMI_AUDIO))
474458
amiga_init_sound();
@@ -787,17 +771,33 @@ static void amiga_mem_console_write(struct console *co, const char *s,
787771
}
788772
}
789773

790-
static void amiga_savekmsg_init(void)
774+
static int __init amiga_savekmsg_setup(char *arg)
791775
{
792776
static struct resource debug_res = { .name = "Debug" };
793777

778+
if (!MACH_IS_AMIGA || strcmp(arg, "mem"))
779+
goto done;
780+
781+
if (!AMIGAHW_PRESENT(CHIP_RAM)) {
782+
printk("Warning: no chipram present for debugging\n");
783+
goto done;
784+
}
785+
794786
savekmsg = amiga_chip_alloc_res(SAVEKMSG_MAXMEM, &debug_res);
795787
savekmsg->magic1 = SAVEKMSG_MAGIC1;
796788
savekmsg->magic2 = SAVEKMSG_MAGIC2;
797789
savekmsg->magicptr = ZTWO_PADDR(savekmsg);
798790
savekmsg->size = 0;
791+
792+
amiga_console_driver.write = amiga_mem_console_write;
793+
register_console(&amiga_console_driver);
794+
795+
done:
796+
return 0;
799797
}
800798

799+
early_param("debug", amiga_savekmsg_setup);
800+
801801
static void amiga_serial_putc(char c)
802802
{
803803
amiga_custom.serdat = (unsigned char)c | 0x100;
@@ -872,15 +872,18 @@ void amiga_serial_gets(struct console *co, char *s, int len)
872872
}
873873
#endif
874874

875-
static void __init amiga_debug_init(void)
875+
static int __init amiga_debug_setup(char *arg)
876876
{
877-
if (!strcmp(m68k_debug_device, "ser" )) {
877+
if (MACH_IS_AMIGA && !strcmp(arg, "ser")) {
878878
/* no initialization required (?) */
879879
amiga_console_driver.write = amiga_serial_console_write;
880880
register_console(&amiga_console_driver);
881881
}
882+
return 0;
882883
}
883884

885+
early_param("debug", amiga_debug_setup);
886+
884887
#ifdef CONFIG_HEARTBEAT
885888
static void amiga_heartbeat(int on)
886889
{

‎arch/m68k/atari/config.c‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ extern int atari_tt_hwclk (int, struct rtc_time *);
6969
extern int atari_mste_set_clock_mmss (unsigned long);
7070
extern int atari_tt_set_clock_mmss (unsigned long);
7171

72-
/* atari specific debug functions (in debug.c) */
73-
extern void atari_debug_init(void);
74-
7572

7673
/* ++roman: This is a more elaborate test for an SCC chip, since the plain
7774
* Medusa board generates DTACK at the SCC's standard addresses, but a SCC
@@ -137,15 +134,18 @@ int __init atari_parse_bootinfo(const struct bi_record *record)
137134

138135

139136
/* Parse the Atari-specific switches= option. */
140-
void __init atari_switches_setup(const char *str, unsigned len)
137+
static int __init atari_switches_setup(char *str)
141138
{
142-
char switches[len+1];
139+
char switches[strlen(str) + 1];
143140
char *p;
144141
int ovsc_shift;
145142
char *args = switches;
146143

144+
if (!MACH_IS_ATARI)
145+
return 0;
146+
147147
/* copy string to local array, strsep works destructively... */
148-
strlcpy(switches, str, sizeof(switches));
148+
strcpy(switches, str);
149149
atari_switches = 0;
150150

151151
/* parse the options */
@@ -170,8 +170,11 @@ void __init atari_switches_setup(const char *str, unsigned len)
170170
atari_switches |= ATARI_SWITCH_SND7 << ovsc_shift;
171171
}
172172
}
173+
return 0;
173174
}
174175

176+
early_param("switches", atari_switches_setup);
177+
175178

176179
/*
177180
* Setup the Atari configuration info
@@ -183,8 +186,6 @@ void __init config_atari(void)
183186

184187
memset(&atari_hw_present, 0, sizeof(atari_hw_present));
185188

186-
atari_debug_init();
187-
188189
/* Change size of I/O space from 64KB to 4GB. */
189190
ioport_resource.end = 0xFFFFFFFF;
190191

‎arch/m68k/atari/debug.c‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#include <asm/atarihw.h>
2020
#include <asm/atariints.h>
2121

22-
extern char m68k_debug_device[];
23-
2422
/* Flag that Modem1 port is already initialized and used */
2523
int atari_MFP_init_done;
2624
/* Flag that Modem1 port is already initialized and used */
@@ -305,26 +303,28 @@ void atari_init_midi_port(int cflag)
305303
ACIA_RHTID : ACIA_RLTID);
306304
}
307305

308-
void __init atari_debug_init(void)
306+
static int __init atari_debug_setup(char *arg)
309307
{
310-
if (!strcmp(m68k_debug_device, "ser")) {
308+
if (!MACH_IS_ATARI)
309+
return 0;
310+
311+
if (!strcmp(arg, "ser"))
311312
/* defaults to ser2 for a Falcon and ser1 otherwise */
312-
strcpy(m68k_debug_device, MACH_IS_FALCON ? "ser2" : "ser1");
313-
}
313+
arg = MACH_IS_FALCON ? "ser2" : "ser1";
314314

315-
if (!strcmp(m68k_debug_device, "ser1")) {
315+
if (!strcmp(arg, "ser1")) {
316316
/* ST-MFP Modem1 serial port */
317317
atari_init_mfp_port(B9600|CS8);
318318
atari_console_driver.write = atari_mfp_console_write;
319-
} else if (!strcmp(m68k_debug_device, "ser2")) {
319+
} else if (!strcmp(arg, "ser2")) {
320320
/* SCC Modem2 serial port */
321321
atari_init_scc_port(B9600|CS8);
322322
atari_console_driver.write = atari_scc_console_write;
323-
} else if (!strcmp(m68k_debug_device, "midi")) {
323+
} else if (!strcmp(arg, "midi")) {
324324
/* MIDI port */
325325
atari_init_midi_port(B9600|CS8);
326326
atari_console_driver.write = atari_midi_console_write;
327-
} else if (!strcmp(m68k_debug_device, "par")) {
327+
} else if (!strcmp(arg, "par")) {
328328
/* parallel printer */
329329
atari_turnoff_irq(IRQ_MFP_BUSY); /* avoid ints */
330330
sound_ym.rd_data_reg_sel = 7; /* select mixer control */
@@ -337,4 +337,8 @@ void __init atari_debug_init(void)
337337
}
338338
if (atari_console_driver.write)
339339
register_console(&atari_console_driver);
340+
341+
return 0;
340342
}
343+
344+
early_param("debug", atari_debug_setup);

‎arch/m68k/kernel/setup.c‎

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ static struct mem_info m68k_ramdisk;
7171

7272
static char m68k_command_line[CL_SIZE];
7373

74-
char m68k_debug_device[6] = "";
75-
EXPORT_SYMBOL(m68k_debug_device);
76-
7774
void (*mach_sched_init) (irq_handler_t handler) __initdata = NULL;
7875
/* machine dependent irq functions */
7976
void (*mach_init_IRQ) (void) __initdata = NULL;
@@ -215,7 +212,6 @@ void __init setup_arch(char **cmdline_p)
215212
unsigned long endmem, startmem;
216213
#endif
217214
int i;
218-
char *p, *q;
219215

220216
/* The bootinfo is located right after the kernel bss */
221217
m68k_parse_bootinfo((const struct bi_record *)&_end);
@@ -258,40 +254,7 @@ void __init setup_arch(char **cmdline_p)
258254
*cmdline_p = m68k_command_line;
259255
memcpy(boot_command_line, *cmdline_p, CL_SIZE);
260256

261-
/* Parse the command line for arch-specific options.
262-
* For the m68k, this is currently only "debug=xxx" to enable printing
263-
* certain kernel messages to some machine-specific device.
264-
*/
265-
for (p = *cmdline_p; p && *p;) {
266-
i = 0;
267-
if (!strncmp(p, "debug=", 6)) {
268-
strlcpy(m68k_debug_device, p+6, sizeof(m68k_debug_device));
269-
q = strchr(m68k_debug_device, ' ');
270-
if (q)
271-
*q = 0;
272-
i = 1;
273-
}
274-
#ifdef CONFIG_ATARI
275-
/* This option must be parsed very early */
276-
if (!strncmp(p, "switches=", 9)) {
277-
extern void atari_switches_setup(const char *, int);
278-
q = strchr(p + 9, ' ');
279-
atari_switches_setup(p + 9, q ? (q - (p + 9)) : strlen(p + 9));
280-
i = 1;
281-
}
282-
#endif
283-
284-
if (i) {
285-
/* option processed, delete it */
286-
if ((q = strchr(p, ' ')))
287-
strcpy(p, q + 1);
288-
else
289-
*p = 0;
290-
} else {
291-
if ((p = strchr(p, ' ')))
292-
++p;
293-
}
294-
}
257+
parse_early_param();
295258

296259
#ifdef CONFIG_DUMMY_CONSOLE
297260
conswitchp = &dummy_con;

‎arch/m68k/mac/config.c‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,6 @@ extern void mac_mksound(unsigned int, unsigned int);
8282

8383
extern void nubus_sweep_video(void);
8484

85-
/* Mac specific debug functions (in debug.c) */
86-
extern void mac_debug_init(void);
87-
extern void mac_debugging_long(int, long);
88-
8985
static void mac_get_model(char *str);
9086

9187
static void mac_sched_init(irq_handler_t vector)
@@ -180,9 +176,6 @@ void __init config_mac(void)
180176
mach_halt = mac_poweroff;
181177
mach_power_off = mac_poweroff;
182178
mach_max_dma_address = 0xffffffff;
183-
#if 0
184-
mach_debug_init = mac_debug_init;
185-
#endif
186179
#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
187180
mach_beep = mac_mksound;
188181
#endif
@@ -802,7 +795,6 @@ void mac_identify(void)
802795
/* the serial ports set to "Faster" mode in MacOS. */
803796

804797
iop_preinit();
805-
mac_debug_init();
806798

807799
printk(KERN_INFO "Detected Macintosh model: %d \n", model);
808800

‎arch/m68k/mac/debug.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@
2727
#include <asm/machw.h>
2828
#include <asm/macints.h>
2929

30-
extern char m68k_debug_device[];
31-
32-
extern struct compat_bootinfo compat_boot_info;
33-
3430
extern unsigned long mac_videobase;
3531
extern unsigned long mac_videodepth;
3632
extern unsigned long mac_rowbytes;
@@ -360,29 +356,33 @@ void mac_init_sccb_port(int cflag)
360356
mac_init_scc_port(cflag, 1);
361357
}
362358

363-
void __init mac_debug_init(void)
359+
static int __init mac_debug_setup(char *arg)
364360
{
361+
if (!MACH_IS_MAC)
362+
return 0;
363+
365364
#ifdef DEBUG_SERIAL
366-
if (!strcmp(m68k_debug_device, "ser") ||
367-
!strcmp(m68k_debug_device, "ser1")) {
365+
if (!strcmp(arg, "ser") || !strcmp(arg, "ser1")) {
368366
/* Mac modem port */
369367
mac_init_scc_port(B9600|CS8, 0);
370368
mac_console_driver.write = mac_scca_console_write;
371369
scc_port = 0;
372-
} else if (!strcmp(m68k_debug_device, "ser2")) {
370+
} else if (!strcmp(arg, "ser2")) {
373371
/* Mac printer port */
374372
mac_init_scc_port(B9600|CS8, 1);
375373
mac_console_driver.write = mac_sccb_console_write;
376374
scc_port = 1;
377375
}
378376
#endif
379377
#ifdef DEBUG_HEADS
380-
if (!strcmp(m68k_debug_device, "scn") ||
381-
!strcmp(m68k_debug_device, "con")) {
378+
if (!strcmp(arg, "scn") || !strcmp(arg, "con")) {
382379
/* display, using head.S console routines */
383380
mac_console_driver.write = mac_debug_console_write;
384381
}
385382
#endif
386383
if (mac_console_driver.write)
387384
register_console(&mac_console_driver);
385+
return 0;
388386
}
387+
388+
early_param("debug", mac_debug_setup);

0 commit comments

Comments
 (0)