Deleted Added
full compact
obio.c (182901) obio.c (183173)
1/* $NetBSD: obio.c,v 1.11 2003/07/15 00:25:05 lukem Exp $ */
2
3/*-
4 * Copyright (c) 2001, 2002, 2003 Wasabi Systems, Inc.
5 * All rights reserved.
6 *
7 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 *

--- 22 unchanged lines hidden (view full) ---

31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#include <sys/cdefs.h>
1/* $NetBSD: obio.c,v 1.11 2003/07/15 00:25:05 lukem Exp $ */
2
3/*-
4 * Copyright (c) 2001, 2002, 2003 Wasabi Systems, Inc.
5 * All rights reserved.
6 *
7 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 *

--- 22 unchanged lines hidden (view full) ---

31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#include <sys/cdefs.h>
39__FBSDID("$FreeBSD: head/sys/mips/adm5120/obio.c 182901 2008-09-10 03:49:08Z gonzo $");
39__FBSDID("$FreeBSD: head/sys/mips/adm5120/obio.c 183173 2008-09-19 04:10:09Z imp $");
40
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/bus.h>
44#include <sys/interrupt.h>
45#include <sys/kernel.h>
46#include <sys/module.h>
47#include <sys/rman.h>

--- 267 unchanged lines hidden (view full) ---

315
316 irq = rman_get_start(ires);
317
318 if (irq >= NIRQS)
319 panic("%s: bad irq %d", __func__, irq);
320
321 event = sc->sc_eventstab[irq];
322 if (event == NULL) {
40
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/bus.h>
44#include <sys/interrupt.h>
45#include <sys/kernel.h>
46#include <sys/module.h>
47#include <sys/rman.h>

--- 267 unchanged lines hidden (view full) ---

315
316 irq = rman_get_start(ires);
317
318 if (irq >= NIRQS)
319 panic("%s: bad irq %d", __func__, irq);
320
321 event = sc->sc_eventstab[irq];
322 if (event == NULL) {
323 error = intr_event_create(&event, (void *)irq, 0,
323 error = intr_event_create(&event, (void *)irq, 0, irq,
324 (mask_fn)mips_mask_irq, (mask_fn)mips_unmask_irq,
325 NULL, NULL, "obio intr%d:", irq);
326
327 sc->sc_eventstab[irq] = event;
328 }
329 else
330 panic("obio: Can't share IRQs");
331

--- 42 unchanged lines hidden (view full) ---

374 return (result);
375}
376
377static int
378obio_intr(void *arg)
379{
380 struct obio_softc *sc = arg;
381 struct intr_event *event;
324 (mask_fn)mips_mask_irq, (mask_fn)mips_unmask_irq,
325 NULL, NULL, "obio intr%d:", irq);
326
327 sc->sc_eventstab[irq] = event;
328 }
329 else
330 panic("obio: Can't share IRQs");
331

--- 42 unchanged lines hidden (view full) ---

374 return (result);
375}
376
377static int
378obio_intr(void *arg)
379{
380 struct obio_softc *sc = arg;
381 struct intr_event *event;
382 struct intr_handler *ih;
383 uint32_t irqstat;
382 uint32_t irqstat;
384 int irq, thread = 0;
383 int irq;
385
386 irqstat = REG_READ(ICU_FIQ_STATUS_REG);
387 irqstat |= REG_READ(ICU_STATUS_REG);
388
389 irq = 0;
390 while (irqstat != 0) {
391 if ((irqstat & 1) == 1) {
392 event = sc->sc_eventstab[irq];
384
385 irqstat = REG_READ(ICU_FIQ_STATUS_REG);
386 irqstat |= REG_READ(ICU_STATUS_REG);
387
388 irq = 0;
389 while (irqstat != 0) {
390 if ((irqstat & 1) == 1) {
391 event = sc->sc_eventstab[irq];
393 if (event && !TAILQ_EMPTY(&event->ie_handlers)) {
394 /* Execute fast handlers. */
395 TAILQ_FOREACH(ih, &event->ie_handlers,
396 ih_next) {
397 if (ih->ih_filter == NULL)
398 thread = 1;
399 else
400 ih->ih_filter(ih->ih_argument);
401 }
402 }
392 if (!event || TAILQ_EMPTY(&event->ie_handlers))
393 continue;
403
394
404 /* Schedule thread if needed. */
405 if (thread)
406 intr_event_schedule_thread(event);
395 /* TODO: pass frame as an argument*/
396 /* TODO: log stray interrupt */
397 intr_event_handle(event, NULL);
407 }
408
409 irq++;
410 irqstat >>= 1;
411 }
412
413 return (FILTER_HANDLED);
414}

--- 96 unchanged lines hidden ---
398 }
399
400 irq++;
401 irqstat >>= 1;
402 }
403
404 return (FILTER_HANDLED);
405}

--- 96 unchanged lines hidden ---