- read IRQs from state, not level register in *_reenable_irq() so we get

edge triggered ones too
- kmem_alloc() -> kmem_zalloc() for paranoia
This commit is contained in:
macallan 2017-06-16 18:48:22 +00:00
parent 90e565828d
commit 29bb99b1da
2 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pic_heathrow.c,v 1.10 2017/06/01 02:45:06 chs Exp $ */
/* $NetBSD: pic_heathrow.c,v 1.11 2017/06/16 18:48:22 macallan Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pic_heathrow.c,v 1.10 2017/06/01 02:45:06 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: pic_heathrow.c,v 1.11 2017/06/16 18:48:22 macallan Exp $");
#include "opt_interrupt.h"
@ -107,7 +107,7 @@ setup_heathrow(uint32_t addr)
struct heathrow_ops *heathrow;
struct pic_ops *pic;
heathrow = kmem_alloc(sizeof(struct heathrow_ops), KM_SLEEP);
heathrow = kmem_zalloc(sizeof(struct heathrow_ops), KM_SLEEP);
pic = &heathrow->pic;
pic->pic_numintrs = 64;
@ -160,7 +160,7 @@ heathrow_reenable_irq(struct pic_ops *pic, int irq, int type)
if (irq & 0x20) {
heathrow->enable_mask_h |= mask;
out32rb(INT_ENABLE_REG_H, heathrow->enable_mask_h);
levels = in32rb(INT_LEVEL_REG_H);
levels = in32rb(INT_STATE_REG_H);
if (levels & mask) {
pic_mark_pending(pic->pic_intrbase + irq);
out32rb(INT_CLEAR_REG_H, mask);
@ -168,7 +168,7 @@ heathrow_reenable_irq(struct pic_ops *pic, int irq, int type)
} else {
heathrow->enable_mask_l |= mask;
out32rb(INT_ENABLE_REG_L, heathrow->enable_mask_l);
levels = in32rb(INT_LEVEL_REG_L);
levels = in32rb(INT_STATE_REG_L);
if (levels & mask) {
pic_mark_pending(pic->pic_intrbase + irq);
out32rb(INT_CLEAR_REG_L, mask);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pic_ohare.c,v 1.14 2017/06/01 02:45:06 chs Exp $ */
/* $NetBSD: pic_ohare.c,v 1.15 2017/06/16 18:48:22 macallan Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pic_ohare.c,v 1.14 2017/06/01 02:45:06 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: pic_ohare.c,v 1.15 2017/06/16 18:48:22 macallan Exp $");
#include "opt_interrupt.h"
@ -116,7 +116,7 @@ setup_ohare(uint32_t addr, int is_gc)
struct pic_ops *pic;
int i;
ohare = kmem_alloc(sizeof(struct ohare_ops), KM_SLEEP);
ohare = kmem_zalloc(sizeof(struct ohare_ops), KM_SLEEP);
pic = &ohare->pic;
pic->pic_numintrs = OHARE_NIRQ;
@ -179,7 +179,7 @@ ohare_reenable_irq(struct pic_ops *pic, int irq, int type)
ohare->enable_mask |= mask;
out32rb(INT_ENABLE_REG, ohare->enable_mask);
levels = in32rb(INT_LEVEL_REG);
levels = in32rb(INT_STATE_REG);
if (levels & mask) {
pic_mark_pending(pic->pic_intrbase + irq);
out32rb(INT_CLEAR_REG, mask);