Deleted Added
full compact
legacy.c (61995) legacy.c (65557)
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

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

21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
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

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

21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: head/sys/i386/i386/legacy.c 61995 2000-06-23 08:18:53Z msmith $
29 * $FreeBSD: head/sys/i386/i386/legacy.c 65557 2000-09-07 01:33:02Z jasone $
30 */
31
32/*
33 * This code implements a `root nexus' for Intel Architecture
34 * machines. The function of the root nexus is to serve as an
35 * attachment point for both processors and buses, and to manage
36 * resources which are common to all of them. In particular,
37 * this code implements the core resource managers for interrupt

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

63#endif
64
65#include <isa/isavar.h>
66#ifdef PC98
67#include <pc98/pc98/pc98.h>
68#else
69#include <i386/isa/isa.h>
70#endif
30 */
31
32/*
33 * This code implements a `root nexus' for Intel Architecture
34 * machines. The function of the root nexus is to serve as an
35 * attachment point for both processors and buses, and to manage
36 * resources which are common to all of them. In particular,
37 * this code implements the core resource managers for interrupt

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

63#endif
64
65#include <isa/isavar.h>
66#ifdef PC98
67#include <pc98/pc98/pc98.h>
68#else
69#include <i386/isa/isa.h>
70#endif
71#include <sys/proc.h>
72#include <i386/isa/icu.h>
71#include <i386/isa/intr_machdep.h>
73#include <i386/isa/intr_machdep.h>
74#include <sys/rtprio.h>
72
73static struct rman irq_rman, drq_rman, port_rman, mem_rman;
74
75static int nexus_probe(device_t);
76static int nexus_attach(device_t);
77static int nexus_print_child(device_t, device_t);
78static device_t nexus_add_child(device_t bus, int order, const char *name,
79 int unit);

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

392 * (which really doesn't belong in kern/anything.c). Eventually, all of
393 * the code in kern_intr.c and machdep_intr.c should get moved here, since
394 * this is going to be the official interface.
395 */
396static int
397nexus_setup_intr(device_t bus, device_t child, struct resource *irq,
398 int flags, void (*ihand)(void *), void *arg, void **cookiep)
399{
75
76static struct rman irq_rman, drq_rman, port_rman, mem_rman;
77
78static int nexus_probe(device_t);
79static int nexus_attach(device_t);
80static int nexus_print_child(device_t, device_t);
81static device_t nexus_add_child(device_t bus, int order, const char *name,
82 int unit);

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

395 * (which really doesn't belong in kern/anything.c). Eventually, all of
396 * the code in kern_intr.c and machdep_intr.c should get moved here, since
397 * this is going to be the official interface.
398 */
399static int
400nexus_setup_intr(device_t bus, device_t child, struct resource *irq,
401 int flags, void (*ihand)(void *), void *arg, void **cookiep)
402{
400 intrmask_t *mask;
401 driver_t *driver;
403 driver_t *driver;
402 int error, icflags;
404 int error, icflags;
405 int pri; /* interrupt thread priority */
403
404 /* somebody tried to setup an irq that failed to allocate! */
405 if (irq == NULL)
406 panic("nexus_setup_intr: NULL irq resource!");
407
408 *cookiep = 0;
409 if (irq->r_flags & RF_SHAREABLE)
410 icflags = 0;
411 else
412 icflags = INTR_EXCL;
413
414 driver = device_get_driver(child);
415 switch (flags) {
406
407 /* somebody tried to setup an irq that failed to allocate! */
408 if (irq == NULL)
409 panic("nexus_setup_intr: NULL irq resource!");
410
411 *cookiep = 0;
412 if (irq->r_flags & RF_SHAREABLE)
413 icflags = 0;
414 else
415 icflags = INTR_EXCL;
416
417 driver = device_get_driver(child);
418 switch (flags) {
416 case INTR_TYPE_TTY:
417 mask = &tty_imask;
419 case INTR_TYPE_TTY: /* keyboard or parallel port */
420 pri = PI_TTYLOW;
418 break;
421 break;
419 case (INTR_TYPE_TTY | INTR_TYPE_FAST):
420 mask = &tty_imask;
422 case (INTR_TYPE_TTY | INTR_FAST): /* sio */
423 pri = PI_TTYHIGH;
421 icflags |= INTR_FAST;
422 break;
423 case INTR_TYPE_BIO:
424 icflags |= INTR_FAST;
425 break;
426 case INTR_TYPE_BIO:
424 mask = &bio_imask;
427 /*
428 * XXX We need to refine this. BSD/OS distinguishes
429 * between tape and disk priorities.
430 */
431 pri = PI_DISK;
425 break;
426 case INTR_TYPE_NET:
432 break;
433 case INTR_TYPE_NET:
427 mask = &net_imask;
434 pri = PI_NET;
428 break;
429 case INTR_TYPE_CAM:
435 break;
436 case INTR_TYPE_CAM:
430 mask = &cam_imask;
437 pri = PI_DISK; /* XXX or PI_CAM? */
431 break;
432 case INTR_TYPE_MISC:
438 break;
439 case INTR_TYPE_MISC:
433 mask = 0;
440 pri = PI_DULL; /* don't care */
434 break;
441 break;
442 /* We didn't specify an interrupt level. */
435 default:
443 default:
436 panic("still using grody create_intr interface");
444 panic("nexus_setup_intr: no interrupt type in flags");
437 }
438
439 /*
440 * We depend here on rman_activate_resource() being idempotent.
441 */
442 error = rman_activate_resource(irq);
443 if (error)
444 return (error);
445
446 *cookiep = inthand_add(device_get_nameunit(child), irq->r_start,
445 }
446
447 /*
448 * We depend here on rman_activate_resource() being idempotent.
449 */
450 error = rman_activate_resource(irq);
451 if (error)
452 return (error);
453
454 *cookiep = inthand_add(device_get_nameunit(child), irq->r_start,
447 ihand, arg, mask, icflags);
455 ihand, arg, pri, icflags);
448 if (*cookiep == NULL)
449 error = EINVAL; /* XXX ??? */
450
451 return (error);
452}
453
454static int
455nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih)

--- 51 unchanged lines hidden ---
456 if (*cookiep == NULL)
457 error = EINVAL; /* XXX ??? */
458
459 return (error);
460}
461
462static int
463nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih)

--- 51 unchanged lines hidden ---