The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/include/pcmcia/cs.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * cs.h 1.74 2001/10/04 03:15:22
    3  *
    4  * The contents of this file are subject to the Mozilla Public License
    5  * Version 1.1 (the "License"); you may not use this file except in
    6  * compliance with the License. You may obtain a copy of the License
    7  * at http://www.mozilla.org/MPL/
    8  *
    9  * Software distributed under the License is distributed on an "AS IS"
   10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
   11  * the License for the specific language governing rights and
   12  * limitations under the License. 
   13  *
   14  * The initial developer of the original code is David A. Hinds
   15  * <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
   16  * are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
   17  *
   18  * Alternatively, the contents of this file may be used under the
   19  * terms of the GNU General Public License version 2 (the "GPL"), in
   20  * which case the provisions of the GPL are applicable instead of the
   21  * above.  If you wish to allow the use of your version of this file
   22  * only under the terms of the GPL and not to allow others to use
   23  * your version of this file under the MPL, indicate your decision by
   24  * deleting the provisions above and replace them with the notice and
   25  * other provisions required by the GPL.  If you do not delete the
   26  * provisions above, a recipient may use your version of this file
   27  * under either the MPL or the GPL.
   28  */
   29 
   30 #ifndef _LINUX_CS_H
   31 #define _LINUX_CS_H
   32 
   33 /* For AccessConfigurationRegister */
   34 typedef struct conf_reg_t {
   35     u_char      Function;
   36     u_int       Action;
   37     off_t       Offset;
   38     u_int       Value;
   39 } conf_reg_t;
   40 
   41 /* Actions */
   42 #define CS_READ         1
   43 #define CS_WRITE        2
   44 
   45 /* for AdjustResourceInfo */
   46 typedef struct adjust_t {
   47     u_int       Action;
   48     u_int       Resource;
   49     u_int       Attributes;
   50     union {
   51         struct memory {
   52             u_long      Base;
   53             u_long      Size;
   54         } memory;
   55         struct io {
   56             ioaddr_t    BasePort;
   57             ioaddr_t    NumPorts;
   58             u_int       IOAddrLines;
   59         } io;
   60         struct irq {
   61             u_int       IRQ;
   62         } irq;
   63     } resource;
   64 } adjust_t;
   65 
   66 /* Action field */
   67 #define REMOVE_MANAGED_RESOURCE         1
   68 #define ADD_MANAGED_RESOURCE            2
   69 #define GET_FIRST_MANAGED_RESOURCE      3
   70 #define GET_NEXT_MANAGED_RESOURCE       4
   71 /* Resource field */
   72 #define RES_MEMORY_RANGE                1
   73 #define RES_IO_RANGE                    2
   74 #define RES_IRQ                         3
   75 /* Attribute field */
   76 #define RES_IRQ_TYPE                    0x03
   77 #define RES_IRQ_TYPE_EXCLUSIVE          0
   78 #define RES_IRQ_TYPE_TIME               1
   79 #define RES_IRQ_TYPE_DYNAMIC            2
   80 #define RES_IRQ_CSC                     0x04
   81 #define RES_SHARED                      0x08
   82 #define RES_RESERVED                    0x10
   83 #define RES_ALLOCATED                   0x20
   84 #define RES_REMOVED                     0x40
   85 
   86 typedef struct servinfo_t {
   87     char        Signature[2];
   88     u_int       Count;
   89     u_int       Revision;
   90     u_int       CSLevel;
   91     char        *VendorString;
   92 } servinfo_t;
   93 
   94 typedef struct event_callback_args_t {
   95     client_handle_t client_handle;
   96     void        *info;
   97     void        *mtdrequest;
   98     void        *buffer;
   99     void        *misc;
  100     void        *client_data;
  101     struct bus_operations *bus;
  102 } event_callback_args_t;
  103 
  104 /* for GetConfigurationInfo */
  105 typedef struct config_info_t {
  106     u_char      Function;
  107     u_int       Attributes;
  108     u_int       Vcc, Vpp1, Vpp2;
  109     u_int       IntType;
  110     u_int       ConfigBase;
  111     u_char      Status, Pin, Copy, Option, ExtStatus;
  112     u_int       Present;
  113     u_int       CardValues;
  114     u_int       AssignedIRQ;
  115     u_int       IRQAttributes;
  116     ioaddr_t    BasePort1;
  117     ioaddr_t    NumPorts1;
  118     u_int       Attributes1;
  119     ioaddr_t    BasePort2;
  120     ioaddr_t    NumPorts2;
  121     u_int       Attributes2;
  122     u_int       IOAddrLines;
  123 } config_info_t;
  124 
  125 /* For CardValues field */
  126 #define CV_OPTION_VALUE         0x01
  127 #define CV_STATUS_VALUE         0x02
  128 #define CV_PIN_REPLACEMENT      0x04
  129 #define CV_COPY_VALUE           0x08
  130 #define CV_EXT_STATUS           0x10
  131 
  132 /* For GetFirst/NextClient */
  133 typedef struct client_req_t {
  134     socket_t    Socket;
  135     u_int       Attributes;
  136 } client_req_t;
  137 
  138 #define CLIENT_THIS_SOCKET      0x01
  139 
  140 /* For RegisterClient */
  141 typedef struct client_reg_t {
  142     dev_info_t  *dev_info;
  143     u_int       Attributes;
  144     u_int       EventMask;
  145     int         (*event_handler)(event_t event, int priority,
  146                                  event_callback_args_t *);
  147     event_callback_args_t event_callback_args;
  148     u_int       Version;
  149 } client_reg_t;
  150 
  151 /* ModifyConfiguration */
  152 typedef struct modconf_t {
  153     u_int       Attributes;
  154     u_int       Vcc, Vpp1, Vpp2;
  155 } modconf_t;
  156 
  157 /* Attributes for ModifyConfiguration */
  158 #define CONF_IRQ_CHANGE_VALID   0x100
  159 #define CONF_VCC_CHANGE_VALID   0x200
  160 #define CONF_VPP1_CHANGE_VALID  0x400
  161 #define CONF_VPP2_CHANGE_VALID  0x800
  162 
  163 /* For RequestConfiguration */
  164 typedef struct config_req_t {
  165     u_int       Attributes;
  166     u_int       Vcc, Vpp1, Vpp2;
  167     u_int       IntType;
  168     u_int       ConfigBase;
  169     u_char      Status, Pin, Copy, ExtStatus;
  170     u_char      ConfigIndex;
  171     u_int       Present;
  172 } config_req_t;
  173 
  174 /* Attributes for RequestConfiguration */
  175 #define CONF_ENABLE_IRQ         0x01
  176 #define CONF_ENABLE_DMA         0x02
  177 #define CONF_ENABLE_SPKR        0x04
  178 #define CONF_VALID_CLIENT       0x100
  179 
  180 /* IntType field */
  181 #define INT_MEMORY              0x01
  182 #define INT_MEMORY_AND_IO       0x02
  183 #define INT_CARDBUS             0x04
  184 #define INT_ZOOMED_VIDEO        0x08
  185 
  186 /* For RequestIO and ReleaseIO */
  187 typedef struct io_req_t {
  188     ioaddr_t    BasePort1;
  189     ioaddr_t    NumPorts1;
  190     u_int       Attributes1;
  191     ioaddr_t    BasePort2;
  192     ioaddr_t    NumPorts2;
  193     u_int       Attributes2;
  194     u_int       IOAddrLines;
  195 } io_req_t;
  196 
  197 /* Attributes for RequestIO and ReleaseIO */
  198 #define IO_SHARED               0x01
  199 #define IO_FIRST_SHARED         0x02
  200 #define IO_FORCE_ALIAS_ACCESS   0x04
  201 #define IO_DATA_PATH_WIDTH      0x18
  202 #define IO_DATA_PATH_WIDTH_8    0x00
  203 #define IO_DATA_PATH_WIDTH_16   0x08
  204 #define IO_DATA_PATH_WIDTH_AUTO 0x10
  205 
  206 /* For RequestIRQ and ReleaseIRQ */
  207 typedef struct irq_req_t {
  208     u_int       Attributes;
  209     u_int       AssignedIRQ;
  210     u_int       IRQInfo1, IRQInfo2;
  211     void        *Handler;
  212     void        *Instance;
  213 } irq_req_t;
  214 
  215 /* Attributes for RequestIRQ and ReleaseIRQ */
  216 #define IRQ_TYPE                        0x03
  217 #define IRQ_TYPE_EXCLUSIVE              0x00
  218 #define IRQ_TYPE_TIME                   0x01
  219 #define IRQ_TYPE_DYNAMIC_SHARING        0x02
  220 #define IRQ_FORCED_PULSE                0x04
  221 #define IRQ_FIRST_SHARED                0x08
  222 #define IRQ_HANDLE_PRESENT              0x10
  223 #define IRQ_PULSE_ALLOCATED             0x100
  224 
  225 /* Bits in IRQInfo1 field */
  226 #define IRQ_MASK                0x0f
  227 #define IRQ_NMI_ID              0x01
  228 #define IRQ_IOCK_ID             0x02
  229 #define IRQ_BERR_ID             0x04
  230 #define IRQ_VEND_ID             0x08
  231 #define IRQ_INFO2_VALID         0x10
  232 #define IRQ_LEVEL_ID            0x20
  233 #define IRQ_PULSE_ID            0x40
  234 #define IRQ_SHARE_ID            0x80
  235 
  236 typedef struct eventmask_t {
  237     u_int       Attributes;
  238     u_int       EventMask;
  239 } eventmask_t;
  240 
  241 #define CONF_EVENT_MASK_VALID   0x01
  242 
  243 /* Configuration registers present */
  244 #define PRESENT_OPTION          0x001
  245 #define PRESENT_STATUS          0x002
  246 #define PRESENT_PIN_REPLACE     0x004
  247 #define PRESENT_COPY            0x008
  248 #define PRESENT_EXT_STATUS      0x010
  249 #define PRESENT_IOBASE_0        0x020
  250 #define PRESENT_IOBASE_1        0x040
  251 #define PRESENT_IOBASE_2        0x080
  252 #define PRESENT_IOBASE_3        0x100
  253 #define PRESENT_IOSIZE          0x200
  254 
  255 /* For GetMemPage, MapMemPage */
  256 typedef struct memreq_t {
  257     u_int       CardOffset;
  258     page_t      Page;
  259 } memreq_t;
  260 
  261 /* For ModifyWindow */
  262 typedef struct modwin_t {
  263     u_int       Attributes;
  264     u_int       AccessSpeed;
  265 } modwin_t;
  266 
  267 /* For RequestWindow */
  268 typedef struct win_req_t {
  269     u_int       Attributes;
  270     u_long      Base;
  271     u_int       Size;
  272     u_int       AccessSpeed;
  273 } win_req_t;
  274 
  275 /* Attributes for RequestWindow */
  276 #define WIN_ADDR_SPACE          0x0001
  277 #define WIN_ADDR_SPACE_MEM      0x0000
  278 #define WIN_ADDR_SPACE_IO       0x0001
  279 #define WIN_MEMORY_TYPE         0x0002
  280 #define WIN_MEMORY_TYPE_CM      0x0000
  281 #define WIN_MEMORY_TYPE_AM      0x0002
  282 #define WIN_ENABLE              0x0004
  283 #define WIN_DATA_WIDTH          0x0018
  284 #define WIN_DATA_WIDTH_8        0x0000
  285 #define WIN_DATA_WIDTH_16       0x0008
  286 #define WIN_DATA_WIDTH_32       0x0010
  287 #define WIN_PAGED               0x0020
  288 #define WIN_SHARED              0x0040
  289 #define WIN_FIRST_SHARED        0x0080
  290 #define WIN_USE_WAIT            0x0100
  291 #define WIN_STRICT_ALIGN        0x0200
  292 #define WIN_MAP_BELOW_1MB       0x0400
  293 #define WIN_PREFETCH            0x0800
  294 #define WIN_CACHEABLE           0x1000
  295 #define WIN_BAR_MASK            0xe000
  296 #define WIN_BAR_SHIFT           13
  297 
  298 /* Attributes for RegisterClient */
  299 #define INFO_MASTER_CLIENT      0x01
  300 #define INFO_IO_CLIENT          0x02
  301 #define INFO_MTD_CLIENT         0x04
  302 #define INFO_MEM_CLIENT         0x08
  303 #define MAX_NUM_CLIENTS         3
  304 
  305 #define INFO_CARD_SHARE         0x10
  306 #define INFO_CARD_EXCL          0x20
  307 
  308 typedef struct cs_status_t {
  309     u_char      Function;
  310     event_t     CardState;
  311     event_t     SocketState;
  312 } cs_status_t;
  313 
  314 typedef struct error_info_t {
  315     int         func;
  316     int         retcode;
  317 } error_info_t;
  318 
  319 /* Special stuff for binding drivers to sockets */
  320 typedef struct bind_req_t {
  321     socket_t    Socket;
  322     u_char      Function;
  323     dev_info_t  *dev_info;
  324 } bind_req_t;
  325 
  326 /* Flag to bind to all functions */
  327 #define BIND_FN_ALL     0xff
  328 
  329 typedef struct mtd_bind_t {
  330     socket_t    Socket;
  331     u_int       Attributes;
  332     u_int       CardOffset;
  333     dev_info_t  *dev_info;
  334 } mtd_bind_t;
  335 
  336 /* Events */
  337 #define CS_EVENT_PRI_LOW                0
  338 #define CS_EVENT_PRI_HIGH               1
  339 
  340 #define CS_EVENT_WRITE_PROTECT          0x000001
  341 #define CS_EVENT_CARD_LOCK              0x000002
  342 #define CS_EVENT_CARD_INSERTION         0x000004
  343 #define CS_EVENT_CARD_REMOVAL           0x000008
  344 #define CS_EVENT_BATTERY_DEAD           0x000010
  345 #define CS_EVENT_BATTERY_LOW            0x000020
  346 #define CS_EVENT_READY_CHANGE           0x000040
  347 #define CS_EVENT_CARD_DETECT            0x000080
  348 #define CS_EVENT_RESET_REQUEST          0x000100
  349 #define CS_EVENT_RESET_PHYSICAL         0x000200
  350 #define CS_EVENT_CARD_RESET             0x000400
  351 #define CS_EVENT_REGISTRATION_COMPLETE  0x000800
  352 #define CS_EVENT_RESET_COMPLETE         0x001000
  353 #define CS_EVENT_PM_SUSPEND             0x002000
  354 #define CS_EVENT_PM_RESUME              0x004000
  355 #define CS_EVENT_INSERTION_REQUEST      0x008000
  356 #define CS_EVENT_EJECTION_REQUEST       0x010000
  357 #define CS_EVENT_MTD_REQUEST            0x020000
  358 #define CS_EVENT_ERASE_COMPLETE         0x040000
  359 #define CS_EVENT_REQUEST_ATTENTION      0x080000
  360 #define CS_EVENT_CB_DETECT              0x100000
  361 #define CS_EVENT_3VCARD                 0x200000
  362 #define CS_EVENT_XVCARD                 0x400000
  363 
  364 /* Return codes */
  365 #define CS_SUCCESS              0x00
  366 #define CS_BAD_ADAPTER          0x01
  367 #define CS_BAD_ATTRIBUTE        0x02
  368 #define CS_BAD_BASE             0x03
  369 #define CS_BAD_EDC              0x04
  370 #define CS_BAD_IRQ              0x06
  371 #define CS_BAD_OFFSET           0x07
  372 #define CS_BAD_PAGE             0x08
  373 #define CS_READ_FAILURE         0x09
  374 #define CS_BAD_SIZE             0x0a
  375 #define CS_BAD_SOCKET           0x0b
  376 #define CS_BAD_TYPE             0x0d
  377 #define CS_BAD_VCC              0x0e
  378 #define CS_BAD_VPP              0x0f
  379 #define CS_BAD_WINDOW           0x11
  380 #define CS_WRITE_FAILURE        0x12
  381 #define CS_NO_CARD              0x14
  382 #define CS_UNSUPPORTED_FUNCTION 0x15
  383 #define CS_UNSUPPORTED_MODE     0x16
  384 #define CS_BAD_SPEED            0x17
  385 #define CS_BUSY                 0x18
  386 #define CS_GENERAL_FAILURE      0x19
  387 #define CS_WRITE_PROTECTED      0x1a
  388 #define CS_BAD_ARG_LENGTH       0x1b
  389 #define CS_BAD_ARGS             0x1c
  390 #define CS_CONFIGURATION_LOCKED 0x1d
  391 #define CS_IN_USE               0x1e
  392 #define CS_NO_MORE_ITEMS        0x1f
  393 #define CS_OUT_OF_RESOURCE      0x20
  394 #define CS_BAD_HANDLE           0x21
  395 
  396 #define CS_BAD_TUPLE            0x40
  397 
  398 #ifdef __KERNEL__
  399 
  400 /*
  401  *  The main Card Services entry point
  402  */
  403 
  404 enum service {
  405     AccessConfigurationRegister, AddSocketServices,
  406     AdjustResourceInfo, CheckEraseQueue, CloseMemory, CopyMemory,
  407     DeregisterClient, DeregisterEraseQueue, GetCardServicesInfo,
  408     GetClientInfo, GetConfigurationInfo, GetEventMask,
  409     GetFirstClient, GetFirstPartion, GetFirstRegion, GetFirstTuple,
  410     GetNextClient, GetNextPartition, GetNextRegion, GetNextTuple,
  411     GetStatus, GetTupleData, MapLogSocket, MapLogWindow, MapMemPage,
  412     MapPhySocket, MapPhyWindow, ModifyConfiguration, ModifyWindow,
  413     OpenMemory, ParseTuple, ReadMemory, RegisterClient,
  414     RegisterEraseQueue, RegisterMTD, RegisterTimer,
  415     ReleaseConfiguration, ReleaseExclusive, ReleaseIO, ReleaseIRQ,
  416     ReleaseSocketMask, ReleaseWindow, ReplaceSocketServices,
  417     RequestConfiguration, RequestExclusive, RequestIO, RequestIRQ,
  418     RequestSocketMask, RequestWindow, ResetCard, ReturnSSEntry,
  419     SetEventMask, SetRegion, ValidateCIS, VendorSpecific,
  420     WriteMemory, BindDevice, BindMTD, ReportError,
  421     SuspendCard, ResumeCard, EjectCard, InsertCard, ReplaceCIS,
  422     GetFirstWindow, GetNextWindow, GetMemPage
  423 };
  424 
  425 #ifdef IN_CARD_SERVICES
  426 extern int CardServices(int func, void *a1, void *a2, void *a3);
  427 #else
  428 extern int CardServices(int func, ...);
  429 #endif
  430 
  431 int pcmcia_access_configuration_register(client_handle_t handle, conf_reg_t *reg);
  432 int pcmcia_bind_device(bind_req_t *req);
  433 int pcmcia_bind_mtd(mtd_bind_t *req);
  434 int pcmcia_deregister_client(client_handle_t handle);
  435 int pcmcia_get_configuration_info(client_handle_t handle, config_info_t *config);
  436 int pcmcia_get_card_services_info(servinfo_t *info);
  437 int pcmcia_get_first_client(client_handle_t *handle, client_req_t *req);
  438 int pcmcia_get_next_client(client_handle_t *handle, client_req_t *req);
  439 int pcmcia_get_window(window_handle_t *handle, int idx, win_req_t *req);
  440 int pcmcia_get_first_window(window_handle_t *win, win_req_t *req);
  441 int pcmcia_get_next_window(window_handle_t *win, win_req_t *req);
  442 int pcmcia_get_status(client_handle_t handle, cs_status_t *status);
  443 int pcmcia_get_mem_page(window_handle_t win, memreq_t *req);
  444 int pcmcia_map_mem_page(window_handle_t win, memreq_t *req);
  445 int pcmcia_modify_configuration(client_handle_t handle, modconf_t *mod);
  446 int pcmcia_modify_window(window_handle_t win, modwin_t *req);
  447 int pcmcia_register_client(client_handle_t *handle, client_reg_t *req);
  448 int pcmcia_release_configuration(client_handle_t handle);
  449 int pcmcia_release_io(client_handle_t handle, io_req_t *req);
  450 int pcmcia_release_irq(client_handle_t handle, irq_req_t *req);
  451 int pcmcia_release_window(window_handle_t win);
  452 int pcmcia_request_configuration(client_handle_t handle, config_req_t *req);
  453 int pcmcia_request_io(client_handle_t handle, io_req_t *req);
  454 int pcmcia_request_irq(client_handle_t handle, irq_req_t *req);
  455 int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle_t *wh);
  456 int pcmcia_reset_card(client_handle_t handle, client_req_t *req);
  457 int pcmcia_suspend_card(client_handle_t handle, client_req_t *req);
  458 int pcmcia_resume_card(client_handle_t handle, client_req_t *req);
  459 int pcmcia_eject_card(client_handle_t handle, client_req_t *req);
  460 int pcmcia_insert_card(client_handle_t handle, client_req_t *req);
  461 int pcmcia_set_event_mask(client_handle_t handle, eventmask_t *mask);
  462 int pcmcia_report_error(client_handle_t handle, error_info_t *err);
  463 struct pci_bus *pcmcia_lookup_bus(client_handle_t handle);
  464 
  465 /* rsrc_mgr.c */
  466 int pcmcia_adjust_resource_info(client_handle_t handle, adjust_t *adj);
  467 
  468 #endif /* __KERNEL__ */
  469 
  470 #endif /* _LINUX_CS_H */

Cache object: aa73ae544e2f07ff7abf18f5e252b66c


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.