1230557Sjimharris/*-
2230557Sjimharris * EISA bus device definitions
3230557Sjimharris *
4230557Sjimharris * Copyright (c) 1995, 1996 Justin T. Gibbs.
5230557Sjimharris * All rights reserved.
6230557Sjimharris *
7230557Sjimharris * Redistribution and use in source and binary forms, with or without
8230557Sjimharris * modification, are permitted provided that the following conditions
9230557Sjimharris * are met:
10230557Sjimharris * 1. Redistributions of source code must retain the above copyright
11230557Sjimharris *    notice immediately at the beginning of the file, without modification,
12230557Sjimharris *    this list of conditions, and the following disclaimer.
13230557Sjimharris * 2. Redistributions in binary form must reproduce the above copyright
14230557Sjimharris *    notice, this list of conditions and the following disclaimer in the
15230557Sjimharris *    documentation and/or other materials provided with the distribution.
16230557Sjimharris * 3. The name of the author may not be used to endorse or promote products
17230557Sjimharris *    derived from this software without specific prior written permission.
18230557Sjimharris *
19230557Sjimharris * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20230557Sjimharris * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21230557Sjimharris * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22230557Sjimharris * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
23230557Sjimharris * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24230557Sjimharris * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25230557Sjimharris * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26230557Sjimharris * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27230557Sjimharris * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28230557Sjimharris * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29230557Sjimharris * SUCH DAMAGE.
30230557Sjimharris *
31230557Sjimharris * $FreeBSD: releng/10.2/sys/dev/eisa/eisaconf.h 139749 2005-01-06 01:43:34Z imp $
32230557Sjimharris */
33230557Sjimharris
34230557Sjimharris#ifndef _DEV_EISA_EISACONF_H_
35230557Sjimharris#define _DEV_EISA_EISACONF_H_ 1
36230557Sjimharris
37230557Sjimharris#include "eisa_if.h"
38230557Sjimharris#define EISA_SLOT_SIZE 0x1000
39230557Sjimharris
40230557Sjimharris#define EISA_MFCTR_CHAR0(ID) (char)(((ID>>26) & 0x1F) | '@')  /* Bits 26-30 */
41230557Sjimharris#define EISA_MFCTR_CHAR1(ID) (char)(((ID>>21) & 0x1F) | '@')  /* Bits 21-25 */
42230557Sjimharris#define EISA_MFCTR_CHAR2(ID) (char)(((ID>>16) & 0x1F) | '@')  /* Bits 16-20 */
43230557Sjimharris#define EISA_MFCTR_ID(ID)    (short)((ID>>16) & 0xFF)	      /* Bits 16-31 */
44230557Sjimharris#define EISA_PRODUCT_ID(ID)  (short)((ID>>4)  & 0xFFF)        /* Bits  4-15 */
45230557Sjimharris#define EISA_REVISION_ID(ID) (u_char)(ID & 0x0F)              /* Bits  0-3  */
46230557Sjimharris
47230557Sjimharrisextern int num_eisa_slots;
48230557Sjimharris
49230557Sjimharristypedef u_int32_t eisa_id_t;
50230557Sjimharris
51230557Sjimharrisenum eisa_device_ivars {
52230557Sjimharris    EISA_IVAR_SLOT,
53230557Sjimharris    EISA_IVAR_ID,
54230557Sjimharris    EISA_IVAR_IRQ
55230557Sjimharris};
56230557Sjimharris
57230557Sjimharris#define EISA_TRIGGER_EDGE       0x0
58230557Sjimharris#define EISA_TRIGGER_LEVEL      0x1
59230557Sjimharris
60230557Sjimharris/*
61230557Sjimharris * Simplified accessors for isa devices
62230557Sjimharris */
63230557Sjimharris#define EISA_ACCESSOR(var, ivar, type)					 \
64230557Sjimharris	__BUS_ACCESSOR(eisa, var, EISA, ivar, type)
65230557Sjimharris
66230557SjimharrisEISA_ACCESSOR(slot, SLOT, int)
67230557SjimharrisEISA_ACCESSOR(id, ID, eisa_id_t)
68230557SjimharrisEISA_ACCESSOR(irq, IRQ, eisa_id_t)
69230557Sjimharris
70230557Sjimharris#undef EISA_ACCESSOR
71230557Sjimharris
72230557Sjimharris#define		RESVADDR_NONE		0x00
73230557Sjimharris#define		RESVADDR_BITMASK	0x01	/* size is a mask of reserved
74230557Sjimharris						 * bits at addr
75230557Sjimharris						 */
76230557Sjimharris#define		RESVADDR_RELOCATABLE	0x02
77230557Sjimharris
78230557Sjimharrisstatic __inline int
79230557Sjimharriseisa_add_intr(device_t dev, int irq, int trigger)
80230557Sjimharris{
81230557Sjimharris	return (EISA_ADD_INTR(device_get_parent(dev), dev, irq, trigger));
82230557Sjimharris}
83230557Sjimharris
84230557Sjimharrisstatic __inline int
85230557Sjimharriseisa_add_iospace(device_t dev, u_long iobase, u_long iosize, int flags)
86230557Sjimharris{
87230557Sjimharris	return (EISA_ADD_IOSPACE(device_get_parent(dev), dev, iobase, iosize,
88230557Sjimharris	    flags));
89230557Sjimharris}
90230557Sjimharris
91230557Sjimharrisstatic __inline int
92230557Sjimharriseisa_add_mspace(device_t dev, u_long mbase, u_long msize, int flags)
93230557Sjimharris{
94230557Sjimharris	return (EISA_ADD_MSPACE(device_get_parent(dev), dev, mbase, msize,
95230557Sjimharris	    flags));
96230557Sjimharris}
97230557Sjimharris
98230557Sjimharris#endif /* _DEV_EISA_EISACONF_H_ */
99230557Sjimharris