blob: c943c967ac7a7c4a73945c744556d597f4323acd [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * cs.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * The initial developer of the original code is David A. Hinds
9 * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
10 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
11 *
12 * (C) 1999 David A. Hinds
13 */
14
15#ifndef _LINUX_CS_H
16#define _LINUX_CS_H
17
Dominik Brodowski5fa91672009-11-08 17:24:46 +010018#ifdef __KERNEL__
19#include <linux/interrupt.h>
20#endif
21
Linus Torvalds1da177e2005-04-16 15:20:36 -070022/* For AccessConfigurationRegister */
23typedef struct conf_reg_t {
24 u_char Function;
25 u_int Action;
26 off_t Offset;
27 u_int Value;
28} conf_reg_t;
29
30/* Actions */
31#define CS_READ 1
32#define CS_WRITE 2
33
34/* for AdjustResourceInfo */
Linus Torvalds1da177e2005-04-16 15:20:36 -070035/* Action field */
36#define REMOVE_MANAGED_RESOURCE 1
37#define ADD_MANAGED_RESOURCE 2
Dominik Brodowskia5835782008-08-28 00:41:16 +020038
Linus Torvalds1da177e2005-04-16 15:20:36 -070039/* For CardValues field */
40#define CV_OPTION_VALUE 0x01
41#define CV_STATUS_VALUE 0x02
42#define CV_PIN_REPLACEMENT 0x04
43#define CV_COPY_VALUE 0x08
44#define CV_EXT_STATUS 0x10
45
46/* For GetFirst/NextClient */
47typedef struct client_req_t {
48 socket_t Socket;
49 u_int Attributes;
50} client_req_t;
51
52#define CLIENT_THIS_SOCKET 0x01
53
Linus Torvalds1da177e2005-04-16 15:20:36 -070054/* ModifyConfiguration */
55typedef struct modconf_t {
56 u_int Attributes;
57 u_int Vcc, Vpp1, Vpp2;
58} modconf_t;
59
60/* Attributes for ModifyConfiguration */
Dominik Brodowski4bbed522006-01-15 11:18:12 +010061#define CONF_IRQ_CHANGE_VALID 0x0100
62#define CONF_VCC_CHANGE_VALID 0x0200
63#define CONF_VPP1_CHANGE_VALID 0x0400
64#define CONF_VPP2_CHANGE_VALID 0x0800
65#define CONF_IO_CHANGE_WIDTH 0x1000
Linus Torvalds1da177e2005-04-16 15:20:36 -070066
67/* For RequestConfiguration */
68typedef struct config_req_t {
69 u_int Attributes;
Dominik Brodowski70294b42006-01-15 12:43:16 +010070 u_int Vpp; /* both Vpp1 and Vpp2 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 u_int IntType;
72 u_int ConfigBase;
73 u_char Status, Pin, Copy, ExtStatus;
74 u_char ConfigIndex;
75 u_int Present;
76} config_req_t;
77
78/* Attributes for RequestConfiguration */
79#define CONF_ENABLE_IRQ 0x01
80#define CONF_ENABLE_DMA 0x02
81#define CONF_ENABLE_SPKR 0x04
Dominik Brodowskia7debe72010-03-07 10:58:29 +010082#define CONF_ENABLE_PULSE_IRQ 0x08
Linus Torvalds1da177e2005-04-16 15:20:36 -070083#define CONF_VALID_CLIENT 0x100
84
85/* IntType field */
86#define INT_MEMORY 0x01
87#define INT_MEMORY_AND_IO 0x02
88#define INT_CARDBUS 0x04
89#define INT_ZOOMED_VIDEO 0x08
90
91/* For RequestIO and ReleaseIO */
92typedef struct io_req_t {
Olof Johanssonecb8a842008-02-04 22:27:34 -080093 u_int BasePort1;
94 u_int NumPorts1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070095 u_int Attributes1;
Olof Johanssonecb8a842008-02-04 22:27:34 -080096 u_int BasePort2;
97 u_int NumPorts2;
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 u_int Attributes2;
99 u_int IOAddrLines;
100} io_req_t;
101
102/* Attributes for RequestIO and ReleaseIO */
103#define IO_SHARED 0x01
104#define IO_FIRST_SHARED 0x02
105#define IO_FORCE_ALIAS_ACCESS 0x04
106#define IO_DATA_PATH_WIDTH 0x18
107#define IO_DATA_PATH_WIDTH_8 0x00
108#define IO_DATA_PATH_WIDTH_16 0x08
109#define IO_DATA_PATH_WIDTH_AUTO 0x10
110
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111/* Bits in IRQInfo1 field */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112#define IRQ_NMI_ID 0x01
113#define IRQ_IOCK_ID 0x02
114#define IRQ_BERR_ID 0x04
115#define IRQ_VEND_ID 0x08
116#define IRQ_INFO2_VALID 0x10
117#define IRQ_LEVEL_ID 0x20
118#define IRQ_PULSE_ID 0x40
119#define IRQ_SHARE_ID 0x80
120
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121/* Configuration registers present */
122#define PRESENT_OPTION 0x001
123#define PRESENT_STATUS 0x002
124#define PRESENT_PIN_REPLACE 0x004
125#define PRESENT_COPY 0x008
126#define PRESENT_EXT_STATUS 0x010
127#define PRESENT_IOBASE_0 0x020
128#define PRESENT_IOBASE_1 0x040
129#define PRESENT_IOBASE_2 0x080
130#define PRESENT_IOBASE_3 0x100
131#define PRESENT_IOSIZE 0x200
132
133/* For GetMemPage, MapMemPage */
134typedef struct memreq_t {
135 u_int CardOffset;
136 page_t Page;
137} memreq_t;
138
139/* For ModifyWindow */
140typedef struct modwin_t {
141 u_int Attributes;
142 u_int AccessSpeed;
143} modwin_t;
144
145/* For RequestWindow */
146typedef struct win_req_t {
147 u_int Attributes;
148 u_long Base;
149 u_int Size;
150 u_int AccessSpeed;
151} win_req_t;
152
153/* Attributes for RequestWindow */
154#define WIN_ADDR_SPACE 0x0001
155#define WIN_ADDR_SPACE_MEM 0x0000
156#define WIN_ADDR_SPACE_IO 0x0001
157#define WIN_MEMORY_TYPE 0x0002
158#define WIN_MEMORY_TYPE_CM 0x0000
159#define WIN_MEMORY_TYPE_AM 0x0002
160#define WIN_ENABLE 0x0004
161#define WIN_DATA_WIDTH 0x0018
162#define WIN_DATA_WIDTH_8 0x0000
163#define WIN_DATA_WIDTH_16 0x0008
164#define WIN_DATA_WIDTH_32 0x0010
165#define WIN_PAGED 0x0020
166#define WIN_SHARED 0x0040
167#define WIN_FIRST_SHARED 0x0080
168#define WIN_USE_WAIT 0x0100
169#define WIN_STRICT_ALIGN 0x0200
170#define WIN_MAP_BELOW_1MB 0x0400
171#define WIN_PREFETCH 0x0800
172#define WIN_CACHEABLE 0x1000
173#define WIN_BAR_MASK 0xe000
174#define WIN_BAR_SHIFT 13
175
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176/* Flag to bind to all functions */
177#define BIND_FN_ALL 0xff
178
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179#endif /* _LINUX_CS_H */