Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2e68052 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6

* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6:
  [SPARC64]: fix section mismatch warning in mdesc.c
  [SPARC64]: fix section mismatch warning in pci_sunv4
  [SPARC64]: Stop using drivers/char/rtc.c
  [SPARC64]: Convert parport to of_platform_driver.
  [SPARC]: Implement fb_is_primary_device().
  [SPARC64]: Fix virq decomposition.
  [SPARC64]: Use KERN_ERR in IRQ manipulation error printks.
  [SPARC64]: Do not flood log with failed DS messages.
  [SPARC64]: Add proper multicast support to VNET driver.
  [SPARC64]: Handle multiple domain-services-port nodes properly.
  [SPARC64]: Improve VIO device naming further.
  [SPARC]: Make sure dev_archdata is filled in for all devices.
  [SPARC]: Define minimal struct dev_archdata, similarly to sparc64.
  [SPARC]: Fix serial console device detection.
parents d6f410bd 1256efd5
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -148,6 +148,7 @@ void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_device *d
{
{
	const struct linux_prom_registers *regs;
	const struct linux_prom_registers *regs;
	struct linux_ebus_child *child;
	struct linux_ebus_child *child;
	struct dev_archdata *sd;
	const int *irqs;
	const int *irqs;
	int i, n, len;
	int i, n, len;
	unsigned long baseaddr;
	unsigned long baseaddr;
@@ -234,6 +235,10 @@ void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_device *d
		}
		}
	}
	}


	sd = &dev->ofdev.dev.archdata;
	sd->prom_node = dp;
	sd->op = &dev->ofdev;

	dev->ofdev.node = dp;
	dev->ofdev.node = dp;
	dev->ofdev.dev.parent = &dev->bus->ofdev.dev;
	dev->ofdev.dev.parent = &dev->bus->ofdev.dev;
	dev->ofdev.dev.bus = &ebus_bus_type;
	dev->ofdev.dev.bus = &ebus_bus_type;
