1 /* $Id: auxio.h,v 1.2 1999/09/21 14:39:25 davem Exp $
2 * auxio.h: Definitions and code for the Auxiliary I/O register.
3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5 */
6 #ifndef _SPARC64_AUXIO_H
7 #define _SPARC64_AUXIO_H
8
9 #include <asm/system.h>
10
11 /* FIXME: All of this should be checked for sun4u. It has /sbus/auxio, but
12 I don't know whether it is the same and don't have a floppy */
13
14 extern unsigned long auxio_register;
15
16 /* This register is an unsigned char in IO space. It does two things.
17 * First, it is used to control the front panel LED light on machines
18 * that have it (good for testing entry points to trap handlers and irq's)
19 * Secondly, it controls various floppy drive parameters.
20 */
21 #define AUXIO_ORMEIN 0xf0 /* All writes must set these bits. */
22 #define AUXIO_ORMEIN4M 0xc0 /* sun4m - All writes must set these bits. */
23 #define AUXIO_FLPY_DENS 0x20 /* Floppy density, high if set. Read only. */
24 #define AUXIO_FLPY_DCHG 0x10 /* A disk change occurred. Read only. */
25 #define AUXIO_EDGE_ON 0x10 /* sun4m - On means Jumper block is in. */
26 #define AUXIO_FLPY_DSEL 0x08 /* Drive select/start-motor. Write only. */
27 #define AUXIO_LINK_TEST 0x08 /* sun4m - On means TPE Carrier detect. */
28
29 /* Set the following to one, then zero, after doing a pseudo DMA transfer. */
30 #define AUXIO_FLPY_TCNT 0x04 /* Floppy terminal count. Write only. */
31
32 /* Set the following to zero to eject the floppy. */
33 #define AUXIO_FLPY_EJCT 0x02 /* Eject floppy disk. Write only. */
34 #define AUXIO_LED 0x01 /* On if set, off if unset. Read/Write */
35
36 #define AUXREG (auxio_register)
37
38 /* These are available on sun4c */
39 #define TURN_ON_LED \
40 do { if (AUXREG) \
41 sbus_writeb(sbus_readb(AUXREG) | \
42 (AUXIO_ORMEIN | AUXIO_LED), AUXREG); \
43 } while(0)
44 #define TURN_OFF_LED \
45 do { if (AUXREG) \
46 sbus_writeb((sbus_readb(AUXREG) | \
47 AUXIO_ORMEIN) & (~AUXIO_LED), \
48 AUXREG); \
49 } while(0)
50 #define FLIP_LED \
51 do { if (AUXREG) \
52 sbus_writeb((sbus_readb(AUXREG) | \
53 AUXIO_ORMEIN) ^ AUXIO_LEN, \
54 AUXREG); \
55 } while(0)
56 #define FLPY_MOTORON \
57 do { if (AUXREG) \
58 sbus_writeb(sbus_readb(AUXREG) | \
59 (AUXIO_ORMEIN | AUXIO_FLPY_DSEL), \
60 AUXREG); \
61 } while(0)
62 #define FLPY_MOTOROFF \
63 do { if (AUXREG) \
64 sbus_writeb((sbus_readb(AUXREG) | \
65 AUXIO_ORMEIN) & (~AUXIO_FLPY_DSEL), \
66 AUXREG); \
67 } while(0)
68 #define FLPY_TCNTON \
69 do { if (AUXREG) \
70 sbus_writeb((sbus_readb(AUXREG) | \
71 AUXIO_ORMEIN) | AUXIO_FLPY_TCNT, \
72 AUXREG); \
73 } while(0)
74 #define FLPY_TCNTOFF \
75 do { if (AUXREG) \
76 sbus_writeb((sbus_readb(AUXREG) | \
77 AUXIO_ORMEIN) & (~AUXIO_FLPY_TCNT), \
78 AUXREG); \
79 } while(0)
80
81 #ifndef __ASSEMBLY__
82 extern __inline__ void set_auxio(unsigned char bits_on, unsigned char bits_off)
83 {
84 unsigned char regval;
85 unsigned long flags;
86
87 save_flags(flags); cli();
88
89 if(AUXREG) {
90 unsigned char newval;
91
92 regval = sbus_readb(AUXREG);
93 newval = regval | bits_on;
94 newval &= ~bits_off;
95 newval |= AUXIO_ORMEIN4M;
96 sbus_writeb(newval, AUXREG);
97 }
98 restore_flags(flags);
99 }
100 #endif /* !(__ASSEMBLY__) */
101
102
103 /* AUXIO2 (Power Off Control) */
104 extern __volatile__ unsigned char * auxio_power_register;
105
106 #define AUXIO_POWER_DETECT_FAILURE 32
107 #define AUXIO_POWER_CLEAR_FAILURE 2
108 #define AUXIO_POWER_OFF 1
109
110
111 #endif /* !(_SPARC_AUXIO_H) */
112
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.