Skip to content

Commit

Permalink
m68k: early parameter support
Browse files Browse the repository at this point in the history
Add early parameter support and convert current users to it.

Signed-off-by: Roman Zippel <[email protected]>
Signed-off-by: Geert Uytterhoeven <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Roman Zippel authored and Linus Torvalds committed May 5, 2007
1 parent f8744bc commit d6713b4
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 106 deletions.
41 changes: 22 additions & 19 deletions arch/m68k/amiga/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ static char *amiga_models[] __initdata = {

static char amiga_model_name[13] = "Amiga ";

extern char m68k_debug_device[];

static void amiga_sched_init(irq_handler_t handler);
/* amiga specific irq functions */
extern void amiga_init_IRQ(void);
Expand All @@ -95,12 +93,10 @@ static unsigned int amiga_get_ss(void);
extern void amiga_mksound(unsigned int count, unsigned int ticks);
static void amiga_reset(void);
extern void amiga_init_sound(void);
static void amiga_savekmsg_init(void);
static void amiga_mem_console_write(struct console *co, const char *b,
unsigned int count);
void amiga_serial_console_write(struct console *co, const char *s,
unsigned int count);
static void amiga_debug_init(void);
#ifdef CONFIG_HEARTBEAT
static void amiga_heartbeat(int on);
#endif
Expand Down Expand Up @@ -370,7 +366,6 @@ void __init config_amiga(void)
{
int i;

amiga_debug_init();
amiga_identify();

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

/* debugging using chipram */
if (!strcmp(m68k_debug_device, "mem")) {
if (!AMIGAHW_PRESENT(CHIP_RAM))
printk("Warning: no chipram present for debugging\n");
else {
amiga_savekmsg_init();
amiga_console_driver.write = amiga_mem_console_write;
register_console(&amiga_console_driver);
}
}

/* our beloved beeper */
if (AMIGAHW_PRESENT(AMI_AUDIO))
amiga_init_sound();
Expand Down Expand Up @@ -787,17 +771,33 @@ static void amiga_mem_console_write(struct console *co, const char *s,
}
}

static void amiga_savekmsg_init(void)
static int __init amiga_savekmsg_setup(char *arg)
{
static struct resource debug_res = { .name = "Debug" };

if (!MACH_IS_AMIGA || strcmp(arg, "mem"))
goto done;

if (!AMIGAHW_PRESENT(CHIP_RAM)) {
printk("Warning: no chipram present for debugging\n");
goto done;
}

savekmsg = amiga_chip_alloc_res(SAVEKMSG_MAXMEM, &debug_res);
savekmsg->magic1 = SAVEKMSG_MAGIC1;
savekmsg->magic2 = SAVEKMSG_MAGIC2;
savekmsg->magicptr = ZTWO_PADDR(savekmsg);
savekmsg->size = 0;

amiga_console_driver.write = amiga_mem_console_write;
register_console(&amiga_console_driver);

done:
return 0;
}

early_param("debug", amiga_savekmsg_setup);

static void amiga_serial_putc(char c)
{
amiga_custom.serdat = (unsigned char)c | 0x100;
Expand Down Expand Up @@ -872,15 +872,18 @@ void amiga_serial_gets(struct console *co, char *s, int len)
}
#endif

static void __init amiga_debug_init(void)
static int __init amiga_debug_setup(char *arg)
{
if (!strcmp(m68k_debug_device, "ser" )) {
if (MACH_IS_AMIGA && !strcmp(arg, "ser")) {
/* no initialization required (?) */
amiga_console_driver.write = amiga_serial_console_write;
register_console(&amiga_console_driver);
}
return 0;
}

early_param("debug", amiga_debug_setup);

#ifdef CONFIG_HEARTBEAT
static void amiga_heartbeat(int on)
{
Expand Down
17 changes: 9 additions & 8 deletions arch/m68k/atari/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ extern int atari_tt_hwclk (int, struct rtc_time *);
extern int atari_mste_set_clock_mmss (unsigned long);
extern int atari_tt_set_clock_mmss (unsigned long);

/* atari specific debug functions (in debug.c) */
extern void atari_debug_init(void);


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


/* Parse the Atari-specific switches= option. */
void __init atari_switches_setup(const char *str, unsigned len)
static int __init atari_switches_setup(char *str)
{
char switches[len+1];
char switches[strlen(str) + 1];
char *p;
int ovsc_shift;
char *args = switches;

if (!MACH_IS_ATARI)
return 0;

/* copy string to local array, strsep works destructively... */
strlcpy(switches, str, sizeof(switches));
strcpy(switches, str);
atari_switches = 0;

/* parse the options */
Expand All @@ -170,8 +170,11 @@ void __init atari_switches_setup(const char *str, unsigned len)
atari_switches |= ATARI_SWITCH_SND7 << ovsc_shift;
}
}
return 0;
}

early_param("switches", atari_switches_setup);


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

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

atari_debug_init();

/* Change size of I/O space from 64KB to 4GB. */
ioport_resource.end = 0xFFFFFFFF;

Expand Down
24 changes: 14 additions & 10 deletions arch/m68k/atari/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#include <asm/atarihw.h>
#include <asm/atariints.h>

extern char m68k_debug_device[];

/* Flag that Modem1 port is already initialized and used */
int atari_MFP_init_done;
/* Flag that Modem1 port is already initialized and used */
Expand Down Expand Up @@ -305,26 +303,28 @@ void atari_init_midi_port(int cflag)
ACIA_RHTID : ACIA_RLTID);
}

