FreeBSD/Linux Kernel Cross Reference
sys/dev/pci/pucvar.h
1 /* $NetBSD: pucvar.h,v 1.6 2004/02/03 19:51:39 fredb Exp $ */
2
3 /*
4 * Copyright (c) 1998, 1999 Christopher G. Demetriou. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by Christopher G. Demetriou
17 * for the NetBSD Project.
18 * 4. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33 /*
34 * Exported (or conveniently located) PCI "universal" communications card
35 * software structures.
36 *
37 * Author: Christopher G. Demetriou, May 14, 1998.
38 */
39
40 #define PUC_MAX_PORTS 8
41
42 struct puc_device_description {
43 const char *name;
44 pcireg_t rval[4];
45 pcireg_t rmask[4];
46 struct {
47 int type;
48 int bar;
49 int offset;
50 int flags;
51 } ports[PUC_MAX_PORTS];
52 };
53
54 #define PUC_REG_VEND 0
55 #define PUC_REG_PROD 1
56 #define PUC_REG_SVEND 2
57 #define PUC_REG_SPROD 3
58
59 #define PUC_PORT_TYPE_NONE 0
60 #define PUC_PORT_TYPE_COM 1
61 #define PUC_PORT_TYPE_LPT 2
62
63 #define PUC_PORT_VALID(desc, port) \
64 ((port) < PUC_MAX_PORTS && (desc)->ports[(port)].type != PUC_PORT_TYPE_NONE)
65 #define PUC_PORT_BAR_INDEX(bar) (((bar) - PCI_MAPREG_START) / 4)
66
67 /* Flags for PUC_PORT_TYPE_COM */
68 /* * assume all clock rates have 8 lower bits to 0 - this leaves us 8 flags */
69 #define PUC_COM_CLOCKMASK 0xffffff00
70
71 #define PUC_COM_FLAG0 (1 << 0)
72 #define PUC_COM_FLAG1 (1 << 1)
73 #define PUC_COM_FLAG2 (1 << 2)
74 #define PUC_COM_FLAG3 (1 << 3)
75 #define PUC_COM_FLAG4 (1 << 4)
76 #define PUC_COM_FLAG5 (1 << 5)
77 #define PUC_COM_FLAG6 (1 << 6)
78 #define PUC_COM_FLAG7 (1 << 7)
79
80 /* Flags for SIIG Cyberserial options */
81 #define PUC_COM_SIIG10x PUC_COM_FLAG7
82 #define PUC_COM_SIIG20x PUC_COM_FLAG6
83 #define PUC_PORT_USR0 PUC_COM_FLAG0
84 #define PUC_PORT_USR1 PUC_COM_FLAG1
85 #define PUC_PORT_USR2 PUC_COM_FLAG2
86 #define PUC_PORT_USR3 PUC_COM_FLAG3
87
88 /* Flags for PUC_PORT_TYPE_LPT */
89 /* none currently */
90
91 struct puc_attach_args {
92 int port;
93 int type;
94 int flags;
95
96 pci_chipset_tag_t pc;
97 pci_intr_handle_t intrhandle;
98 pcitag_t tag;
99
100 bus_addr_t a;
101 bus_space_tag_t t;
102 bus_space_handle_t h;
103 bus_dma_tag_t dmat;
104 bus_dma_tag_t dmat64;
105 };
106
107 extern const struct puc_device_description puc_devices[];
108 extern const struct puc_device_description *
109 puc_find_description __P((pcireg_t, pcireg_t, pcireg_t, pcireg_t));
Cache object: d3bcdc22267507330d266cf5f9aa92f5
|