1 /* 2 * Copyright (c) 2000,2001 Jonathan Chen. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions, and the following disclaimer, 10 * without modification, immediately at the beginning of the file. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in 13 * the documentation and/or other materials provided with the 14 * distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * $FreeBSD$ 29 */ 30 31 /* 32 * Structure definitions for the Cardbus Bridge driver 33 */ 34 35 struct intrhand { 36 void(*func)(void*arg); 37 void* arg; 38 STAILQ_ENTRY(intrhand) entries; 39 }; 40 41 struct pccbb_socketreg { 42 u_int32_t socket_event; 43 u_int32_t socket_mask; 44 u_int32_t socket_state; 45 u_int32_t socket_force; 46 u_int32_t socket_control; 47 u_int32_t socket_power; 48 }; 49 50 struct pccbb_reslist { 51 SLIST_ENTRY(pccbb_reslist) entries; 52 int type; 53 int rid; 54 u_int32_t start; 55 u_int32_t end; 56 device_t odev; 57 int win; 58 }; 59 60 #define PCCBB_AUTO_OPEN_SMALLHOLE 0x100 61 62 struct pccbb_softc { 63 device_t sc_dev; 64 struct resource *sc_base_res; 65 struct resource *sc_irq_res; 66 void *sc_intrhand; 67 struct pccbb_socketreg *sc_socketreg; 68 u_int32_t sc_flags; 69 #define PCCBB_PCIC_IO_RELOC 0x01 70 #define PCCBB_PCIC_MEM_32 0x02 71 #define PCCBB_CARDSTATUS_BUSY 0x01000000 72 #define PCCBB_CARDATTACHED 0x02000000 73 #define PCCBB_16BIT_CARD 0x04000000 74 #define PCCBB_INITIALCARD 0x08000000 75 int sc_chipset; /* chipset id */ 76 #define CB_UNKNOWN 0 /* NOT Cardbus-PCI bridge */ 77 #define CB_TI113X 1 /* TI PCI1130/1131 */ 78 #define CB_TI12XX 2 /* TI PCI1250/1220 */ 79 #define CB_RF5C47X 3 /* RICOH RF5C475/476/477 */ 80 #define CB_RF5C46X 4 /* RICOH RF5C465/466/467 */ 81 #define CB_TOPIC95 5 /* Toshiba ToPIC95 */ 82 #define CB_TOPIC95B 6 /* Toshiba ToPIC95B */ 83 #define CB_TOPIC97 7 /* Toshiba ToPIC97/100 */ 84 #define CB_CIRRUS 8 /* Cirrus Logic CLPD683x */ 85 SLIST_HEAD(, pccbb_reslist) rl; 86 87 device_t sc_cbdev; 88 device_t sc_pccarddev; 89 90 /* PC Card stuff */ 91 int memalloc; 92 struct pccard_mem_handle mem[PCIC_MEM_WINS]; 93 int ioalloc; 94 struct pccard_io_handle io[PCIC_IO_WINS]; 95 96 /* kthread staff */ 97 struct proc *event_thread; 98 }; 99 100 /* XXX: rman is dumb */ 101 #define CARDBUS_SYS_RES_MEMORY_START 0x18020000 102 #define CARDBUS_SYS_RES_MEMORY_END 0xEFFFFFFF 103 #define CARDBUS_SYS_RES_IOPORT_START 0x2000 104 #define CARDBUS_SYS_RES_IOPORT_END 0xEFFF 105 106