1 /* auxio.c: Probing for the Sparc AUXIO register at boot time.
3 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
6 #include <linux/stddef.h>
7 #include <linux/init.h>
8 #include <linux/config.h>
11 #include <asm/auxio.h>
13 /* Probe and map in the Auxiliary I/O register */
14 unsigned char *auxio_register
;
16 void __init
auxio_probe(void)
19 struct linux_prom_registers auxregs
[1];
21 switch (sparc_cpu_model
) {
29 node
= prom_getchild(prom_root_node
);
30 auxio_nd
= prom_searchsiblings(node
, "auxiliary-io");
32 node
= prom_searchsiblings(node
, "obio");
33 node
= prom_getchild(node
);
34 auxio_nd
= prom_searchsiblings(node
, "auxio");
37 /* There may be auxio on Ebus */
41 if(prom_searchsiblings(node
, "leds")) {
42 /* VME chassis sun4m machine, no auxio exists. */
46 prom_printf("Cannot find auxio node, cannot continue...\n");
51 prom_getproperty(auxio_nd
, "reg", (char *) auxregs
, sizeof(auxregs
));
52 prom_apply_obio_ranges(auxregs
, 0x1);
53 /* Map the register both read and write */
54 auxio_register
= (unsigned char *) sparc_alloc_io(auxregs
[0].phys_addr
, 0,
57 auxregs
[0].which_io
, 0x0);
58 /* Fix the address on sun4m and sun4c. */
59 if((((unsigned long) auxregs
[0].phys_addr
) & 3) == 3 ||
60 sparc_cpu_model
== sun4c
)
61 auxio_register
= (unsigned char *) ((int)auxio_register
| 3);
67 /* sun4m power control register (AUXIO2) */
69 volatile unsigned char * auxio_power_register
= NULL
;
71 void __init
auxio_power_probe(void)
73 struct linux_prom_registers regs
;
76 /* Attempt to find the sun4m power control node. */
77 node
= prom_getchild(prom_root_node
);
78 node
= prom_searchsiblings(node
, "obio");
79 node
= prom_getchild(node
);
80 node
= prom_searchsiblings(node
, "power");
81 if (node
== 0 || node
== -1)
84 /* Map the power control register. */
85 prom_getproperty(node
, "reg", (char *)®s
, sizeof(regs
));
86 prom_apply_obio_ranges(®s
, 1);
87 auxio_power_register
= (volatile unsigned char *)
88 sparc_alloc_io(regs
.phys_addr
, 0, regs
.reg_size
,
89 "power off control", regs
.which_io
, 0);
91 /* Display a quick message on the console. */
92 if (auxio_power_register
)
93 printk(KERN_INFO
"Power off control detected.\n");