* add p cc
[mascara-docs.git] / i386 / linux / linux-2.3.21 / arch / sparc64 / kernel / auxio.c
blobc6bcb6bd7abc45215818025aceb6692cb0a663dd
1 /* auxio.c: Probing for the Sparc AUXIO register at boot time.
3 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
4 */
6 #include <linux/config.h>
7 #include <linux/stddef.h>
8 #include <linux/kernel.h>
9 #include <linux/sched.h>
10 #include <linux/smp.h>
11 #include <linux/init.h>
12 #include <linux/delay.h>
13 #include <linux/ioport.h>
15 #include <asm/oplib.h>
16 #include <asm/io.h>
17 #include <asm/auxio.h>
18 #include <asm/sbus.h>
19 #include <asm/ebus.h>
20 #include <asm/fhc.h>
22 /* Probe and map in the Auxiliary I/O register */
23 unsigned char *auxio_register;
25 void __init auxio_probe(void)
27 struct linux_sbus *bus;
28 struct linux_sbus_device *sdev = 0;
29 struct linux_prom_registers auxregs[1];
31 for_each_sbus(bus) {
32 for_each_sbusdev(sdev, bus) {
33 if(!strcmp(sdev->prom_name, "auxio")) {
34 break;
39 if (!sdev) {
40 #ifdef CONFIG_PCI
41 struct linux_ebus *ebus;
42 struct linux_ebus_device *edev = 0;
43 unsigned long led_auxio;
45 for_each_ebus(ebus) {
46 for_each_ebusdev(edev, ebus) {
47 if (!strcmp(edev->prom_name, "auxio"))
48 goto ebus_done;
51 ebus_done:
53 if (edev) {
54 led_auxio = edev->resource[0].start;
55 outl(0x01, led_auxio);
56 return;
58 #endif
59 if(central_bus) {
60 auxio_register = NULL;
61 return;
63 prom_printf("Cannot find auxio node, cannot continue...\n");
64 prom_halt();
67 prom_getproperty(sdev->prom_node, "reg", (char *) auxregs, sizeof(auxregs));
68 prom_apply_sbus_ranges(sdev->my_bus, auxregs, 0x1, sdev);
69 /* Map the register both read and write */
70 auxio_register = (unsigned char *) sparc_alloc_io(auxregs[0].phys_addr, 0,
71 auxregs[0].reg_size,
72 "auxiliaryIO",
73 auxregs[0].which_io, 0x0);
74 TURN_ON_LED;