+5 −0
Original line number Original line Diff line number Diff line
@@ -420,11 +420,16 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
{
{
	struct of_device *op = kzalloc(sizeof(*op), GFP_KERNEL);
	struct of_device *op = kzalloc(sizeof(*op), GFP_KERNEL);
	const struct linux_prom_irqs *intr;
	const struct linux_prom_irqs *intr;
	struct dev_archdata *sd;
	int len, i;
	int len, i;


	if (!op)
	if (!op)
		return NULL;
		return NULL;


	sd = &op->dev.archdata;
	sd->prom_node = dp;
	sd->op = op;

	op->node = dp;
	op->node = dp;


	op->clock_freq = of_getintprop_default(dp, "clock-frequency",
	op->clock_freq = of_getintprop_default(dp, "clock-frequency",
+5 −3
Original line number Original line Diff line number Diff line
@@ -39,6 +39,7 @@
#include <asm/processor.h>
#include <asm/processor.h>
#include <asm/psr.h>
#include <asm/psr.h>
#include <asm/elf.h>
#include <asm/elf.h>
#include <asm/prom.h>
#include <asm/unistd.h>
#include <asm/unistd.h>


/* 
/* 
@@ -150,7 +151,7 @@ void machine_halt(void)
	local_irq_enable();
	local_irq_enable();
	mdelay(8);
	mdelay(8);
	local_irq_disable();
	local_irq_disable();
	if (!serial_console && prom_palette)
	if (prom_palette)
		prom_palette (1);
		prom_palette (1);
	prom_halt();
	prom_halt();
	panic("Halt failed!");
	panic("Halt failed!");
@@ -166,7 +167,7 @@ void machine_restart(char * cmd)


	p = strchr (reboot_command, '\n');
	p = strchr (reboot_command, '\n');
	if (p) *p = 0;
	if (p) *p = 0;
	if (!serial_console && prom_palette)
	if (prom_palette)
		prom_palette (1);
		prom_palette (1);
	if (cmd)
	if (cmd)
		prom_reboot(cmd);
		prom_reboot(cmd);
@@ -179,7 +180,8 @@ void machine_restart(char * cmd)
void machine_power_off(void)
void machine_power_off(void)
{
{
#ifdef CONFIG_SUN_AUXIO
#ifdef CONFIG_SUN_AUXIO
	if (auxio_power_register && (!serial_console || scons_pwroff))
	if (auxio_power_register &&
	    (strcmp(of_console_device->type, "serial") || scons_pwroff))
		*auxio_power_register |= AUXIO_POWER_OFF;
		*auxio_power_register |= AUXIO_POWER_OFF;
#endif
#endif
	machine_halt();
	machine_halt();
+131 −0
Original line number Original line Diff line number Diff line
@@ -397,6 +397,135 @@ static struct device_node * __init build_tree(struct device_node *parent, phandl
	return dp;
	return dp;
}
}


struct device_node *of_console_device;
EXPORT_SYMBOL(of_console_device);

char *of_console_path;
EXPORT_SYMBOL(of_console_path);

char *of_console_options;
EXPORT_SYMBOL(of_console_options);

extern void restore_current(void);

static void __init of_console_init(void)
{
	char *msg = "OF stdout device is: %s\n";
	struct device_node *dp;
	unsigned long flags;
	const char *type;
	phandle node;
	int skip, fd;

	of_console_path = prom_early_alloc(256);

	switch (prom_vers) {
	case PROM_V0:
	case PROM_SUN4:
		skip = 0;
		switch (*romvec->pv_stdout) {
		case PROMDEV_SCREEN:
			type = "display";
			break;

		case PROMDEV_TTYB:
			skip = 1;
			/* FALLTHRU */

		case PROMDEV_TTYA:
			type = "serial";
			break;

		default:
			prom_printf("Invalid PROM_V0 stdout value %u\n",
				    *romvec->pv_stdout);
			prom_halt();
		}

		for_each_node_by_type(dp, type) {
			if (!skip--)
				break;
		}
		if (!dp) {
			prom_printf("Cannot find PROM_V0 console node.\n");
			prom_halt();
		}
		of_console_device = dp;

		strcpy(of_console_path, dp->full_name);
		if (!strcmp(type, "serial")) {
			strcat(of_console_path,
			       (skip ? ":b" : ":a"));
		}
		break;

	default:
	case PROM_V2:
	case PROM_V3:
		fd = *romvec->pv_v2bootargs.fd_stdout;

		spin_lock_irqsave(&prom_lock, flags);
		node = (*romvec->pv_v2devops.v2_inst2pkg)(fd);
		restore_current();
		spin_unlock_irqrestore(&prom_lock, flags);

		if (!node) {
			prom_printf("Cannot resolve stdout node from "
				    "instance %08x.\n", fd);
			prom_halt();
		}
		dp = of_find_node_by_phandle(node);
		type = of_get_property(dp, "device_type", NULL);

		if (!type) {
			prom_printf("Console stdout lacks "
				    "device_type property.\n");
			prom_halt();
		}

		if (strcmp(type, "display") && strcmp(type, "serial")) {
			prom_printf("Console device_type is neither display "
				    "nor serial.\n");
			prom_halt();
		}

		of_console_device = dp;

		if (prom_vers == PROM_V2) {
			strcpy(of_console_path, dp->full_name);
			switch (*romvec->pv_stdout) {
			case PROMDEV_TTYA:
				strcat(of_console_path, ":a");
				break;
			case PROMDEV_TTYB:
				strcat(of_console_path, ":b");
				break;
			}
		} else {
			const char *path;

			dp = of_find_node_by_path("/");
			path = of_get_property(dp, "stdout-path", NULL);
			if (!path) {
				prom_printf("No stdout-path in root node.\n");
				prom_halt();
			}
			strcpy(of_console_path, path);
		}
		break;
	}

	of_console_options = strrchr(of_console_path, ':');
	if (of_console_options) {
		of_console_options++;
		if (*of_console_options == '\0')
			of_console_options = NULL;
	}

	prom_printf(msg, of_console_path);
	printk(msg, of_console_path);
}

void __init prom_build_devicetree(void)
void __init prom_build_devicetree(void)
{
{
	struct device_node **nextp;
	struct device_node **nextp;
@@ -409,6 +538,8 @@ void __init prom_build_devicetree(void)
	allnodes->child = build_tree(allnodes,
	allnodes->child = build_tree(allnodes,
				     prom_getchild(allnodes->node),
				     prom_getchild(allnodes->node),
				     &nextp);
				     &nextp);
	of_console_init();

	printk("PROM: Built device tree with %u bytes of memory.\n",
	printk("PROM: Built device tree with %u bytes of memory.\n",
	       prom_early_allocated);
	       prom_early_allocated);
}
}
+1 −64
Original line number Original line Diff line number Diff line
@@ -146,31 +146,6 @@ static void __init process_switch(char c)
	}
	}
}
}


