Deleted Added
full compact
nexus.c (296250) nexus.c (297539)
1/*-
2 * Copyright 1998 Massachusetts Institute of Technology
3 *
4 * Permission to use, copy, modify, and distribute this software and
5 * its documentation for any purpose and without fee is hereby
6 * granted, provided that both the above copyright notice and this
7 * permission notice appear in all copies, that both the above
8 * copyright notice and this permission notice appear in all

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

37 * requests, DMA requests (which rightfully should be a part of the
38 * ISA code but it's easier to do it here for now), I/O port addresses,
39 * and I/O memory address space.
40 */
41
42#include "opt_platform.h"
43
44#include <sys/cdefs.h>
1/*-
2 * Copyright 1998 Massachusetts Institute of Technology
3 *
4 * Permission to use, copy, modify, and distribute this software and
5 * its documentation for any purpose and without fee is hereby
6 * granted, provided that both the above copyright notice and this
7 * permission notice appear in all copies, that both the above
8 * copyright notice and this permission notice appear in all

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

37 * requests, DMA requests (which rightfully should be a part of the
38 * ISA code but it's easier to do it here for now), I/O port addresses,
39 * and I/O memory address space.
40 */
41
42#include "opt_platform.h"
43
44#include <sys/cdefs.h>
45__FBSDID("$FreeBSD: head/sys/arm/arm/nexus.c 296250 2016-03-01 02:59:06Z jhibbits $");
45__FBSDID("$FreeBSD: head/sys/arm/arm/nexus.c 297539 2016-04-04 09:15:25Z skra $");
46
47#include <sys/param.h>
48#include <sys/systm.h>
49#include <sys/bus.h>
50#include <sys/kernel.h>
51#include <sys/malloc.h>
52#include <sys/module.h>
53#include <machine/bus.h>

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

276
277static int
278nexus_config_intr(device_t dev, int irq, enum intr_trigger trig,
279 enum intr_polarity pol)
280{
281 int ret = ENODEV;
282
283#ifdef ARM_INTRNG
46
47#include <sys/param.h>
48#include <sys/systm.h>
49#include <sys/bus.h>
50#include <sys/kernel.h>
51#include <sys/malloc.h>
52#include <sys/module.h>
53#include <machine/bus.h>

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

276
277static int
278nexus_config_intr(device_t dev, int irq, enum intr_trigger trig,
279 enum intr_polarity pol)
280{
281 int ret = ENODEV;
282
283#ifdef ARM_INTRNG
284 ret = intr_irq_config(irq, trig, pol);
284 device_printf(dev, "bus_config_intr is obsolete and not supported!\n");
285 ret = EOPNOTSUPP;
285#else
286 if (arm_config_irq)
287 ret = (*arm_config_irq)(irq, trig, pol);
288#endif
289 return (ret);
290}
291
292static int
293nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags,
294 driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep)
295{
286#else
287 if (arm_config_irq)
288 ret = (*arm_config_irq)(irq, trig, pol);
289#endif
290 return (ret);
291}
292
293static int
294nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags,
295 driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep)
296{
297#ifndef ARM_INTRNG
296 int irq;
298 int irq;
299#endif
297
298 if ((rman_get_flags(res) & RF_SHAREABLE) == 0)
299 flags |= INTR_EXCL;
300
300
301 if ((rman_get_flags(res) & RF_SHAREABLE) == 0)
302 flags |= INTR_EXCL;
303
301 for (irq = rman_get_start(res); irq <= rman_get_end(res); irq++) {
302#ifdef ARM_INTRNG
304#ifdef ARM_INTRNG
303 intr_irq_add_handler(child, filt, intr, arg, irq, flags,
304 cookiep);
305 return(intr_setup_irq(child, res, filt, intr, arg, flags, cookiep));
305#else
306#else
307 for (irq = rman_get_start(res); irq <= rman_get_end(res); irq++) {
306 arm_setup_irqhandler(device_get_nameunit(child),
307 filt, intr, arg, irq, flags, cookiep);
308 arm_unmask_irq(irq);
308 arm_setup_irqhandler(device_get_nameunit(child),
309 filt, intr, arg, irq, flags, cookiep);
310 arm_unmask_irq(irq);
309#endif
310 }
311 return (0);
311 }
312 return (0);
313#endif
312}
313
314static int
315nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih)
316{
317
318#ifdef ARM_INTRNG
314}
315
316static int
317nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih)
318{
319
320#ifdef ARM_INTRNG
319 return (intr_irq_remove_handler(child, rman_get_start(r), ih));
321 return (intr_teardown_irq(child, r, ih));
320#else
321 return (arm_remove_irqhandler(rman_get_start(r), ih));
322#endif
323}
324
325#ifdef ARM_INTRNG
326static int
327nexus_describe_intr(device_t dev, device_t child, struct resource *irq,
328 void *cookie, const char *descr)
329{
330
322#else
323 return (arm_remove_irqhandler(rman_get_start(r), ih));
324#endif
325}
326
327#ifdef ARM_INTRNG
328static int
329nexus_describe_intr(device_t dev, device_t child, struct resource *irq,
330 void *cookie, const char *descr)
331{
332
331 return (intr_irq_describe(rman_get_start(irq), cookie, descr));
333 return (intr_describe_irq(child, irq, cookie, descr));
332}
333
334#ifdef SMP
335static int
336nexus_bind_intr(device_t dev, device_t child, struct resource *irq, int cpu)
337{
338
334}
335
336#ifdef SMP
337static int
338nexus_bind_intr(device_t dev, device_t child, struct resource *irq, int cpu)
339{
340
339 return (intr_irq_bind(rman_get_start(irq), cpu));
341 return (intr_bind_irq(child, irq, cpu));
340}
341#endif
342#endif
343
344static int
345nexus_activate_resource(device_t bus, device_t child, int type, int rid,
346 struct resource *r)
347{

--- 68 unchanged lines hidden ---
342}
343#endif
344#endif
345
346static int
347nexus_activate_resource(device_t bus, device_t child, int type, int rid,
348 struct resource *r)
349{

--- 68 unchanged lines hidden ---