Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 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 Brodowski | 5fa9167 | 2009-11-08 17:24:46 +0100 | [diff] [blame] | 18 | #ifdef __KERNEL__ |
| 19 | #include <linux/interrupt.h> |
| 20 | #endif |
| 21 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | /* For AccessConfigurationRegister */ |
| 23 | typedef 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | /* Action field */ |
| 36 | #define REMOVE_MANAGED_RESOURCE 1 |
| 37 | #define ADD_MANAGED_RESOURCE 2 |
Dominik Brodowski | a583578 | 2008-08-28 00:41:16 +0200 | [diff] [blame] | 38 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | /* 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | /* ModifyConfiguration */ |
| 47 | typedef struct modconf_t { |
| 48 | u_int Attributes; |
| 49 | u_int Vcc, Vpp1, Vpp2; |
| 50 | } modconf_t; |
| 51 | |
| 52 | /* Attributes for ModifyConfiguration */ |
Dominik Brodowski | 4bbed52 | 2006-01-15 11:18:12 +0100 | [diff] [blame] | 53 | #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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | |
| 59 | /* For RequestConfiguration */ |
| 60 | typedef struct config_req_t { |
| 61 | u_int Attributes; |
Dominik Brodowski | 70294b4 | 2006-01-15 12:43:16 +0100 | [diff] [blame] | 62 | u_int Vpp; /* both Vpp1 and Vpp2 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | 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 Brodowski | a7debe7 | 2010-03-07 10:58:29 +0100 | [diff] [blame] | 74 | #define CONF_ENABLE_PULSE_IRQ 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | #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 */ |
| 84 | typedef struct io_req_t { |
Olof Johansson | ecb8a84 | 2008-02-04 22:27:34 -0800 | [diff] [blame] | 85 | u_int BasePort1; |
| 86 | u_int NumPorts1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | u_int Attributes1; |
Olof Johansson | ecb8a84 | 2008-02-04 22:27:34 -0800 | [diff] [blame] | 88 | u_int BasePort2; |
| 89 | u_int NumPorts2; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 90 | 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | /* Bits in IRQInfo1 field */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | #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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | /* 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 */ |
| 126 | typedef struct memreq_t { |
| 127 | u_int CardOffset; |
Dominik Brodowski | ac8b422 | 2010-07-21 22:38:13 +0200 | [diff] [blame^] | 128 | u_short Page; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | } memreq_t; |
| 130 | |
| 131 | /* For ModifyWindow */ |
| 132 | typedef struct modwin_t { |
| 133 | u_int Attributes; |
| 134 | u_int AccessSpeed; |
| 135 | } modwin_t; |
| 136 | |
| 137 | /* For RequestWindow */ |
| 138 | typedef 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | /* Flag to bind to all functions */ |
| 169 | #define BIND_FN_ALL 0xff |
| 170 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | #endif /* _LINUX_CS_H */ |