static void __init process_console(char *commands)
{
	serial_console = 0;
	commands += 8;
	/* Linux-style serial */
	if (!strncmp(commands, "ttyS", 4))
		serial_console = simple_strtoul(commands + 4, NULL, 10) + 1;
	else if (!strncmp(commands, "tty", 3)) {
		char c = *(commands + 3);
		/* Solaris-style serial */
		if (c == 'a' || c == 'b')
			serial_console = c - 'a' + 1;
		/* else Linux-style fbcon, not serial */
	}
#if defined(CONFIG_PROM_CONSOLE)
	if (!strncmp(commands, "prom", 4)) {
		char *p;

		for (p = commands - 8; *p && *p != ' '; p++)
			*p = ' ';
		conswitchp = &prom_con;
	}
#endif
}

static void __init boot_flags_init(char *commands)
static void __init boot_flags_init(char *commands)
{
{
	while (*commands) {
	while (*commands) {
@@ -187,9 +162,7 @@ static void __init boot_flags_init(char *commands)
				process_switch(*commands++);
				process_switch(*commands++);
			continue;
			continue;
		}
		}
		if (!strncmp(commands, "console=", 8)) {
		if (!strncmp(commands, "mem=", 4)) {
			process_console(commands);
		} else if (!strncmp(commands, "mem=", 4)) {
			/*
			/*
			 * "mem=XXX[kKmM] overrides the PROM-reported
			 * "mem=XXX[kKmM] overrides the PROM-reported
			 * memory size.
			 * memory size.
@@ -341,41 +314,6 @@ void __init setup_arch(char **cmdline_p)
	smp_setup_cpu_possible_map();
	smp_setup_cpu_possible_map();
}
}


static int __init set_preferred_console(void)
{
	int idev, odev;

	/* The user has requested a console so this is already set up. */
	if (serial_console >= 0)
		return -EBUSY;

	idev = prom_query_input_device();
	odev = prom_query_output_device();
	if (idev == PROMDEV_IKBD && odev == PROMDEV_OSCREEN) {
		serial_console = 0;
	} else if (idev == PROMDEV_ITTYA && odev == PROMDEV_OTTYA) {
		serial_console = 1;
	} else if (idev == PROMDEV_ITTYB && odev == PROMDEV_OTTYB) {
		serial_console = 2;
	} else if (idev == PROMDEV_I_UNK && odev == PROMDEV_OTTYA) {
		prom_printf("MrCoffee ttya\n");
		serial_console = 1;
	} else if (idev == PROMDEV_I_UNK && odev == PROMDEV_OSCREEN) {
		serial_console = 0;
		prom_printf("MrCoffee keyboard\n");
	} else {
		prom_printf("Confusing console (idev %d, odev %d)\n",
		    idev, odev);
		serial_console = 1;
	}

	if (serial_console)
		return add_preferred_console("ttyS", serial_console - 1, NULL);

	return -ENODEV;
}
console_initcall(set_preferred_console);

extern char *sparc_cpu_type;
extern char *sparc_cpu_type;
extern char *sparc_fpu_type;
extern char *sparc_fpu_type;


@@ -461,7 +399,6 @@ void sun_do_break(void)
	prom_cmdline();
	prom_cmdline();
}
}


int serial_console = -1;
int stop_a_enabled = 1;
int stop_a_enabled = 1;


static int __init topology_init(void)
static int __init topology_init(void)
Loading