void __init atari_debug_init(void)
static int __init atari_debug_setup(char *arg)
{
if (!strcmp(m68k_debug_device, "ser")) {
if (!MACH_IS_ATARI)
return 0;

if (!strcmp(arg, "ser"))
/* defaults to ser2 for a Falcon and ser1 otherwise */
strcpy(m68k_debug_device, MACH_IS_FALCON ? "ser2" : "ser1");
}
arg = MACH_IS_FALCON ? "ser2" : "ser1";

if (!strcmp(m68k_debug_device, "ser1")) {
if (!strcmp(arg, "ser1")) {
/* ST-MFP Modem1 serial port */
atari_init_mfp_port(B9600|CS8);
atari_console_driver.write = atari_mfp_console_write;
} else if (!strcmp(m68k_debug_device, "ser2")) {
} else if (!strcmp(arg, "ser2")) {
/* SCC Modem2 serial port */
atari_init_scc_port(B9600|CS8);
atari_console_driver.write = atari_scc_console_write;
} else if (!strcmp(m68k_debug_device, "midi")) {
} else if (!strcmp(arg, "midi")) {
/* MIDI port */
atari_init_midi_port(B9600|CS8);
atari_console_driver.write = atari_midi_console_write;
} else if (!strcmp(m68k_debug_device, "par")) {
} else if (!strcmp(arg, "par")) {
/* parallel printer */
atari_turnoff_irq(IRQ_MFP_BUSY); /* avoid ints */
sound_ym.rd_data_reg_sel = 7; /* select mixer control */
Expand All @@ -337,4 +337,8 @@ void __init atari_debug_init(void)
}
if (atari_console_driver.write)
register_console(&atari_console_driver);

return 0;
}

early_param("debug", atari_debug_setup);
39 changes: 1 addition & 38 deletions arch/m68k/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ static struct mem_info m68k_ramdisk;

static char m68k_command_line[CL_SIZE];

char m68k_debug_device[6] = "";
EXPORT_SYMBOL(m68k_debug_device);

void (*mach_sched_init) (irq_handler_t handler) __initdata = NULL;
/* machine dependent irq functions */
void (*mach_init_IRQ) (void) __initdata = NULL;
Expand Down Expand Up @@ -215,7 +212,6 @@ void __init setup_arch(char **cmdline_p)
unsigned long endmem, startmem;
#endif
int i;
char *p, *q;

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

/* Parse the command line for arch-specific options.
* For the m68k, this is currently only "debug=xxx" to enable printing
* certain kernel messages to some machine-specific device.
*/
for (p = *cmdline_p; p && *p;) {
i = 0;
if (!strncmp(p, "debug=", 6)) {
strlcpy(m68k_debug_device, p+6, sizeof(m68k_debug_device));
q = strchr(m68k_debug_device, ' ');
if (q)
*q = 0;
i = 1;
}
#ifdef CONFIG_ATARI
/* This option must be parsed very early */
if (!strncmp(p, "switches=", 9)) {
extern void atari_switches_setup(const char *, int);
q = strchr(p + 9, ' ');
atari_switches_setup(p + 9, q ? (q - (p + 9)) : strlen(p + 9));
i = 1;
}
#endif

if (i) {
/* option processed, delete it */
if ((q = strchr(p, ' ')))
strcpy(p, q + 1);
else
*p = 0;
} else {
if ((p = strchr(p, ' ')))
++p;
}
}
parse_early_param();

#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
Expand Down
8 changes: 0 additions & 8 deletions arch/m68k/mac/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ extern void mac_mksound(unsigned int, unsigned int);

extern void nubus_sweep_video(void);

/* Mac specific debug functions (in debug.c) */
extern void mac_debug_init(void);
extern void mac_debugging_long(int, long);

static void mac_get_model(char *str);

static void mac_sched_init(irq_handler_t vector)
Expand Down Expand Up @@ -180,9 +176,6 @@ void __init config_mac(void)
mach_halt = mac_poweroff;
mach_power_off = mac_poweroff;
mach_max_dma_address = 0xffffffff;
#if 0
mach_debug_init = mac_debug_init;
#endif
#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
mach_beep = mac_mksound;
#endif
Expand Down Expand Up @@ -802,7 +795,6 @@ void mac_identify(void)
/* the serial ports set to "Faster" mode in MacOS. */

iop_preinit();
mac_debug_init();

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

Expand Down
20 changes: 10 additions & 10 deletions arch/m68k/mac/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
#include <asm/machw.h>
#include <asm/macints.h>

extern char m68k_debug_device[];

extern struct compat_bootinfo compat_boot_info;

extern unsigned long mac_videobase;
extern unsigned long mac_videodepth;
extern unsigned long mac_rowbytes;
Expand Down Expand Up @@ -360,29 +356,33 @@ void mac_init_sccb_port(int cflag)
mac_init_scc_port(cflag, 1);
}

