1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/* auxio.c: Probing for the Sparc AUXIO register at boot time.
*
* Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
*/
#include <linux/stddef.h>
#include <linux/init.h>
#include <asm/oplib.h>
#include <asm/io.h>
#include <asm/auxio.h>
/* Probe and map in the Auxiliary I/O register */
unsigned char *auxio_register;
__initfunc(void auxio_probe(void))
{
int node, auxio_nd;
struct linux_prom_registers auxregs[1];
if (sparc_cpu_model == sun4d) {
auxio_register = 0;
return;
}
node = prom_getchild(prom_root_node);
auxio_nd = prom_searchsiblings(node, "auxiliary-io");
if(!auxio_nd) {
node = prom_searchsiblings(node, "obio");
node = prom_getchild(node);
auxio_nd = prom_searchsiblings(node, "auxio");
if(!auxio_nd) {
if(prom_searchsiblings(node, "leds")) {
/* VME chassis sun4m machine, no auxio exists. */
auxio_register = 0;
return;
}
prom_printf("Cannot find auxio node, cannot continue...\n");
prom_halt();
}
}
prom_getproperty(auxio_nd, "reg", (char *) auxregs, sizeof(auxregs));
prom_apply_obio_ranges(auxregs, 0x1);
/* Map the register both read and write */
auxio_register = (unsigned char *) sparc_alloc_io(auxregs[0].phys_addr, 0,
auxregs[0].reg_size,
"auxiliaryIO",
auxregs[0].which_io, 0x0);
/* Fix the address on sun4m and sun4c. */
if((((unsigned long) auxregs[0].phys_addr) & 3) == 3 ||
sparc_cpu_model == sun4c)
auxio_register = (unsigned char *) ((int)auxio_register | 3);
TURN_ON_LED;
}
/* sun4m power control register (AUXIO2) */
volatile unsigned char * auxio_power_register = NULL;
__initfunc(void auxio_power_probe(void))
{
struct linux_prom_registers regs;
int node;
/* Attempt to find the sun4m power control node. */
node = prom_getchild(prom_root_node);
node = prom_searchsiblings(node, "obio");
node = prom_getchild(node);
node = prom_searchsiblings(node, "power");
if (node == 0 || node == -1)
return;
/* Map the power control register. */
prom_getproperty(node, "reg", (char *)®s, sizeof(regs));
prom_apply_obio_ranges(®s, 1);
auxio_power_register = (volatile unsigned char *)
sparc_alloc_io(regs.phys_addr, 0, regs.reg_size,
"power off control", regs.which_io, 0);
/* Display a quick message on the console. */
if (auxio_power_register)
printk(KERN_INFO "Power off control detected.\n");
}
|