blob: c78d9b11208033a58df7a5d29b266d1ac70c4a7f [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
Linus Torvalds1da177e2005-04-16 15:20:36 -070046/* ModifyConfiguration */
47typedef struct modconf_t {
48 u_int Attributes;
49 u_int Vcc, Vpp1, Vpp2;
50} modconf_t;
51
52/* Attributes for ModifyConfiguration */
Dominik Brodowski4bbed522006-01-15 11:18:12 +010053#define CONF_IRQ_CHANGE_VALID 0x0100
54#define CONF_VCC_CHANGE_VALID 0x0200
55#define CONF_VPP1_CHANGE_VALID 0x0400
56#define CONF_VPP2_CHANGE_VALID 0x0800
57#define CONF_IO_CHANGE_WIDTH 0x1000
Linus Torvalds1da177e2005-04-16 15:20:36 -070058
59/* For RequestConfiguration */
60typedef struct config_req_t {
61 u_int Attributes;
Dominik Brodowski70294b42006-01-15 12:43:16 +010062 u_int Vpp; /* both Vpp1 and Vpp2 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070063 u_int IntType;
64 u_int ConfigBase;
65 u_char Status, Pin, Copy, ExtStatus;
66 u_char ConfigIndex;
67 u_int Present;
68} config_req_t;
69
70/* Attributes for RequestConfiguration */
71#define CONF_ENABLE_IRQ 0x01
72#define CONF_ENABLE_DMA 0x02
73#define CONF_ENABLE_SPKR 0x04
Dominik Brodowskia7debe72010-03-07 10:58:29 +010074#define CONF_ENABLE_PULSE_IRQ 0x08
Linus Torvalds1da177e2005-04-16 15:20:36 -070075#define CONF_VALID_CLIENT 0x100
76
77/* IntType field */
78#define INT_MEMORY 0x01
79#define INT_MEMORY_AND_IO 0x02
80#define INT_CARDBUS 0x04
81#define INT_ZOOMED_VIDEO 0x08
82
83/* For RequestIO and ReleaseIO */
84typedef struct io_req_t {
Olof Johanssonecb8a842008-02-04 22:27:34 -080085 u_int BasePort1;
86 u_int NumPorts1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070087 u_int Attributes1;
Olof Johanssonecb8a842008-02-04 22:27:34 -080088 u_int BasePort2;
89 u_int NumPorts2;
Linus Torvalds1da177e2005-04-16 15:20:36 -070090 u_int Attributes2;
91 u_int IOAddrLines;
92} io_req_t;
93
94/* Attributes for RequestIO and ReleaseIO */
95#define IO_SHARED 0x01
96#define IO_FIRST_SHARED 0x02
97#define IO_FORCE_ALIAS_ACCESS 0x04
98#define IO_DATA_PATH_WIDTH 0x18
99#define IO_DATA_PATH_WIDTH_8 0x00
100#define IO_DATA_PATH_WIDTH_16 0x08
101#define IO_DATA_PATH_WIDTH_AUTO 0x10
102
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103/* Bits in IRQInfo1 field */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104#define IRQ_NMI_ID 0x01
105#define IRQ_IOCK_ID 0x02
106#define IRQ_BERR_ID 0x04
107#define IRQ_VEND_ID 0x08
108#define IRQ_INFO2_VALID 0x10
109#define IRQ_LEVEL_ID 0x20
110#define IRQ_PULSE_ID 0x40
111#define IRQ_SHARE_ID 0x80
112
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113/* Configuration registers present */
114#define PRESENT_OPTION 0x001
115#define PRESENT_STATUS 0x002
116#define PRESENT_PIN_REPLACE 0x004
117#define PRESENT_COPY 0x008
118#define PRESENT_EXT_STATUS 0x010
119#define PRESENT_IOBASE_0 0x020
120#define PRESENT_IOBASE_1 0x040
121#define PRESENT_IOBASE_2 0x080
122#define PRESENT_IOBASE_3 0x100
123#define PRESENT_IOSIZE 0x200
124
125/* For GetMemPage, MapMemPage */
126typedef struct memreq_t {
127 u_int CardOffset;
Dominik Brodowskiac8b4222010-07-21 22:38:13 +0200128 u_short Page;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129} memreq_t;
130
131/* For ModifyWindow */
132typedef struct modwin_t {
133 u_int Attributes;
134 u_int AccessSpeed;
135} modwin_t;
136
137/* For RequestWindow */
138typedef struct win_req_t {
139 u_int Attributes;
140 u_long Base;
141 u_int Size;
142 u_int AccessSpeed;
143} win_req_t;
144
145/* Attributes for RequestWindow */
146#define WIN_ADDR_SPACE 0x0001
147#define WIN_ADDR_SPACE_MEM 0x0000
148#define WIN_ADDR_SPACE_IO 0x0001
149#define WIN_MEMORY_TYPE 0x0002
150#define WIN_MEMORY_TYPE_CM 0x0000
151#define WIN_MEMORY_TYPE_AM 0x0002
152#define WIN_ENABLE 0x0004
153#define WIN_DATA_WIDTH 0x0018
154#define WIN_DATA_WIDTH_8 0x0000
155#define WIN_DATA_WIDTH_16 0x0008
156#define WIN_DATA_WIDTH_32 0x0010
157#define WIN_PAGED 0x0020
158#define WIN_SHARED 0x0040
159#define WIN_FIRST_SHARED 0x0080
160#define WIN_USE_WAIT 0x0100
161#define WIN_STRICT_ALIGN 0x0200
162#define WIN_MAP_BELOW_1MB 0x0400
163#define WIN_PREFETCH 0x0800
164#define WIN_CACHEABLE 0x1000
165#define WIN_BAR_MASK 0xe000
166#define WIN_BAR_SHIFT 13
167
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168/* Flag to bind to all functions */
169#define BIND_FN_ALL 0xff
170
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171#endif /* _LINUX_CS_H */