void __init mac_debug_init(void)
static int __init mac_debug_setup(char *arg)
{
if (!MACH_IS_MAC)
return 0;

#ifdef DEBUG_SERIAL
if (!strcmp(m68k_debug_device, "ser") ||
!strcmp(m68k_debug_device, "ser1")) {
if (!strcmp(arg, "ser") || !strcmp(arg, "ser1")) {
/* Mac modem port */
mac_init_scc_port(B9600|CS8, 0);
mac_console_driver.write = mac_scca_console_write;
scc_port = 0;
} else if (!strcmp(m68k_debug_device, "ser2")) {
} else if (!strcmp(arg, "ser2")) {
/* Mac printer port */
mac_init_scc_port(B9600|CS8, 1);
mac_console_driver.write = mac_sccb_console_write;
scc_port = 1;
}
#endif
#ifdef DEBUG_HEADS
if (!strcmp(m68k_debug_device, "scn") ||
!strcmp(m68k_debug_device, "con")) {
if (!strcmp(arg, "scn") || !strcmp(arg, "con")) {
/* display, using head.S console routines */
mac_console_driver.write = mac_debug_console_write;
}
#endif
if (mac_console_driver.write)
register_console(&mac_console_driver);
return 0;
}

early_param("debug", mac_debug_setup);
Loading

0 comments on commit d6713b4

Please sign in to comment.