Use the common 82c693 access functions to read/write the ELCR.

This commit is contained in:
thorpej 2000-06-06 03:10:13 +00:00
parent 21d9669e4f
commit f3d9d1ac8a
1 changed files with 16 additions and 16 deletions

View File

@ -1,7 +1,7 @@
/* $NetBSD: sio_pic.c,v 1.27 2000/06/05 21:47:29 thorpej Exp $ */
/* $NetBSD: sio_pic.c,v 1.28 2000/06/06 03:10:13 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -66,7 +66,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: sio_pic.c,v 1.27 2000/06/05 21:47:29 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: sio_pic.c,v 1.28 2000/06/06 03:10:13 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -81,6 +81,9 @@ __KERNEL_RCSID(0, "$NetBSD: sio_pic.c,v 1.27 2000/06/05 21:47:29 thorpej Exp $")
#include <dev/pci/pcivar.h>
#include <dev/pci/pcidevs.h>
#include <dev/pci/cy82c693reg.h>
#include <dev/pci/cy82c693var.h>
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
#include <alpha/pci/siovar.h>
@ -103,7 +106,7 @@ __KERNEL_RCSID(0, "$NetBSD: sio_pic.c,v 1.27 2000/06/05 21:47:29 thorpej Exp $")
bus_space_tag_t sio_iot;
pci_chipset_tag_t sio_pc;
bus_space_handle_t sio_ioh_icu1, sio_ioh_icu2, sio_ioh_elcr;
bus_space_handle_t sio_ioh_icu1, sio_ioh_icu2;
#define ICU_LEN 16 /* number of ISA IRQs */
@ -137,6 +140,8 @@ int i82378_setup_elcr __P((void));
u_int8_t i82378_read_elcr __P((int));
void i82378_write_elcr __P((int, u_int8_t));
bus_space_handle_t sio_ioh_elcr;
int
i82378_setup_elcr()
{
@ -181,6 +186,8 @@ int cy82c693_setup_elcr __P((void));
u_int8_t cy82c693_read_elcr __P((int));
void cy82c693_write_elcr __P((int, u_int8_t));
const struct cy82c693_handle *sio_cy82c693_handle;
int
cy82c693_setup_elcr()
{
@ -226,12 +233,7 @@ cy82c693_setup_elcr()
device);
#endif
/*
* The CY82C693's ELCR registers are accessed indirectly
* via (IO_ICU1 + 2) (address) and (IO_ICU1 + 3) (data).
*/
sio_ioh_elcr = sio_ioh_icu1;
sio_cy82c693_handle = cy82c693_init(sio_iot);
sio_read_elcr = cy82c693_read_elcr;
sio_write_elcr = cy82c693_write_elcr;
@ -249,8 +251,7 @@ cy82c693_read_elcr(elcr)
int elcr;
{
bus_space_write_1(sio_iot, sio_ioh_elcr, 0x02, 0x03 + elcr);
return (bus_space_read_1(sio_iot, sio_ioh_elcr, 0x03));
return (cy82c693_read(sio_cy82c693_handle, CONFIG_ELCR1 + elcr));
}
void
@ -259,8 +260,7 @@ cy82c693_write_elcr(elcr, val)
u_int8_t val;
{
bus_space_write_1(sio_iot, sio_ioh_elcr, 0x02, 0x03 + elcr);
bus_space_write_1(sio_iot, sio_ioh_elcr, 0x03, val);
cy82c693_write(sio_cy82c693_handle, CONFIG_ELCR1 + elcr, val);
}
/******************** ELCR access function configuration ********************/
@ -341,8 +341,8 @@ sio_intr_setup(pc, iot)
sio_iot = iot;
sio_pc = pc;
if (bus_space_map(sio_iot, IO_ICU1, IO_ICUSIZE, 0, &sio_ioh_icu1) ||
bus_space_map(sio_iot, IO_ICU2, IO_ICUSIZE, 0, &sio_ioh_icu2))
if (bus_space_map(sio_iot, IO_ICU1, 2, 0, &sio_ioh_icu1) ||
bus_space_map(sio_iot, IO_ICU2, 2, 0, &sio_ioh_icu2))
panic("sio_intr_setup: can't map ICU I/O ports");
for (i = 0; sio_elcr_setup_funcs[i] != NULL; i++)