diff options
Diffstat (limited to 'klaptopdaemon/linux')
-rw-r--r-- | klaptopdaemon/linux/bulkmem.h | 54 | ||||
-rw-r--r-- | klaptopdaemon/linux/ciscode.h | 71 | ||||
-rw-r--r-- | klaptopdaemon/linux/cisreg.h | 53 | ||||
-rw-r--r-- | klaptopdaemon/linux/cistpl.h | 128 | ||||
-rw-r--r-- | klaptopdaemon/linux/cs.h | 125 | ||||
-rw-r--r-- | klaptopdaemon/linux/cs_types.h | 30 | ||||
-rw-r--r-- | klaptopdaemon/linux/driver_ops.h | 19 | ||||
-rw-r--r-- | klaptopdaemon/linux/ds.h | 31 | ||||
-rw-r--r-- | klaptopdaemon/linux/ftl.h | 19 | ||||
-rw-r--r-- | klaptopdaemon/linux/k_compat.h | 450 | ||||
-rw-r--r-- | klaptopdaemon/linux/mem_op.h | 49 | ||||
-rw-r--r-- | klaptopdaemon/linux/memory.h | 19 | ||||
-rw-r--r-- | klaptopdaemon/linux/ss.h | 46 |
13 files changed, 681 insertions, 413 deletions
diff --git a/klaptopdaemon/linux/bulkmem.h b/klaptopdaemon/linux/bulkmem.h index cb59aa5..51f1d92 100644 --- a/klaptopdaemon/linux/bulkmem.h +++ b/klaptopdaemon/linux/bulkmem.h @@ -1,10 +1,10 @@ /* * Definitions for bulk memory services * - * bulkmem.h 1.8 1998/05/10 12:10:34 + * bulkmem.h 1.12 2000/06/12 21:55:41 * * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in + * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License * at http://www.mozilla.org/MPL/ * @@ -14,8 +14,22 @@ * limitations under the License. * * The initial developer of the original code is David A. Hinds - * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds - * are Copyright (C) 1998 David A. Hinds. All Rights Reserved. + * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Contributor: Apple Computer, Inc. Portions � 2000 Apple Computer, + * Inc. All rights reserved. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU Public License version 2 (the "GPL"), in which + * case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file + * under either the MPL or the GPL. * bulkmem.h 1.3 1995/05/27 04:49:49 */ @@ -71,7 +85,7 @@ typedef struct eraseq_hdr_t { eraseq_entry_t *QueueEntryArray; } eraseq_hdr_t; -#define ERASE_TQUEUED 0x00 +#define ERASE_QUEUED 0x00 #define ERASE_IN_PROGRESS(n) (((n) > 0) && ((n) < 0x80)) #define ERASE_IDLE 0xff #define ERASE_PASSED 0xe0 @@ -125,25 +139,25 @@ typedef struct mtd_request_t { u_int TransferLength; u_int Function; u_long MediaID; - u_int tqStatus; + u_int Status; u_int Timeout; } mtd_request_t; /* Fields in MTD Function */ -#define MTD_RETQ_ACTION 0x003 -#define MTD_RETQ_ERASE 0x000 -#define MTD_RETQ_READ 0x001 -#define MTD_RETQ_WRITE 0x002 -#define MTD_RETQ_COPY 0x003 -#define MTD_RETQ_NOERASE 0x004 -#define MTD_RETQ_VERIFY 0x008 -#define MTD_RETQ_READY 0x010 -#define MTD_RETQ_TIMEOUT 0x020 -#define MTD_RETQ_LAST 0x040 -#define MTD_RETQ_FIRST 0x080 -#define MTD_RETQ_KERNEL 0x100 - -/* tqStatus codes */ +#define MTD_REQ_ACTION 0x003 +#define MTD_REQ_ERASE 0x000 +#define MTD_REQ_READ 0x001 +#define MTD_REQ_WRITE 0x002 +#define MTD_REQ_COPY 0x003 +#define MTD_REQ_NOERASE 0x004 +#define MTD_REQ_VERIFY 0x008 +#define MTD_REQ_READY 0x010 +#define MTD_REQ_TIMEOUT 0x020 +#define MTD_REQ_LAST 0x040 +#define MTD_REQ_FIRST 0x080 +#define MTD_REQ_KERNEL 0x100 + +/* Status codes */ #define MTD_WAITREQ 0x00 #define MTD_WAITTIMER 0x01 #define MTD_WAITRDY 0x02 diff --git a/klaptopdaemon/linux/ciscode.h b/klaptopdaemon/linux/ciscode.h index 622b923..b417985 100644 --- a/klaptopdaemon/linux/ciscode.h +++ b/klaptopdaemon/linux/ciscode.h @@ -1,19 +1,15 @@ /* - * ciscode.h 1.31 1999/02/16 01:16:46 + * ciscode.h * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License - * at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and - * limitations under the License. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * * The initial developer of the original code is David A. Hinds - * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds - * are Copyright (C) 1998 David A. Hinds. All Rights Reserved. + * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * (C) 1999 David A. Hinds */ #ifndef _LINUX_CISCODE_H @@ -26,6 +22,9 @@ #define PRODID_3COM_3CCFEM556 0x0556 #define PRODID_3COM_3C562 0x0562 +#define MANFID_ACCTON 0x01bf +#define PRODID_ACCTON_EN2226 0x010a + #define MANFID_ADAPTEC 0x012f #define PRODID_ADAPTEC_SCSI 0x0001 @@ -46,6 +45,10 @@ #define PRODID_INTEL_DUAL_RS232 0x0301 #define PRODID_INTEL_2PLUS 0x8422 +#define MANFID_KME 0x0032 +#define PRODID_KME_KXLC005_A 0x0704 +#define PRODID_KME_KXLC005_B 0x2904 + #define MANFID_LINKSYS 0x0143 #define PRODID_LINKSYS_PCMLM28 0xc0ab #define PRODID_LINKSYS_3400 0x3341 @@ -59,38 +62,70 @@ #define MANFID_MOTOROLA 0x0109 #define PRODID_MOTOROLA_MARINER 0x0501 +#define MANFID_NATINST 0x010b +#define PRODID_NATINST_QUAD_RS232 0xd180 + #define MANFID_NEW_MEDIA 0x0057 +#define MANFID_NOKIA 0x0124 +#define PRODID_NOKIA_CARDPHONE 0x0900 + #define MANFID_OLICOM 0x0121 #define PRODID_OLICOM_OC2231 0x3122 #define PRODID_OLICOM_OC2232 0x3222 #define MANFID_OMEGA 0x0137 -#define PRODID_OMEGA_TQSP_100 0x0025 +#define PRODID_OMEGA_QSP_100 0x0025 #define MANFID_OSITECH 0x0140 #define PRODID_OSITECH_JACK_144 0x0001 #define PRODID_OSITECH_JACK_288 0x0002 #define PRODID_OSITECH_JACK_336 0x0007 +#define PRODID_OSITECH_SEVEN 0x0008 -#define MANFID_PSION 0x016c +#define MANFID_OXSEMI 0x0279 -#define MANFID_TQUATECH 0x0137 -#define PRODID_TQUATECH_DUAL_RS232 0x0012 -#define PRODID_TQUATECH_DUAL_RS232_D1 0x0007 -#define PRODID_TQUATECH_TQUAD_RS232 0x001b +#define MANFID_PIONEER 0x000b + +#define MANFID_PSION 0x016c +#define PRODID_PSION_NET100 0x0023 + +#define MANFID_QUATECH 0x0137 +#define PRODID_QUATECH_SPP100 0x0003 +#define PRODID_QUATECH_DUAL_RS232 0x0012 +#define PRODID_QUATECH_DUAL_RS232_D1 0x0007 +#define PRODID_QUATECH_DUAL_RS232_D2 0x0052 +#define PRODID_QUATECH_DUAL_RS232_G 0x004d +#define PRODID_QUATECH_QUAD_RS232 0x001b +#define PRODID_QUATECH_DUAL_RS422 0x000e +#define PRODID_QUATECH_QUAD_RS422 0x0045 #define MANFID_SMC 0x0108 #define PRODID_SMC_ETHER 0x0105 #define MANFID_SOCKET 0x0104 #define PRODID_SOCKET_DUAL_RS232 0x0006 +#define PRODID_SOCKET_EIO 0x000a #define PRODID_SOCKET_LPE 0x000d +#define PRODID_SOCKET_LPE_CF 0x0075 #define MANFID_SUNDISK 0x0045 #define MANFID_TDK 0x0105 +#define PRODID_TDK_CF010 0x0900 +#define PRODID_TDK_NP9610 0x0d0a +#define PRODID_TDK_MN3200 0x0e0a +#define PRODID_TDK_GN3410 0x4815 + +#define MANFID_TOSHIBA 0x0098 + +#define MANFID_UNGERMANN 0x02c0 #define MANFID_XIRCOM 0x0105 +#define MANFID_POSSIO 0x030c +#define PRODID_POSSIO_GCC 0x0003 + +#define MANFID_NEC 0x0010 + #endif /* _LINUX_CISCODE_H */ diff --git a/klaptopdaemon/linux/cisreg.h b/klaptopdaemon/linux/cisreg.h index 48f6f83..ddaad46 100644 --- a/klaptopdaemon/linux/cisreg.h +++ b/klaptopdaemon/linux/cisreg.h @@ -1,25 +1,23 @@ /* - * cisreg.h 1.11 1998/09/11 08:54:47 + * cisreg.h * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License - * at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and - * limitations under the License. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * * The initial developer of the original code is David A. Hinds - * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds - * are Copyright (C) 1998 David A. Hinds. All Rights Reserved. + * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * (C) 1999 David A. Hinds */ #ifndef _LINUX_CISREG_H #define _LINUX_CISREG_H -/* Offsets from ConfigBase for CIS registers */ +/* + * Offsets from ConfigBase for CIS registers + */ #define CISREG_COR 0x00 #define CISREG_CCSR 0x02 #define CISREG_PRR 0x04 @@ -38,12 +36,12 @@ #define COR_MFC_CONFIG_MASK 0x38 #define COR_FUNC_ENA 0x01 #define COR_ADDR_DECODE 0x02 -#define COR_IRETQ_ENA 0x04 +#define COR_IREQ_ENA 0x04 #define COR_LEVEL_REQ 0x40 #define COR_SOFT_RESET 0x80 /* - * Card Configuration and tqStatus Register + * Card Configuration and Status Register */ #define CCSR_INTR_ACK 0x01 #define CCSR_INTR_PENDING 0x02 @@ -72,13 +70,13 @@ #define SCR_COPY_NUM 0x70 /* - * Extended tqStatus Register + * Extended Status Register */ -#define ESR_RETQ_ATTN_ENA 0x01 -#define ESR_RETQ_ATTN 0x10 +#define ESR_REQ_ATTN_ENA 0x01 +#define ESR_REQ_ATTN 0x10 /* - * CardBus Function tqStatus Registers + * CardBus Function Status Registers */ #define CBFN_EVENT 0x00 #define CBFN_MASK 0x04 @@ -102,4 +100,21 @@ #define FEMR_PWM_ENA 0x0040 #define FEMR_WKUP_MASK 0x4000 +/* + * Indirect Addressing Registers for Zoomed Video: these are addresses + * in common memory space + */ +#define CISREG_ICTRL0 0x02 /* control registers */ +#define CISREG_ICTRL1 0x03 +#define CISREG_IADDR0 0x04 /* address registers */ +#define CISREG_IADDR1 0x05 +#define CISREG_IADDR2 0x06 +#define CISREG_IADDR3 0x07 +#define CISREG_IDATA0 0x08 /* data registers */ +#define CISREG_IDATA1 0x09 + +#define ICTRL0_COMMON 0x01 +#define ICTRL0_AUTOINC 0x02 +#define ICTRL0_BYTEGRAN 0x04 + #endif /* _LINUX_CISREG_H */ diff --git a/klaptopdaemon/linux/cistpl.h b/klaptopdaemon/linux/cistpl.h index ee27463..c6a0695 100644 --- a/klaptopdaemon/linux/cistpl.h +++ b/klaptopdaemon/linux/cistpl.h @@ -1,19 +1,15 @@ /* - * cistpl.h 1.27 1998/09/30 18:08:46 + * cistpl.h * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License - * at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and - * limitations under the License. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * * The initial developer of the original code is David A. Hinds - * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds - * are Copyright (C) 1998 David A. Hinds. All Rights Reserved. + * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * (C) 1999 David A. Hinds */ #ifndef _LINUX_CISTPL_H @@ -22,10 +18,13 @@ #define CISTPL_NULL 0x00 #define CISTPL_DEVICE 0x01 #define CISTPL_LONGLINK_CB 0x02 +#define CISTPL_INDIRECT 0x03 #define CISTPL_CONFIG_CB 0x04 #define CISTPL_CFTABLE_ENTRY_CB 0x05 #define CISTPL_LONGLINK_MFC 0x06 #define CISTPL_BAR 0x07 +#define CISTPL_PWR_MGMNT 0x08 +#define CISTPL_EXTDEVICE 0x09 #define CISTPL_CHECKSUM 0x10 #define CISTPL_LONGLINK_A 0x11 #define CISTPL_LONGLINK_C 0x12 @@ -54,8 +53,10 @@ #define CISTPL_BYTEORDER 0x43 #define CISTPL_DATE 0x44 #define CISTPL_BATTERY 0x45 +#define CISTPL_FORMAT_A 0x47 /* Layer 3 tuples */ #define CISTPL_ORG 0x46 +#define CISTPL_SPCL 0x90 typedef struct cistpl_longlink_t { u_int addr; @@ -161,7 +162,7 @@ typedef struct cistpl_funcid_t { typedef struct cistpl_funce_t { u_char type; - u_char data[1]; + u_char data[0]; } cistpl_funce_t; /*====================================================================== @@ -170,24 +171,25 @@ typedef struct cistpl_funce_t { ======================================================================*/ -#define CISTPL_FUNCE_SERIAL 0x00 -#define CISTPL_FUNCE_SERIAL_DATA 0x08 -#define CISTPL_FUNCE_SERIAL_FAX 0x09 -#define CISTPL_FUNCE_SERIAL_VOICE 0x0a -#define CISTPL_FUNCE_CAP 0x01 -#define CISTPL_FUNCE_CAP_DATA 0x05 -#define CISTPL_FUNCE_CAP_FAX 0x06 -#define CISTPL_FUNCE_CAP_VOICE 0x07 -#define CISTPL_FUNCE_SERV_DATA 0x02 -#define CISTPL_FUNCE_SERV_FAX_1 0x13 -#define CISTPL_FUNCE_SERV_FAX_2 0x23 -#define CISTPL_FUNCE_SERV_FAX_3 0x33 -#define CISTPL_FUNCE_SERV_VOICE 0x84 +#define CISTPL_FUNCE_SERIAL_IF 0x00 +#define CISTPL_FUNCE_SERIAL_CAP 0x01 +#define CISTPL_FUNCE_SERIAL_SERV_DATA 0x02 +#define CISTPL_FUNCE_SERIAL_SERV_FAX 0x03 +#define CISTPL_FUNCE_SERIAL_SERV_VOICE 0x04 +#define CISTPL_FUNCE_SERIAL_CAP_DATA 0x05 +#define CISTPL_FUNCE_SERIAL_CAP_FAX 0x06 +#define CISTPL_FUNCE_SERIAL_CAP_VOICE 0x07 +#define CISTPL_FUNCE_SERIAL_IF_DATA 0x08 +#define CISTPL_FUNCE_SERIAL_IF_FAX 0x09 +#define CISTPL_FUNCE_SERIAL_IF_VOICE 0x0a /* UART identification */ #define CISTPL_SERIAL_UART_8250 0x00 #define CISTPL_SERIAL_UART_16450 0x01 #define CISTPL_SERIAL_UART_16550 0x02 +#define CISTPL_SERIAL_UART_8251 0x03 +#define CISTPL_SERIAL_UART_8530 0x04 +#define CISTPL_SERIAL_UART_85230 0x05 /* UART capabilities */ #define CISTPL_SERIAL_UART_SPACE 0x01 @@ -211,10 +213,38 @@ typedef struct cistpl_serial_t { typedef struct cistpl_modem_cap_t { u_char flow; u_char cmd_buf; - u_int rcv_buf:24; - u_int xmit_buf:24; + u_char rcv_buf_0, rcv_buf_1, rcv_buf_2; + u_char xmit_buf_0, xmit_buf_1, xmit_buf_2; } cistpl_modem_cap_t; +#define CISTPL_SERIAL_MOD_103 0x01 +#define CISTPL_SERIAL_MOD_V21 0x02 +#define CISTPL_SERIAL_MOD_V23 0x04 +#define CISTPL_SERIAL_MOD_V22 0x08 +#define CISTPL_SERIAL_MOD_212A 0x10 +#define CISTPL_SERIAL_MOD_V22BIS 0x20 +#define CISTPL_SERIAL_MOD_V26 0x40 +#define CISTPL_SERIAL_MOD_V26BIS 0x80 +#define CISTPL_SERIAL_MOD_V27BIS 0x01 +#define CISTPL_SERIAL_MOD_V29 0x02 +#define CISTPL_SERIAL_MOD_V32 0x04 +#define CISTPL_SERIAL_MOD_V32BIS 0x08 +#define CISTPL_SERIAL_MOD_V34 0x10 + +#define CISTPL_SERIAL_ERR_MNP2_4 0x01 +#define CISTPL_SERIAL_ERR_V42_LAPM 0x02 + +#define CISTPL_SERIAL_CMPR_V42BIS 0x01 +#define CISTPL_SERIAL_CMPR_MNP5 0x02 + +#define CISTPL_SERIAL_CMD_AT1 0x01 +#define CISTPL_SERIAL_CMD_AT2 0x02 +#define CISTPL_SERIAL_CMD_AT3 0x04 +#define CISTPL_SERIAL_CMD_MNP_AT 0x08 +#define CISTPL_SERIAL_CMD_V25BIS 0x10 +#define CISTPL_SERIAL_CMD_V25A 0x20 +#define CISTPL_SERIAL_CMD_DMCL 0x40 + typedef struct cistpl_data_serv_t { u_char max_data_0; u_char max_data_1; @@ -226,7 +256,7 @@ typedef struct cistpl_data_serv_t { u_char escape; u_char encrypt; u_char misc_features; - u_char ccitt_code[1]; + u_char ccitt_code[0]; } cistpl_data_serv_t; typedef struct cistpl_fax_serv_t { @@ -236,7 +266,7 @@ typedef struct cistpl_fax_serv_t { u_char encrypt; u_char features_0; u_char features_1; - u_char ccitt_code[1]; + u_char ccitt_code[0]; } cistpl_fax_serv_t; typedef struct cistpl_voice_serv_t { @@ -312,7 +342,7 @@ typedef struct cistpl_ide_interface_t { /* First feature byte */ #define CISTPL_IDE_SILICON 0x04 -#define CISTPL_IDE_UNITQUE 0x08 +#define CISTPL_IDE_UNIQUE 0x08 #define CISTPL_IDE_DUAL 0x10 /* Second feature byte */ @@ -398,8 +428,8 @@ typedef struct cistpl_io_t { } cistpl_io_t; typedef struct cistpl_irq_t { - u_int IRTQInfo1; - u_int IRTQInfo2; + u_int IRQInfo1; + u_int IRQInfo2; } cistpl_irq_t; #define CISTPL_MEM_MAX_WIN 8 @@ -486,6 +516,21 @@ typedef struct cistpl_org_t { #define CISTPL_ORG_APPSPEC 0x01 #define CISTPL_ORG_XIP 0x02 +typedef struct cistpl_format_t { + u_char type; + u_char edc; + u_int offset; + u_int length; +} cistpl_format_t; + +#define CISTPL_FORMAT_DISK 0x00 +#define CISTPL_FORMAT_MEM 0x01 + +#define CISTPL_EDC_NONE 0x00 +#define CISTPL_EDC_CKSUM 0x01 +#define CISTPL_EDC_CRC 0x02 +#define CISTPL_EDC_PCC 0x03 + typedef union cisparse_t { cistpl_device_t device; cistpl_checksum_t checksum; @@ -504,6 +549,7 @@ typedef union cisparse_t { cistpl_device_geo_t device_geo; cistpl_vers_2_t vers_2; cistpl_org_t org; + cistpl_format_t format; } cisparse_t; typedef struct tuple_t { @@ -540,4 +586,20 @@ typedef struct cisdump_t { cisdata_t Data[CISTPL_MAX_CIS_SIZE]; } cisdump_t; +int pcmcia_get_first_tuple(client_handle_t handle, tuple_t *tuple); +int pcmcia_get_next_tuple(client_handle_t handle, tuple_t *tuple); +int pcmcia_get_tuple_data(client_handle_t handle, tuple_t *tuple); +int pcmcia_parse_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse); + +int pcmcia_validate_cis(client_handle_t handle, cisinfo_t *info); +int pcmcia_replace_cis(struct pcmcia_socket *s, cisdump_t *cis); + +/* don't use outside of PCMCIA core yet */ +int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int func, tuple_t *tuple); +int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, tuple_t *tuple); +int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple); +int pccard_parse_tuple(tuple_t *tuple, cisparse_t *parse); + +int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, cisinfo_t *info); + #endif /* LINUX_CISTPL_H */ diff --git a/klaptopdaemon/linux/cs.h b/klaptopdaemon/linux/cs.h index 93d159a..1eed7de 100644 --- a/klaptopdaemon/linux/cs.h +++ b/klaptopdaemon/linux/cs.h @@ -1,8 +1,8 @@ /* - * cs.h 1.63 1998/12/09 07:36:24 + * cs.h 1.71 2000/08/29 00:54:20 * * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in + * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License * at http://www.mozilla.org/MPL/ * @@ -12,8 +12,22 @@ * limitations under the License. * * The initial developer of the original code is David A. Hinds - * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds - * are Copyright (C) 1998 David A. Hinds. All Rights Reserved. + * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Contributor: Apple Computer, Inc. Portions � 2000 Apple Computer, + * Inc. All rights reserved. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU Public License version 2 (the "GPL"), in which + * case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file + * under either the MPL or the GPL. */ #ifndef _LINUX_CS_H @@ -52,6 +66,10 @@ typedef struct adjust_t { } resource; } adjust_t; +#ifdef __MACOSX__ +#define CS_ADJUST_FAKE_HANDLE ((void *)0x12345678) +#endif + /* Action field */ #define REMOVE_MANAGED_RESOURCE 1 #define ADD_MANAGED_RESOURCE 2 @@ -62,11 +80,11 @@ typedef struct adjust_t { #define RES_IO_RANGE 2 #define RES_IRQ 3 /* Attribute field */ -#define RES_IRTQ_TYPE 0x03 -#define RES_IRTQ_TYPE_EXCLUSIVE 0 -#define RES_IRTQ_TYPE_TIME 1 -#define RES_IRTQ_TYPE_DYNAMIC 2 -#define RES_IRTQ_CSC 0x04 +#define RES_IRQ_TYPE 0x03 +#define RES_IRQ_TYPE_EXCLUSIVE 0 +#define RES_IRQ_TYPE_TIME 1 +#define RES_IRQ_TYPE_DYNAMIC 2 +#define RES_IRQ_CSC 0x04 #define RES_SHARED 0x08 #define RES_RESERVED 0x10 #define RES_ALLOCATED 0x20 @@ -87,6 +105,7 @@ typedef struct event_callback_args_t { void *buffer; void *misc; void *client_data; + struct bus_operations *bus; } event_callback_args_t; /* for GetConfigurationInfo */ @@ -96,11 +115,11 @@ typedef struct config_info_t { u_int Vcc, Vpp1, Vpp2; u_int IntType; u_int ConfigBase; - u_char tqStatus, Pin, Copy, Option, ExttqStatus; + u_char Status, Pin, Copy, Option, ExtStatus; u_int Present; u_int CardValues; u_int AssignedIRQ; - u_int IRTQAttributes; + u_int IRQAttributes; ioaddr_t BasePort1; ioaddr_t NumPorts1; u_int Attributes1; @@ -108,6 +127,10 @@ typedef struct config_info_t { ioaddr_t NumPorts2; u_int Attributes2; u_int IOAddrLines; +#ifdef __MACOSX__ + void * PCCardNub; + void * CardBusNub; // per function +#endif } config_info_t; /* For CardValues field */ @@ -130,8 +153,13 @@ typedef struct client_reg_t { dev_info_t *dev_info; u_int Attributes; u_int EventMask; +#ifdef __MACOSX__ + int (*event_handler)(cs_event_t event, int priority, + event_callback_args_t *); +#else int (*event_handler)(event_t event, int priority, event_callback_args_t *); +#endif event_callback_args_t event_callback_args; u_int Version; } client_reg_t; @@ -143,7 +171,7 @@ typedef struct modconf_t { } modconf_t; /* Attributes for ModifyConfiguration */ -#define CONF_IRTQ_CHANGE_VALID 0x100 +#define CONF_IRQ_CHANGE_VALID 0x100 #define CONF_VCC_CHANGE_VALID 0x200 #define CONF_VPP1_CHANGE_VALID 0x400 #define CONF_VPP2_CHANGE_VALID 0x800 @@ -154,7 +182,7 @@ typedef struct config_req_t { u_int Vcc, Vpp1, Vpp2; u_int IntType; u_int ConfigBase; - u_char tqStatus, Pin, Copy, ExttqStatus; + u_char Status, Pin, Copy, ExtStatus; u_char ConfigIndex; u_int Present; } config_req_t; @@ -194,31 +222,31 @@ typedef struct io_req_t { typedef struct irq_req_t { u_int Attributes; u_int AssignedIRQ; - u_int IRTQInfo1, IRTQInfo2; + u_int IRQInfo1, IRQInfo2; void *Handler; void *Instance; } irq_req_t; /* Attributes for RequestIRQ and ReleaseIRQ */ -#define IRTQ_TYPE 0x03 -#define IRTQ_TYPE_EXCLUSIVE 0x00 -#define IRTQ_TYPE_TIME 0x01 -#define IRTQ_TYPE_DYNAMIC_SHARING 0x02 -#define IRTQ_FORCED_PULSE 0x04 -#define IRTQ_FIRST_SHARED 0x08 -#define IRTQ_HANDLE_PRESENT 0x10 -#define IRTQ_PULSE_ALLOCATED 0x100 - -/* Bits in IRTQInfo1 field */ -#define IRTQ_MASK 0x0f -#define IRTQ_NMI_ID 0x01 -#define IRTQ_IOCK_ID 0x02 -#define IRTQ_BERR_ID 0x04 -#define IRTQ_VEND_ID 0x08 -#define IRTQ_INFO2_VALID 0x10 -#define IRTQ_LEVEL_ID 0x20 -#define IRTQ_PULSE_ID 0x40 -#define IRTQ_SHARE_ID 0x80 +#define IRQ_TYPE 0x03 +#define IRQ_TYPE_EXCLUSIVE 0x00 +#define IRQ_TYPE_TIME 0x01 +#define IRQ_TYPE_DYNAMIC_SHARING 0x02 +#define IRQ_FORCED_PULSE 0x04 +#define IRQ_FIRST_SHARED 0x08 +#define IRQ_HANDLE_PRESENT 0x10 +#define IRQ_PULSE_ALLOCATED 0x100 + +/* Bits in IRQInfo1 field */ +#define IRQ_MASK 0x0f +#define IRQ_NMI_ID 0x01 +#define IRQ_IOCK_ID 0x02 +#define IRQ_BERR_ID 0x04 +#define IRQ_VEND_ID 0x08 +#define IRQ_INFO2_VALID 0x10 +#define IRQ_LEVEL_ID 0x20 +#define IRQ_PULSE_ID 0x40 +#define IRQ_SHARE_ID 0x80 typedef struct eventmask_t { u_int Attributes; @@ -239,12 +267,7 @@ typedef struct eventmask_t { #define PRESENT_IOBASE_3 0x100 #define PRESENT_IOSIZE 0x200 -/* Attributes for Request/GetConfiguration */ -#define CONF_ENABLE_IRQ 0x01 -#define EXCLUSIVE_USE 0x02 -#define VALID_CLIENT 0x04 - -/* For MapMemPage */ +/* For GetMemPage, MapMemPage */ typedef struct memreq_t { u_int CardOffset; page_t Page; @@ -280,6 +303,7 @@ typedef struct win_req_t { #define WIN_SHARED 0x0040 #define WIN_FIRST_SHARED 0x0080 #define WIN_USE_WAIT 0x0100 +#define WIN_STRICT_ALIGN 0x0200 #define WIN_MAP_BELOW_1MB 0x0400 #define WIN_PREFETCH 0x0800 #define WIN_CACHEABLE 0x1000 @@ -298,8 +322,13 @@ typedef struct win_req_t { typedef struct cs_status_t { u_char Function; +#ifdef __MACOSX__ + cs_event_t CardState; + cs_event_t SocketState; +#else event_t CardState; event_t SocketState; +#endif } cs_status_t; typedef struct error_info_t { @@ -386,14 +415,21 @@ typedef struct mtd_bind_t { #define CS_BAD_TUPLE 0x40 -#ifdef __KERNEL__ + +//MACOSX #ifdef __KERNEL__ +#ifdef KERNEL + /* * Calls to set up low-level "Socket Services" drivers */ typedef int (*ss_entry_t)(u_int sock, u_int cmd, void *arg); +#ifdef __MACOSX__ +extern int register_ss_entry(int ssock, int esock, ss_entry_t entry); +#else extern int register_ss_entry(int nsock, ss_entry_t entry); +#endif extern void unregister_ss_entry(ss_entry_t entry); /* @@ -407,7 +443,7 @@ enum service { GetClientInfo, GetConfigurationInfo, GetEventMask, GetFirstClient, GetFirstPartion, GetFirstRegion, GetFirstTuple, GetNextClient, GetNextPartition, GetNextRegion, GetNextTuple, - GettqStatus, GetTupleData, MapLogSocket, MapLogWindow, MapMemPage, + GetStatus, GetTupleData, MapLogSocket, MapLogWindow, MapMemPage, MapPhySocket, MapPhyWindow, ModifyConfiguration, ModifyWindow, OpenMemory, ParseTuple, ReadMemory, RegisterClient, RegisterEraseQueue, RegisterMTD, RegisterTimer, @@ -417,14 +453,19 @@ enum service { RequestSocketMask, RequestWindow, ResetCard, ReturnSSEntry, SetEventMask, SetRegion, ValidateCIS, VendorSpecific, WriteMemory, BindDevice, BindMTD, ReportError, - SuspendCard, ResumeCard, EjectCard, InsertCard, ReplaceCIS + SuspendCard, ResumeCard, EjectCard, InsertCard, ReplaceCIS, + GetFirstWindow, GetNextWindow, GetMemPage }; #ifdef IN_CARD_SERVICES extern int CardServices(int func, void *a1, void *a2, void *a3); #else +#ifndef __MACOSX__ +// for macosx we disable direct access to CardServices() call, +// drivers should instead go thru the device nub (ie, the workloop) extern int CardServices(int func, ...); #endif +#endif #ifdef __BEOS__ #define SS_MODULE_NAME(s) ("busses/pcmcia/" s "/v1") diff --git a/klaptopdaemon/linux/cs_types.h b/klaptopdaemon/linux/cs_types.h index 8f9df45..b18f7f8 100644 --- a/klaptopdaemon/linux/cs_types.h +++ b/klaptopdaemon/linux/cs_types.h @@ -1,8 +1,8 @@ /* - * cs_types.h 1.13 1998/07/14 00:52:20 + * cs_types.h 1.18 2000/06/12 21:55:40 * * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in + * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License * at http://www.mozilla.org/MPL/ * @@ -12,20 +12,42 @@ * limitations under the License. * * The initial developer of the original code is David A. Hinds - * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds - * are Copyright (C) 1998 David A. Hinds. All Rights Reserved. + * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Contributor: Apple Computer, Inc. Portions � 2000 Apple Computer, + * Inc. All rights reserved. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU Public License version 2 (the "GPL"), in which + * case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file + * under either the MPL or the GPL. */ #ifndef _LINUX_CS_TYPES_H #define _LINUX_CS_TYPES_H #ifdef __linux__ +#ifdef __KERNEL__ #include <linux/types.h> +#else +#include <sys/types.h> +#endif #endif typedef u_short socket_t; typedef u_short ioaddr_t; +#ifdef __MACOSX__ +typedef u_int cs_event_t; +#else typedef u_int event_t; +#endif typedef u_char cisdata_t; typedef u_short page_t; diff --git a/klaptopdaemon/linux/driver_ops.h b/klaptopdaemon/linux/driver_ops.h index a6a71ee..51cd064 100644 --- a/klaptopdaemon/linux/driver_ops.h +++ b/klaptopdaemon/linux/driver_ops.h @@ -1,8 +1,8 @@ /* - * driver_ops.h 1.11 1998/11/18 07:01:50 + * driver_ops.h 1.14 1999/10/25 20:23:17 * * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in + * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License * at http://www.mozilla.org/MPL/ * @@ -12,8 +12,19 @@ * limitations under the License. * * The initial developer of the original code is David A. Hinds - * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds - * are Copyright (C) 1998 David A. Hinds. All Rights Reserved. + * <dhinds@pcmcia.sourceforge.org>. Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU Public License version 2 (the "GPL"), in which + * case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file + * under either the MPL or the GPL. */ #ifndef _LINUX_DRIVER_OPS_H diff --git a/klaptopdaemon/linux/ds.h b/klaptopdaemon/linux/ds.h index 11e0740..515a0ed 100644 --- a/klaptopdaemon/linux/ds.h +++ b/klaptopdaemon/linux/ds.h @@ -1,8 +1,8 @@ /* - * ds.h 1.49 1998/08/03 19:12:23 + * ds.h 1.55 1999/10/25 20:23:17 * * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in + * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License * at http://www.mozilla.org/MPL/ * @@ -12,8 +12,19 @@ * limitations under the License. * * The initial developer of the original code is David A. Hinds - * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds - * are Copyright (C) 1998 David A. Hinds. All Rights Reserved. + * <dhinds@pcmcia.sourceforge.org>. Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU Public License version 2 (the "GPL"), in which + * case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file + * under either the MPL or the GPL. */ #ifndef _LINUX_DS_H @@ -28,6 +39,12 @@ typedef struct tuple_parse_t { cisparse_t parse; } tuple_parse_t; +typedef struct win_info_t { + window_handle_t handle; + win_req_t window; + memreq_t map; +} win_info_t; + typedef struct bind_info_t { dev_info_t dev_info; u_char function; @@ -56,6 +73,7 @@ typedef union ds_ioctl_arg_t { region_info_t region; bind_info_t bind_info; mtd_info_t mtd_info; + win_info_t win_info; cisdump_t cisdump; } ds_ioctl_arg_t; @@ -77,6 +95,9 @@ typedef union ds_ioctl_arg_t { #define DS_GET_FIRST_REGION _IOWR('d', 16, region_info_t) #define DS_GET_NEXT_REGION _IOWR('d', 17, region_info_t) #define DS_REPLACE_CIS _IOWR('d', 18, cisdump_t) +#define DS_GET_FIRST_WINDOW _IOR ('d', 19, win_info_t) +#define DS_GET_NEXT_WINDOW _IOWR('d', 20, win_info_t) +#define DS_GET_MEM_PAGE _IOWR('d', 21, win_info_t) #define DS_BIND_REQUEST _IOWR('d', 60, bind_info_t) #define DS_GET_DEVICE_INFO _IOWR('d', 61, bind_info_t) @@ -89,7 +110,7 @@ typedef union ds_ioctl_arg_t { typedef struct dev_link_t { dev_node_t *dev; u_int state, open; - struct wait_queue *pending; + wait_queue_head_t pending; struct timer_list release; client_handle_t handle; io_req_t io; diff --git a/klaptopdaemon/linux/ftl.h b/klaptopdaemon/linux/ftl.h index 9357d17..62a8071 100644 --- a/klaptopdaemon/linux/ftl.h +++ b/klaptopdaemon/linux/ftl.h @@ -1,8 +1,8 @@ /* - * ftl.h 1.4 1998/05/10 12:10:34 + * ftl.h 1.8 2000/06/12 21:55:40 * * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in + * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License * at http://www.mozilla.org/MPL/ * @@ -12,8 +12,19 @@ * limitations under the License. * * The initial developer of the original code is David A. Hinds - * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds - * are Copyright (C) 1998 David A. Hinds. All Rights Reserved. + * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU General Public License version 2 (the "GPL"), in which + * case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file + * under either the MPL or the GPL. */ #ifndef _LINUX_FTL_H diff --git a/klaptopdaemon/linux/k_compat.h b/klaptopdaemon/linux/k_compat.h index e6d581b..5a68e55 100644 --- a/klaptopdaemon/linux/k_compat.h +++ b/klaptopdaemon/linux/k_compat.h @@ -1,246 +1,222 @@ -/* - * k_compat.h 1.74 1999/01/07 03:46:29 - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License - * at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and - * limitations under the License. - * - * The initial developer of the original code is David A. Hinds - * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds - * are Copyright (C) 1998 David A. Hinds. All Rights Reserved. - */ +/*====================================================================== + + The contents of this file are subject to the Mozilla Public + License Version 1.1 (the "License"); you may not use this file + except in compliance with the License. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS + IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + implied. See the License for the specific language governing + rights and limitations under the License. + + The initial developer of the original code is David A. Hinds + <dahinds@users.sourceforge.net>. Portions created by David A. Hinds + are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + + Contributor: Apple Computer, Inc. Portions � 2000 Apple Computer, + Inc. All rights reserved. + + Alternatively, the contents of this file may be used under the + terms of the GNU Public License version 2 (the "GPL"), in which + case the provisions of the GPL are applicable instead of the + above. If you wish to allow the use of your version of this file + only under the terms of the GPL and not to allow others to use + your version of this file under the MPL, indicate your decision + by deleting the provisions above and replace them with the notice + and other provisions required by the GPL. If you do not delete + the provisions above, a recipient may use your version of this + file under either the MPL or the GPL. + +======================================================================*/ #ifndef _LINUX_K_COMPAT_H #define _LINUX_K_COMPAT_H -#define __LINUX__ -#define VERSION(v,p,s) (((v)<<16)+(p<<8)+s) - -#define RUN_AT(x) (jiffies+(x)) -#define CONST const -#define ALLOC_SKB(len) dev_alloc_skb(len+2) -#define DEVICE(req) ((req)->rq_dev) -#define GET_PACKET(dev, skb, count) \ - skb_reserve((skb), 2); \ - BLOCK_INPUT(skb_put((skb), (count)), (count)); \ - (skb)->protocol = eth_type_trans((skb), (dev)) - -#define BLK_DEV_HDR "linux/blk.h" -#define NEW_MULTICAST - -#define FREE_IRQ(i,d) free_irq(i, d) -#define REQUEST_IRQ(i,h,f,n,d) request_irq(i,h,f,n,d) -#define IRQ(a,b,c) (a,b,c) -#define DEV_ID dev_id - -#if (LINUX_VERSION_CODE < VERSION(2,0,16)) -#define init_waitqueue(p) (*(p) = NULL) -#endif - -#if (LINUX_VERSION_CODE < VERSION(2,1,4)) && !defined(__alpha__) -#define FS_SIZE_T int -#define U_FS_SIZE_T int -#else -#if (LINUX_VERSION_CODE < VERSION(2,1,60)) -#define FS_SIZE_T long -#define U_FS_SIZE_T unsigned long -#else -#define FS_SIZE_T ssize_t -#define U_FS_SIZE_T size_t -#endif -#endif - -#if (LINUX_VERSION_CODE < VERSION(2,1,25)) -#define net_device_stats enet_statistics -#endif - -#if (LINUX_VERSION_CODE < VERSION(2,1,31)) -#define FS_RELEASE_T void -#else -#define FS_RELEASE_T int -#endif - -#if (LINUX_VERSION_CODE < VERSION(2,1,38)) -#define test_and_set_bit set_bit -#endif - -#if (LINUX_VERSION_CODE > VERSION(2,1,16)) -#define AUTOCONF_INCLUDED -#define EXPORT_SYMTAB -#endif -#ifdef CONFIG_MODVERSIONS -#define MODVERSIONS 1 -#include <linux/modversions.h> -#endif -#include <linux/module.h> - -#if (LINUX_VERSION_CODE < VERSION(2,1,18)) -#define MODULE_PARM(a,b) extern int __bogus_decl -#undef GET_USE_COUNT -#define GET_USE_COUNT(m) mod_use_count_ -#endif - -#if (LINUX_VERSION_CODE < VERSION(2,1,0)) -#define copy_from_user memcpy_fromfs -#define copy_to_user memcpy_tofs - -#if (!defined(__alpha__) || (LINUX_VERSION_CODE < VERSION(2,0,34))) -#define ioremap(a,b) \ - (((a) < 0x100000) ? (void *)((u_long)(a)) : vremap(a,b)) -#define iounmap(v) \ - do { if ((u_long)(v) > 0x100000) vfree(v); } while (0) -#endif -/* This is evil... throw away the built-in get_user in 2.0 */ -#include <asm/segment.h> -#undef get_user - -#ifdef __alpha__ -#define get_user(x, ptr) ((x) = __get_user((ptr), sizeof(*(ptr)))) -#undef get_fs_long -#undef put_fs_long -#define get_fs_long(ptr) __get_user((ptr), sizeof(int)) -#define put_fs_long(x, ptr) __put_user((x), (ptr), sizeof(int)) -#else -#define get_user(x, ptr) \ - ((sizeof(*ptr) == 4) ? (x = get_fs_long(ptr)) : \ - (sizeof(*ptr) == 2) ? (x = get_fs_word(ptr)) : \ - (x = get_fs_byte(ptr))) -#endif - -#else /* 2.1.X */ -#include <asm/uaccess.h> -#endif - -#if (LINUX_VERSION_CODE < VERSION(2,1,45)) -#define F_INODE(file) ((file)->f_inode) -#else -#define F_INODE(file) ((file)->f_dentry->d_inode) -#endif - -#if (LINUX_VERSION_CODE < VERSION(2,1,51)) -#define INVALIDATE_INODES(r) invalidate_inodes(r) -#else -#define INVALIDATE_INODES(r) \ - do { struct super_block *sb = get_super(r); \ - if (sb) invalidate_inodes(sb); } while (0) -#endif - -#if (LINUX_VERSION_CODE < VERSION(2,1,60)) -#define IRTQ_MAP(irq, dev) irq2dev_map[irq] = dev -#define FOPS(i,f,b,c,p) (i,f,b,c) -#define FPOS (file->f_pos) -#else -#define IRTQ_MAP(irq, dev) while (0) -#define FOPS(i,f,b,c,p) (f,b,c,p) -#define FPOS (*ppos) -#endif - -#if (LINUX_VERSION_CODE < VERSION(2,1,68)) -#define signal_pending(cur) ((cur)->signal & ~(cur)->blocked) -#endif - -#if (LINUX_VERSION_CODE < VERSION(2,1,86)) -#define DEV_KFREE_SKB(skb) dev_kfree_skb(skb, FREE_WRITE) -#else -#define DEV_KFREE_SKB(skb) dev_kfree_skb(skb) -#endif - -#if (LINUX_VERSION_CODE < VERSION(2,1,89)) -#define POLL_WAIT(f, q, w) poll_wait(q, w) -#else -#define POLL_WAIT(f, q, w) poll_wait(f, q, w) -#endif - -#include <asm/byteorder.h> -#ifndef le16_to_cpu -#define le16_to_cpu(x) (x) -#define le32_to_cpu(x) (x) -#define cpu_to_le16(x) (x) -#define cpu_to_le32(x) (x) -#endif - -#if (LINUX_VERSION_CODE < VERSION(2,1,90)) -#define spin_lock(l) do { } while (0) -#define spin_unlock(l) do { } while (0) -#define spin_lock_irqsave(l,f) do { save_flags(f); cli(); } while (0) -#define spin_unlock_irqrestore(l,f) do { restore_flags(f); } while (0) -#else -#include <asm/spinlock.h> -#endif - -#if (LINUX_VERSION_CODE < VERSION(2,1,104)) -#define mdelay(x) { int i; for (i=0;i<x;i++) udelay(1000); } -#endif +#include <IOKit/assert.h> +#include <IOKit/IOLib.h> +#include <libkern/OSByteOrder.h> +#include <sys/errno.h> + +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned int u32; + +#define printk IOLog +#define KERN_INFO "IOPCCard info: " +#define KERN_NOTICE "IOPCCard notice: " +#define KERN_DEBUG "IOPCCard debug: " + +#define MODULE_PARM(a,b) +#define MODULE_AUTHOR(a) +#define MODULE_DESCRIPTION(a) + +#define MOD_DEC_USE_COUNT +#define MOD_INC_USE_COUNT + +#define __init +#define __exit + +// we don't need these if we are always inside the workloop +#define ACQUIRE_RESOURCE_LOCK +#define RELEASE_RESOURCE_LOCK + +#define NR_IRQS 256 +#define PCI_INTERRUPT_LINE 0x3c + +#define PCI_CACHE_LINE_SIZE 0xc +#define PCI_LATENCY_TIMER 0xd +#define PCI_BASE_ADDRESS_0 0x10 +#define PCI_COMMAND 0x4 +#define PCI_COMMAND_IO 0x1 +#define PCI_COMMAND_MEMORY 0x2 +#define PCI_COMMAND_MASTER 0x4 +#define PCI_COMMAND_WAIT 0x80 + +#define PCI_HEADER_TYPE 0xe +#define PCI_CLASS_REVISION 0x8 +#define PCI_VENDOR_ID 0x0 +#define PCI_DEVICE_ID 0x2 +#define PCI_STATUS 0x6 + +#define PCI_CLASS_BRIDGE_CARDBUS 0x0607 +#define PCI_CLASS_BRIDGE_PCMCIA 0x0605 + +#define PCI_BASE_ADDRESS_SPACE_IO 0x1 +#define PCI_BASE_ADDRESS_SPACE_MEMORY 0x0 +#define PCI_BASE_ADDRESS_MEM_PREFETCH 0x8 +#define PCI_BASE_ADDRESS_MEM_MASK (~0x0fUL) +#define PCI_BASE_ADDRESS_SPACE 0x1 +#define PCI_BASE_ADDRESS_IO_MASK (~0x03UL) +#define PCI_INTERRUPT_PIN 0x3d + +struct pt_regs {}; + +#define HZ 100 + +extern void delay_for_interval(natural_t interval, natural_t scale_factor); + +#define mdelay(i) delay_for_interval((i), kMillisecondScale) +#define udelay(i) delay_for_interval((i), kMicrosecondScale) + +struct timer_list { + unsigned long expires; + void (*function)(unsigned long); + unsigned long data; +}; + +extern void IOPCCardAddTimer(struct timer_list * timer); +extern int IOPCCardDeleteTimer(struct timer_list * timer); + +#define jiffies (0) // just cheat on the whole jiffies thing :-) + +#define add_timer(t) IOPCCardAddTimer(t) +#define del_timer(t) IOPCCardDeleteTimer(t) +#define mod_timer(a, b) do { del_timer(a); (a)->expires = (b); add_timer(a); } while (0) + +extern void *kern_os_malloc(size_t size); +extern void *kern_os_realloc(void * addr, size_t size); +extern void kern_os_free(void * addr); + +#define kmalloc(s, x) kern_os_malloc(s) +#define krealloc(a, s, x) kern_os_realloc(a, s) +#define kfree(a) kern_os_free(a) + +#define le16_to_cpu(x) OSSwapLittleToHostInt16(x) +#define le32_to_cpu(x) OSSwapLittleToHostInt32(x) + +//MACOSXXX - all this needs to be cleaned up +typedef struct wait_queue *wait_queue_head_t; +#define init_waitqueue_head(p) DEBUG(0, "init_waitqueue_head stubbed out!\n"); #define wacquire(w) do { } while (0) #define wrelease(w) do { } while (0) -#define wsleep(w) interruptible_sleep_on(w) -#define wakeup(w) wake_up_interruptible(w) -#define wsleeptimeout(w,t) interruptible_sleep_on_timeout(w,t) -#if (LINUX_VERSION_CODE < VERSION(2,1,127)) -#define interruptible_sleep_on_timeout(w,t) \ - ({(current->timeout=jiffies+(t));wsleep(w);current->timeout;}) -#define schedule_timeout(t) \ - do { current->timeout = jiffies+(t); schedule(); } while (0) -#endif - -#include <asm/io.h> -#ifndef readw_ns -#ifdef __powerpc__ -#define readw_ns(p) ld_be16((volatile unsigned short *)(p)) -#define readl_ns(p) ld_be32((volatile unsigned *)(p)) -#define writew_ns(v,p) st_le16((volatile unsigned short *)(p),(v)) -#define writel_ns(v,p) st_le32((volatile unsigned *)(p),(v)) -#define inw_ns(p) in_be16((unsigned short *)((p)+_IO_BASE)) -#define inl_ns(p) in_be32((unsigned *)((p)+_IO_BASE)) -#define outw_ns(v,p) out_be16((unsigned short *)((p)+_IO_BASE),(v)) -#define outl_ns(v,p) out_be32((unsigned *)((p)+_IO_BASE),(v)) -#else -#define readw_ns(p) readw(p) -#define readl_ns(p) readl(p) -#define writew_ns(v,p) writew(v,p) -#define writel_ns(v,p) writel(v,p) -#define inw_ns(p) inw(p) -#define inl_ns(p) inl(p) -#define outw_ns(v,p) outw(v,p) -#define outl_ns(v,p) outl(v,p) -#endif -#endif -#ifndef insw_ns -#define insw_ns(p,b,l) insw(p,b,l) -#define insl_ns(p,b,l) insl(p,b,l) -#define outsw_ns(p,b,l) outsw(p,b,l) -#define outsl_ns(p,b,l) outsl(p,b,l) -#endif - -#if (LINUX_VERSION_CODE < VERSION(2,1,93)) -#include <linux/bios32.h> -#endif -#include <linux/pci.h> -#ifndef PCI_FUNC -#define PCI_FUNC(devfn) ((devfn)&7) -#define PCI_SLOT(devfn) ((devfn)>>3) -#define PCI_DEVFN(dev,fn) (((dev)<<3)|((fn)&7)) -#endif - -#if (LINUX_VERSION_CODE > VERSION(2,1,117)) -#define NULL_FLUSH NULL, -#else -#define NULL_FLUSH -#endif - -#if (LINUX_VERSION_CODE < VERSION(2,1,126)) -#define SCSI_DISK0_MAJOR SCSI_DISK_MAJOR -#endif - -typedef unsigned long k_time_t; -#define ACTQUIRE_RESOURCE_LOCK do {} while (0) -#define RELEASE_RESOURCE_LOCK do {} while (0) +#define wsleep(w) DEBUG(0, "wsleep stubbed out!\n"); +#define wsleeptimeout(w,t) DEBUG(0, "wsleeptimeout stubbed out!\n"); +#define wakeup(w) DEBUG(0, "wakeup stubbed out!\n"); + +extern u_char IOPCCardReadByte(void *virt); +extern u_long IOPCCardReadLong(void *virt); +extern void IOPCCardWriteByte(void *virt, u_char value); +extern void IOPCCardWriteLong(void *virt, u_int value); + +#define readb(a) IOPCCardReadByte(a) +#define readl(a) IOPCCardReadLong(a) +#define writeb(v, a) IOPCCardWriteByte(a, v) +#define writel(v, a) IOPCCardWriteLong(a, v) + +extern void *IOPCCardIORemap(u_long paddr, u_long size); +extern void IOPCCardIOUnmap(void *vaddr); + +#define ioremap(p, s) IOPCCardIORemap(p, s) +#define iounmap(v) IOPCCardIOUnmap(v) + +#ifdef IOPCCARD_IN_IOKIT_CODE + +class IOPCIDevice; +class IOPCCardBridge; +class IOCardBusDevice; +class IOPCCard16Device; + +extern int init_i82365(IOPCCardBridge *bus, IOPCIDevice *bridge, IOVirtualAddress device_regs); +extern int init_pcmcia_cs(void); + +#else /* !IOPCCARD_IN_IOKIT_CODE */ + +typedef struct IOPCIDevice IOPCIDevice; +typedef struct IOPCCardBridge IOPCCardBridge; +#define IOCardBusDevice IOPCIDevice // subclassing C style +typedef struct IOPCCard16Device IOPCCard16Device; + +extern IOCardBusDevice *IOPCCardCreateCardBusNub(IOPCCardBridge *bus, unsigned int socket, unsigned int function); +extern void IOPCCardRetainNub(void *nub); +extern void IOPCCardReleaseNub(void *nub); + +extern int IOPCCardAddCSCInterruptHandlers(IOPCCardBridge *bus, unsigned int socket, unsigned int irq, + u_int (*top_handler)(u_int), u_int (*bottom_handler)(u_int), + u_int (*enable_functional)(u_int), u_int (*disable_functional)(u_int), + const char* name); +extern int IOPCCardRemoveCSCInterruptHandlers(IOPCCardBridge *bus, unsigned int socket); + +// MACOSXXX - i82365.c and cardbus.c currently use these differently :-) +// the #defines are in those files for now +extern int IOPCCardReadConfigByte(IOPCIDevice *bus, int r, u_char *v); +extern int IOPCCardWriteConfigByte(IOPCIDevice *bus, int r, u_char v); +extern int IOPCCardReadConfigWord(IOPCIDevice *bus, int r, u_short *v); +extern int IOPCCardWriteConfigWord(IOPCIDevice *bus, int r, u_short v); +extern int IOPCCardReadConfigLong(IOPCIDevice *bus, int r, u_int *v); +extern int IOPCCardWriteConfigLong(IOPCIDevice *bus, int r, u_int v); + +// MACOSXXX these need to use IOPCCardBridge *bus, if we have multiple controllers +// on different pci bridges, the current code breaks down, this is currently +// not really an issue on laptops :-) + +extern int check_mem_region(u_long base, u_long num); +extern void request_mem_region(u_long base, u_long num, char *name); +extern void release_mem_region(u_long base, u_long num); + +extern int check_io_region(u_long base, u_long num); +extern void request_io_region(u_long base, u_long num, char *name); +extern void release_io_region(u_long base, u_long num); + +#define check_region(a, l) check_io_region(a, l) +#define request_region(a, l, n) request_io_region(a, l, n) +#define release_region(a, l) release_io_region(a, l) + +extern int configure_i82365(IOPCCardBridge *pccard_nub, IOPCIDevice *bridge_nub, void * device_regs); + +#endif /* IOPCCARD_IN_IOKIT_CODE */ + +/* Flags for device state, from ds.h */ +#define DEV_PRESENT 0x01 +#define DEV_CONFIG 0x02 +#define DEV_STALE_CONFIG 0x04 /* release on close */ +#define DEV_STALE_LINK 0x08 /* detach on release */ +#define DEV_CONFIG_PENDING 0x10 +#define DEV_RELEASE_PENDING 0x20 +#define DEV_SUSPEND 0x40 +#define DEV_BUSY 0x80 + +#define DEV_OK(state) (((state) & ~DEV_BUSY) == (DEV_CONFIG|DEV_PRESENT)) #endif /* _LINUX_K_COMPAT_H */ diff --git a/klaptopdaemon/linux/mem_op.h b/klaptopdaemon/linux/mem_op.h index 85f1ba2..ee750d5 100644 --- a/klaptopdaemon/linux/mem_op.h +++ b/klaptopdaemon/linux/mem_op.h @@ -1,8 +1,8 @@ /* - * mem_op.h 1.8 1998/07/17 10:12:23 + * mem_op.h 1.13 2000/06/12 21:55:40 * * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in + * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License * at http://www.mozilla.org/MPL/ * @@ -12,13 +12,26 @@ * limitations under the License. * * The initial developer of the original code is David A. Hinds - * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds - * are Copyright (C) 1998 David A. Hinds. All Rights Reserved. + * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU General Public License version 2 (the "GPL"), in which + * case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file + * under either the MPL or the GPL. */ #ifndef _LINUX_MEM_OP_H #define _LINUX_MEM_OP_H +#include <asm/uaccess.h> + /* If UNSAFE_MEMCPY is defined, we use the (optimized) system routines to copy between a card and kernel memory. These routines do 32-bit @@ -36,7 +49,7 @@ static inline void copy_pc_to_user(void *to, const void *from, size_t n) size_t odd = (n & 3); n -= odd; while (n) { - put_user(readl_ns(from), (int *)to); + put_user(__raw_readl(from), (int *)to); (char *)from += 4; (char *)to += 4; n -= 4; } while (odd--) @@ -51,7 +64,7 @@ static inline void copy_user_to_pc(void *to, const void *from, size_t n) n -= odd; while (n) { get_user(l, (int *)from); - writel_ns(l, to); + __raw_writel(l, to); (char *)to += 4; (char *)from += 4; n -= 4; } while (odd--) { @@ -67,8 +80,10 @@ static inline void copy_from_pc(void *to, const void *from, size_t n) size_t odd = (n & 1); n -= odd; while (n) { - *(u_short *)to = readw_ns(from); - (char *)to += 2; (char *)from += 2; n -= 2; + *(u_short *)to = __raw_readw(from); + to = (void *)((long)to + 2); + from = (const void *)((long)from + 2); + n -= 2; } if (odd) *(u_char *)to = readb(from); @@ -79,8 +94,10 @@ static inline void copy_to_pc(void *to, const void *from, size_t n) size_t odd = (n & 1); n -= odd; while (n) { - writew_ns(*(u_short *)from, to); - (char *)to += 2; (char *)from += 2; n -= 2; + __raw_writew(*(u_short *)from, to); + to = (void *)((long)to + 2); + from = (const void *)((long)from + 2); + n -= 2; } if (odd) writeb(*(u_char *)from, to); @@ -91,8 +108,10 @@ static inline void copy_pc_to_user(void *to, const void *from, size_t n) size_t odd = (n & 1); n -= odd; while (n) { - put_user(readw_ns(from), (short *)to); - (char *)to += 2; (char *)from += 2; n -= 2; + put_user(__raw_readw(from), (short *)to); + to = (void *)((long)to + 2); + from = (const void *)((long)from + 2); + n -= 2; } if (odd) put_user(readb(from), (char *)to); @@ -106,8 +125,10 @@ static inline void copy_user_to_pc(void *to, const void *from, size_t n) n -= odd; while (n) { get_user(s, (short *)from); - writew_ns(s, to); - (char *)to += 2; (char *)from += 2; n -= 2; + __raw_writew(s, to); + to = (void *)((long)to + 2); + from = (const void *)((long)from + 2); + n -= 2; } if (odd) { get_user(c, (char *)from); diff --git a/klaptopdaemon/linux/memory.h b/klaptopdaemon/linux/memory.h index d7aa9de..a420bf5 100644 --- a/klaptopdaemon/linux/memory.h +++ b/klaptopdaemon/linux/memory.h @@ -1,8 +1,8 @@ /* - * memory.h 1.3 1998/05/10 12:10:34 + * memory.h 1.8 2001/08/24 12:16:13 * * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in + * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License * at http://www.mozilla.org/MPL/ * @@ -12,8 +12,19 @@ * limitations under the License. * * The initial developer of the original code is David A. Hinds - * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds - * are Copyright (C) 1998 David A. Hinds. All Rights Reserved. + * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU General Public License version 2 (the "GPL"), in + * which case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file + * under either the MPL or the GPL. */ #ifndef _LINUX_MEMORY_H diff --git a/klaptopdaemon/linux/ss.h b/klaptopdaemon/linux/ss.h index f7030d0..d6ec6da 100644 --- a/klaptopdaemon/linux/ss.h +++ b/klaptopdaemon/linux/ss.h @@ -1,8 +1,8 @@ /* - * ss.h 1.18 1998/10/01 20:54:49 + * ss.h 1.28 2000/06/12 21:55:40 * * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in + * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License * at http://www.mozilla.org/MPL/ * @@ -12,8 +12,22 @@ * limitations under the License. * * The initial developer of the original code is David A. Hinds - * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds - * are Copyright (C) 1998 David A. Hinds. All Rights Reserved. + * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Contributor: Apple Computer, Inc. Portions � 2000 Apple Computer, + * Inc. All rights reserved. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU Public License version 2 (the "GPL"), in which + * case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file + * under either the MPL or the GPL. */ #ifndef _LINUX_SS_H @@ -25,7 +39,7 @@ typedef struct ss_callback_t { void *info; } ss_callback_t; -/* Definitions for card status flags for GettqStatus */ +/* Definitions for card status flags for GetStatus */ #define SS_WRPROT 0x0001 #define SS_CARDLOCK 0x0002 #define SS_EJECTION 0x0004 @@ -40,6 +54,7 @@ typedef struct ss_callback_t { #define SS_CARDBUS 0x0800 #define SS_3VCARD 0x1000 #define SS_XVCARD 0x2000 +#define SS_PENDING 0x4000 /* for InquireSocket */ typedef struct socket_cap_t { @@ -48,10 +63,23 @@ typedef struct socket_cap_t { u_int map_size; u_char pci_irq; u_char cardbus; +#ifdef __MACOSX__ + IOPCIDevice *bridge_nub; + IOPCCardBridge *pccard_nub; + IOCardBusDevice *cardbus_nub[8]; +#else + struct pci_bus *cb_bus; + struct bus_operations *bus; +#endif } socket_cap_t; -/* InquireSocket features */ -#define SS_HAS_PAGE_REGS 0x0001 +/* InquireSocket capabilities */ +#define SS_CAP_PAGE_REGS 0x0001 +#define SS_CAP_VIRTUAL_BUS 0x0002 +#define SS_CAP_MEM_ALIGN 0x0004 +#define SS_CAP_STATIC_MAP 0x0008 +#define SS_CAP_PCCARD 0x4000 +#define SS_CAP_CARDBUS 0x8000 /* for GetSocket, SetSocket */ typedef struct socket_state_t { @@ -61,7 +89,7 @@ typedef struct socket_state_t { u_char io_irq; } socket_state_t; -/* Various card configuration flags */ +/* Socket configuration flags */ #define SS_PWR_AUTO 0x0010 #define SS_IOCARD 0x0020 #define SS_RESET 0x0040 @@ -105,7 +133,7 @@ typedef struct cb_bridge_map { enum ss_service { SS_RegisterCallback, SS_InquireSocket, - SS_GettqStatus, SS_GetSocket, SS_SetSocket, + SS_GetStatus, SS_GetSocket, SS_SetSocket, SS_GetIOMap, SS_SetIOMap, SS_GetMemMap, SS_SetMemMap, SS_GetBridge, SS_SetBridge, SS_ProcSetup }; |