2001-06-04 22:59:31 +04:00
|
|
|
/* $NetBSD: hpciovar.h,v 1.4 2001/06/04 18:59:32 uch Exp $ */
|
2001-04-30 15:42:17 +04:00
|
|
|
|
|
|
|
/*-
|
|
|
|
* Copyright (c) 2001 TAKEMURA Shin.
|
|
|
|
* 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.
|
|
|
|
* 3. Neither the name of the project nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _DEV_HPC_HPCIOVAR_H_
|
|
|
|
#define _DEV_HPC_HPCIOVAR_H_
|
|
|
|
|
|
|
|
struct hpcio_chip;
|
|
|
|
typedef struct hpcio_chip *hpcio_chip_t;
|
|
|
|
typedef void *hpcio_intr_handle_t;
|
|
|
|
struct hpcio_chip {
|
|
|
|
int hc_chipid;
|
|
|
|
char *hc_name;
|
|
|
|
void *hc_sc;
|
|
|
|
int (*hc_portread)(hpcio_chip_t, int);
|
|
|
|
void (*hc_portwrite)(hpcio_chip_t, int, int);
|
2001-06-04 22:59:31 +04:00
|
|
|
hpcio_intr_handle_t(*hc_intr_establish)(hpcio_chip_t, int, int,
|
|
|
|
int (*)(void *), void *);
|
2001-04-30 15:42:17 +04:00
|
|
|
void (*hc_intr_disestablish)(hpcio_chip_t, hpcio_intr_handle_t);
|
|
|
|
void (*hc_intr_clear)(hpcio_chip_t, hpcio_intr_handle_t);
|
2001-05-06 18:25:15 +04:00
|
|
|
void (*hc_register_iochip)(hpcio_chip_t, hpcio_chip_t);
|
2001-04-30 15:42:17 +04:00
|
|
|
void (*hc_update)(hpcio_chip_t);
|
|
|
|
void (*hc_dump)(hpcio_chip_t);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct hpcio_attach_args {
|
|
|
|
char *haa_busname;
|
|
|
|
void *haa_sc;
|
|
|
|
hpcio_chip_t (*haa_getchip)(void*, int);
|
2001-05-06 18:25:15 +04:00
|
|
|
bus_space_tag_t haa_iot; /* I/O space tag */
|
2001-04-30 15:42:17 +04:00
|
|
|
};
|
2001-05-01 04:25:16 +04:00
|
|
|
#define HPCIO_BUSNAME "hpcioif"
|
2001-04-30 15:42:17 +04:00
|
|
|
|
2001-06-04 22:59:31 +04:00
|
|
|
#define hpcio_portread(hc, port) \
|
2001-04-30 15:42:17 +04:00
|
|
|
((*(hc)->hc_portread)((hc), (port)))
|
2001-06-04 22:59:31 +04:00
|
|
|
#define hpcio_portwrite(hc, port, data) \
|
2001-04-30 15:42:17 +04:00
|
|
|
((*(hc)->hc_portwrite)((hc), (port), (data)))
|
2001-06-04 22:59:31 +04:00
|
|
|
#define hpcio_intr_establish(hc, port, mode, func, arg) \
|
2001-04-30 15:42:17 +04:00
|
|
|
((*(hc)->hc_intr_establish)((hc),(port),(mode),(func),(arg)))
|
2001-06-04 22:59:31 +04:00
|
|
|
#define hpcio_intr_disestablish(hc, handle) \
|
2001-04-30 15:42:17 +04:00
|
|
|
((*(hc)->hc_intr_disestablish)((hc), (handle)))
|
2001-06-04 22:59:31 +04:00
|
|
|
#define hpcio_intr_clear(hc, handle) \
|
2001-04-30 15:42:17 +04:00
|
|
|
((*(hc)->hc_intr_clear)((hc), (handle)))
|
2001-06-04 22:59:31 +04:00
|
|
|
#define hpcio_register_iochip(hc, iochip) \
|
2001-05-06 18:25:15 +04:00
|
|
|
((*(hc)->hc_register_iochip)((hc), (iochip)))
|
2001-06-04 22:59:31 +04:00
|
|
|
#define hpcio_update(hc) \
|
2001-04-30 15:42:17 +04:00
|
|
|
((*(hc)->hc_update)(hc))
|
2001-06-04 22:59:31 +04:00
|
|
|
#define hpcio_dump(hc) \
|
2001-04-30 15:42:17 +04:00
|
|
|
((*(hc)->hc_dump)(hc))
|
|
|
|
|
|
|
|
/* interrupt trigger options. */
|
|
|
|
#define HPCIO_INTR_EDGE (1<<0)
|
|
|
|
#define HPCIO_INTR_LEVEL (0<<0)
|
|
|
|
#define HPCIO_INTR_HOLD (1<<1)
|
|
|
|
#define HPCIO_INTR_THROUGH (0<<1)
|
|
|
|
#define HPCIO_INTR_HIGH (1<<2)
|
|
|
|
#define HPCIO_INTR_LOW (0<<2)
|
|
|
|
#define HPCIO_INTR_POSEDGE (1<<3)
|
|
|
|
#define HPCIO_INTR_NEGEDGE (1<<4)
|
|
|
|
|
2001-06-04 22:59:31 +04:00
|
|
|
#define HPCIO_INTR_LEVEL_HIGH_HOLD \
|
2001-04-30 15:42:17 +04:00
|
|
|
(HPCIO_INTR_LEVEL|HPCIO_INTR_HIGH|HPCIO_INTR_HOLD)
|
2001-06-04 22:59:31 +04:00
|
|
|
#define HPCIO_INTR_LEVEL_HIGH_THROUGH \
|
2001-04-30 15:42:17 +04:00
|
|
|
(HPCIO_INTR_LEVEL|HPCIO_INTR_HIGH|HPCIO_INTR_THROUGH)
|
2001-06-04 22:59:31 +04:00
|
|
|
#define HPCIO_INTR_LEVEL_LOW_HOLD \
|
2001-04-30 15:42:17 +04:00
|
|
|
(HPCIO_INTR_LEVEL|HPCIO_INTR_LOW|HPCIO_INTR_HOLD)
|
2001-06-04 22:59:31 +04:00
|
|
|
#define HPCIO_INTR_LEVEL_LOW_THROUGH \
|
2001-04-30 15:42:17 +04:00
|
|
|
(HPCIO_INTR_LEVEL|HPCIO_INTR_LOW|HPCIO_INTR_THROUGH)
|
2001-06-04 22:59:31 +04:00
|
|
|
#define HPCIO_INTR_EDGE_HOLD \
|
2001-04-30 15:42:17 +04:00
|
|
|
(HPCIO_INTR_EDGE|HPCIO_INTR_HOLD)
|
2001-06-04 22:59:31 +04:00
|
|
|
#define HPCIO_INTR_EDGE_THROUGH \
|
2001-04-30 15:42:17 +04:00
|
|
|
(HPCIO_INTR_EDGE|HPCIO_INTR_THROUGH)
|
|
|
|
|
|
|
|
#endif /* !_DEV_HPC_HPCIOVAR_H_ */
|