/*-
* Copyright (c) 2007 Michael Lorenz
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
struct pic_ops {
void *pic_cookie; /* private stuff / hardware info */
int pic_intrbase; /* global number of the 1st IRQ we handle */
int pic_numintrs; /* how many IRQs do we handle? */
/*
* all functions that take an IRQ number as argument need a local
* interrupt number
*/
void (*pic_enable_irq)(struct pic_ops *, int, int);
void (*pic_reenable_irq)(struct pic_ops *, int, int);
void (*pic_disable_irq)(struct pic_ops *, int);
int (*pic_get_irq)(struct pic_ops *, int); /* PIC_GET_* */
void (*pic_ack_irq)(struct pic_ops *, int); /* IRQ numbner */
/* IRQ number, type, priority */
void (*pic_establish_irq)(struct pic_ops *, int, int, int);
/* finish setup after CPUs are attached */
void (*pic_finish_setup)(struct pic_ops *);
char pic_name[16];
};
struct intr_source {
int is_type;
int is_ipl;
int is_hwirq;
imask_t is_mask;
struct intrhand *is_hand;
struct pic_ops *is_pic;
bool is_cascaded;
struct evcnt is_ev;
char is_evname[16];
char is_intrid[INTRIDBUF];
};
/*
* add a pic, fill in pic_intrbase, return pic_intrbase on success,
* -1 otherwise
* the PIC must be initialized and ready for use
*/
int pic_add(struct pic_ops *);