1 #-
2 # Copyright (c) 1999 M. Warner Losh.
3 # All rights reserved.
4 #
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
7 # are met:
8 # 1. Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # 2. Redistributions in binary form must reproduce the above copyright
11 # notice, this list of conditions and the following disclaimer in the
12 # documentation and/or other materials provided with the distribution.
13 #
14 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 # SUCH DAMAGE.
25 #
26 # $FreeBSD: releng/7.4/sys/dev/pccard/card_if.m 150533 2005-09-25 01:39:04Z imp $
27 #
28
29 #include <sys/bus.h>
30 #include <machine/bus.h>
31 #include <dev/pccard/pccardvar.h>
32
33 INTERFACE card;
34
35 #
36 # Companion interface for pccard. We need to set attributes for memory
37 # and i/o port mappings (as well as other types of attributes) that have
38 # a well defined meaning inside the pccard/cardbus system. The bus
39 # methods are inadequate for this because this must be done at the time the
40 # resources are set for the device, which predates their activation. Also,
41 # the driver activating the resources doesn't necessarily know or need to know
42 # these attributes.
43 #
44 METHOD int set_res_flags {
45 device_t dev;
46 device_t child;
47 int restype;
48 int rid;
49 u_long value;
50 };
51
52 METHOD int get_res_flags {
53 device_t dev;
54 device_t child;
55 int restype;
56 int rid;
57 u_long *value;
58 };
59
60 #
61 # Sets the memory offset of the pccard bridge's window into attribute
62 # or common memory space.
63 #
64 METHOD int set_memory_offset {
65 device_t dev;
66 device_t child;
67 int rid;
68 uint32_t cardaddr;
69 uint32_t *deltap;
70 }
71
72 METHOD int get_memory_offset {
73 device_t dev;
74 device_t child;
75 int rid;
76 uint32_t *offset;
77 }
78
79 #
80 # pccard bridges call this method to initate the attachment of a card
81 #
82 METHOD int attach_card {
83 device_t dev;
84 }
85
86 #
87 # pccard bridges call this to detach a card.
88 #
89 METHOD int detach_card {
90 device_t dev;
91 }
92
93 #
94 # Find "dev" in the passed table of devices. Return it or NULL.
95 #
96 METHOD struct pccard_product * do_product_lookup {
97 device_t bus;
98 device_t dev;
99 const struct pccard_product *tab;
100 size_t ent_size;
101 pccard_product_match_fn matchfn;
102 }
103
104 #
105 # Helper method for the above. When a compatibility driver is converted,
106 # one must write a match routine. This routine is unused on OLDCARD but
107 # is used as a discriminator for NEWCARD.
108 #
109 METHOD int compat_match {
110 device_t dev;
111 }
112
113 #
114 # Scanning function for accessing the CIS of a card in its driver.
115 #
116 METHOD int cis_scan {
117 device_t bus;
118 device_t dev;
119 pccard_scan_t fnp;
120 void *argp;
121 };
122
123 #
124 # Convenience function to read attribute memory.
125 #
126 METHOD int attr_read {
127 device_t bus;
128 device_t dev;
129 uint32_t offset;
130 uint8_t *val;
131 }
132
133 #
134 # Convenience function to write attribute memory.
135 #
136 METHOD int attr_write {
137 device_t bus;
138 device_t dev;
139 uint32_t offset;
140 uint8_t val;
141 }
142
143 #
144 # Read the CCR register
145 #
146 METHOD int ccr_read {
147 device_t bus;
148 device_t dev;
149 uint32_t offset;
150 uint8_t *val;
151 }
152
153 #
154 # Write the CCR register
155 #
156 METHOD int ccr_write {
157 device_t bus;
158 device_t dev;
159 uint32_t offset;
160 uint8_t val;
161 }
Cache object: 9539d43a03710d127a66c932ca3d1bb6
|