1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-16 15:11:52 +00:00

Prepare for shared interrupts (required by the new PCI code that adds

support for PCI PCI bridges, e.g. found on 4ch. Ethernet cards).

Submitted by:	Wolfgang Stanglmeier <wolf@kintaro.cologne.de>
This commit is contained in:
Stefan Eßer 1995-03-16 17:31:19 +00:00
parent 3bf0c362ad
commit 9b2fa02dd9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=7087
3 changed files with 58 additions and 3 deletions
sys
amd64/isa
i386/isa

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91
* $Id: isa.c,v 1.38 1995/02/25 18:29:10 phk Exp $
* $Id: isa.c,v 1.39 1995/02/25 18:55:53 phk Exp $
*/
/*
@ -105,6 +105,7 @@
u_long *intr_countp[ICU_LEN];
inthand2_t *intr_handler[ICU_LEN];
u_int intr_mask[ICU_LEN];
u_int* intr_mptr[ICU_LEN];
int intr_unit[ICU_LEN];
struct kern_devconf kdc_isa0 = {
@ -954,6 +955,29 @@ isa_irq_pending(dvp)
return (inb(IO_ICU2) & (id_irq >> 8));
}
int
update_intr_masks(void)
{
int intr, n=0;
u_int mask,*maskptr;
for (intr=0; intr < ICU_LEN; intr ++) {
if (intr==2) continue;
maskptr = intr_mptr[intr];
if (!maskptr) continue;
mask = *maskptr;
if (mask != intr_mask[intr]) {
#if 0
printf ("intr_mask[%2d] old=%08x new=%08x ptr=%p.\n",
intr, intr_mask[intr], mask, maskptr);
#endif
intr_mask[intr]=mask;
n++;
}
}
return (n);
}
int
register_intr(intr, device_id, flags, handler, maskptr, unit)
int intr;
@ -977,6 +1001,7 @@ register_intr(intr, device_id, flags, handler, maskptr, unit)
disable_intr();
intr_countp[intr] = &intrcnt[device_id];
intr_handler[intr] = handler;
intr_mptr[intr] = maskptr;
intr_mask[intr] = mask | (1 << intr);
intr_unit[intr] = unit;
setidt(ICU_OFFSET + intr,
@ -1009,6 +1034,7 @@ register_imask(dvp, mask)
intr = ffs(dvp->id_irq) - 1;
intr_mask[intr] = mask | (1 <<intr);
}
(void) update_intr_masks();
}
int
@ -1024,6 +1050,7 @@ unregister_intr(intr, handler)
disable_intr();
intr_countp[intr] = &intrcnt[NR_DEVICES + intr];
intr_handler[intr] = isa_strayintr;
intr_mptr[intr] = NULL;
intr_mask[intr] = HWI_MASK | SWI_MASK;
intr_unit[intr] = intr;
setidt(ICU_OFFSET + intr, slowintr[intr], SDT_SYS386IGT, SEL_KPL);

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91
* $Id: isa.c,v 1.38 1995/02/25 18:29:10 phk Exp $
* $Id: isa.c,v 1.39 1995/02/25 18:55:53 phk Exp $
*/
/*
@ -105,6 +105,7 @@
u_long *intr_countp[ICU_LEN];
inthand2_t *intr_handler[ICU_LEN];
u_int intr_mask[ICU_LEN];
u_int* intr_mptr[ICU_LEN];
int intr_unit[ICU_LEN];
struct kern_devconf kdc_isa0 = {
@ -954,6 +955,29 @@ isa_irq_pending(dvp)
return (inb(IO_ICU2) & (id_irq >> 8));
}
int
update_intr_masks(void)
{
int intr, n=0;
u_int mask,*maskptr;
for (intr=0; intr < ICU_LEN; intr ++) {
if (intr==2) continue;
maskptr = intr_mptr[intr];
if (!maskptr) continue;
mask = *maskptr;
if (mask != intr_mask[intr]) {
#if 0
printf ("intr_mask[%2d] old=%08x new=%08x ptr=%p.\n",
intr, intr_mask[intr], mask, maskptr);
#endif
intr_mask[intr]=mask;
n++;
}
}
return (n);
}
int
register_intr(intr, device_id, flags, handler, maskptr, unit)
int intr;
@ -977,6 +1001,7 @@ register_intr(intr, device_id, flags, handler, maskptr, unit)
disable_intr();
intr_countp[intr] = &intrcnt[device_id];
intr_handler[intr] = handler;
intr_mptr[intr] = maskptr;
intr_mask[intr] = mask | (1 << intr);
intr_unit[intr] = unit;
setidt(ICU_OFFSET + intr,
@ -1009,6 +1034,7 @@ register_imask(dvp, mask)
intr = ffs(dvp->id_irq) - 1;
intr_mask[intr] = mask | (1 <<intr);
}
(void) update_intr_masks();
}
int
@ -1024,6 +1050,7 @@ unregister_intr(intr, handler)
disable_intr();
intr_countp[intr] = &intrcnt[NR_DEVICES + intr];
intr_handler[intr] = isa_strayintr;
intr_mptr[intr] = NULL;
intr_mask[intr] = HWI_MASK | SWI_MASK;
intr_unit[intr] = intr;
setidt(ICU_OFFSET + intr, slowintr[intr], SDT_SYS386IGT, SEL_KPL);

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)isa_device.h 7.1 (Berkeley) 5/9/91
* $Id: isa_device.h,v 1.17 1994/11/03 04:15:04 jkh Exp $
* $Id: isa_device.h,v 1.18 1995/03/12 13:23:10 ugen Exp $
*/
#ifndef _I386_ISA_ISA_DEVICE_H_
@ -136,6 +136,7 @@ int isa_nmi __P((int cd));
int register_intr __P((int intr, int device_id, u_int flags,
inthand2_t *handler, u_int *maskptr, int unit));
int unregister_intr __P((int intr, inthand2_t *handler));
int update_intr_masks __P((void));
extern int isa_externalize(struct isa_device *, void *, size_t *);
extern int isa_internalize(struct isa_device *, void **, size_t *);