]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - arch/m68k/mac/oss.c
3f81892527ad260fe6e0561c1ad71e071623a5e3
1 // SPDX-License-Identifier: GPL-2.0
3 * Operating System Services (OSS) chip handling
4 * Written by Joshua M. Thompson (funaho@jurai.org)
7 * This chip is used in the IIfx in place of VIA #2. It acts like a fancy
8 * VIA chip with prorammable interrupt levels.
10 * 990502 (jmt) - Major rewrite for new interrupt architecture as well as some
11 * recent insights into OSS operational details.
12 * 990610 (jmt) - Now taking full advantage of the OSS. Interrupts are mapped
13 * to mostly match the A/UX interrupt scheme supported on the
14 * VIA side. Also added support for enabling the ISM irq again
15 * since we now have a functional IOP manager.
18 #include <linux/types.h>
19 #include <linux/kernel.h>
21 #include <linux/delay.h>
22 #include <linux/init.h>
23 #include <linux/irq.h>
25 #include <asm/macintosh.h>
26 #include <asm/macints.h>
27 #include <asm/mac_via.h>
28 #include <asm/mac_oss.h>
31 volatile struct mac_oss
*oss
;
37 void __init
oss_init(void)
41 if (macintosh_config
->ident
!= MAC_MODEL_IIFX
)
44 oss
= (struct mac_oss
*) OSS_BASE
;
45 pr_debug("OSS detected at %p", oss
);
48 /* Disable all interrupts. Unlike a VIA it looks like we */
49 /* do this by setting the source's interrupt level to zero. */
51 for (i
= 0; i
< OSS_NUM_SOURCES
; i
++)
52 oss
->irq_level
[i
] = 0;
56 * Handle miscellaneous OSS interrupts.
59 static void oss_irq(struct irq_desc
*desc
)
61 int events
= oss
->irq_pending
&
62 (OSS_IP_IOPSCC
| OSS_IP_SCSI
| OSS_IP_IOPISM
);
64 if (events
& OSS_IP_IOPSCC
) {
65 oss
->irq_pending
&= ~OSS_IP_IOPSCC
;
66 generic_handle_irq(IRQ_MAC_SCC
);
69 if (events
& OSS_IP_SCSI
) {
70 oss
->irq_pending
&= ~OSS_IP_SCSI
;
71 generic_handle_irq(IRQ_MAC_SCSI
);
74 if (events
& OSS_IP_IOPISM
) {
75 oss
->irq_pending
&= ~OSS_IP_IOPISM
;
76 generic_handle_irq(IRQ_MAC_ADB
);
81 * Nubus IRQ handler, OSS style
83 * Unlike the VIA/RBV this is on its own autovector interrupt level.
86 static void oss_nubus_irq(struct irq_desc
*desc
)
88 int events
, irq_bit
, i
;
90 events
= oss
->irq_pending
& OSS_IP_NUBUS
;
94 /* There are only six slots on the OSS, not seven */
101 if (events
& irq_bit
) {
102 oss
->irq_pending
&= ~irq_bit
;
103 generic_handle_irq(NUBUS_SOURCE_BASE
+ i
);
105 } while(events
& (irq_bit
- 1));
109 * Register the OSS and NuBus interrupt dispatchers.
111 * This IRQ mapping is laid out with two things in mind: first, we try to keep
112 * things on their own levels to avoid having to do double-dispatches. Second,
113 * the levels match as closely as possible the alternate IRQ mapping mode (aka
114 * "A/UX mode") available on some VIA machines.
117 #define OSS_IRQLEV_IOPISM IRQ_AUTO_1
118 #define OSS_IRQLEV_SCSI IRQ_AUTO_2
119 #define OSS_IRQLEV_NUBUS IRQ_AUTO_3
120 #define OSS_IRQLEV_IOPSCC IRQ_AUTO_4
121 #define OSS_IRQLEV_VIA1 IRQ_AUTO_6
123 void __init
oss_register_interrupts(void)
125 irq_set_chained_handler(OSS_IRQLEV_IOPISM
, oss_irq
);
126 irq_set_chained_handler(OSS_IRQLEV_SCSI
, oss_irq
);
127 irq_set_chained_handler(OSS_IRQLEV_NUBUS
, oss_nubus_irq
);
128 irq_set_chained_handler(OSS_IRQLEV_IOPSCC
, oss_irq
);
129 irq_set_chained_handler(OSS_IRQLEV_VIA1
, via1_irq
);
131 /* OSS_VIA1 gets enabled here because it has no machspec interrupt. */
132 oss
->irq_level
[OSS_VIA1
] = IRQ_AUTO_6
;
136 * Enable an OSS interrupt
138 * It looks messy but it's rather straightforward. The switch() statement
139 * just maps the machspec interrupt numbers to the right OSS interrupt
140 * source (if the OSS handles that interrupt) and then sets the interrupt
141 * level for that source to nonzero, thus enabling the interrupt.
144 void oss_irq_enable(int irq
) {
147 oss
->irq_level
[OSS_IOPSCC
] = OSS_IRQLEV_IOPSCC
;
150 oss
->irq_level
[OSS_IOPISM
] = OSS_IRQLEV_IOPISM
;
153 oss
->irq_level
[OSS_SCSI
] = OSS_IRQLEV_SCSI
;
161 irq
-= NUBUS_SOURCE_BASE
;
162 oss
->irq_level
[irq
] = OSS_IRQLEV_NUBUS
;
166 if (IRQ_SRC(irq
) == 1)
171 * Disable an OSS interrupt
173 * Same as above except we set the source's interrupt level to zero,
174 * to disable the interrupt.
177 void oss_irq_disable(int irq
) {
180 oss
->irq_level
[OSS_IOPSCC
] = 0;
183 oss
->irq_level
[OSS_IOPISM
] = 0;
186 oss
->irq_level
[OSS_SCSI
] = 0;
194 irq
-= NUBUS_SOURCE_BASE
;
195 oss
->irq_level
[irq
] = 0;
199 if (IRQ_SRC(irq
) == 1)
200 via_irq_disable(irq
);