189948Simp/* $FreeBSD: releng/11.0/sys/dev/exca/excavar.h 139749 2005-01-06 01:43:34Z imp $ */ 289948Simp 3139749Simp/*- 489948Simp * Copyright (c) 2002 M Warner Losh. All rights reserved. 589948Simp * 689948Simp * Redistribution and use in source and binary forms, with or without 789948Simp * modification, are permitted provided that the following conditions 889948Simp * are met: 989948Simp * 1. Redistributions of source code must retain the above copyright 1089948Simp * notice, this list of conditions and the following disclaimer. 1189948Simp * 2. Redistributions in binary form must reproduce the above copyright 1289948Simp * notice, this list of conditions and the following disclaimer in the 1389948Simp * documentation and/or other materials provided with the distribution. 1489948Simp * 1589948Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1689948Simp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1789948Simp * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1889948Simp * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 1989948Simp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2089948Simp * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2189948Simp * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2289948Simp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2389948Simp * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2489948Simp * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2589948Simp * 2689948Simp * This software may be derived from NetBSD i82365.c and other files with 2789948Simp * the following copyright: 2889948Simp * 2989948Simp * Copyright (c) 1997 Marc Horowitz. All rights reserved. 3089948Simp * 3189948Simp * Redistribution and use in source and binary forms, with or without 3289948Simp * modification, are permitted provided that the following conditions 3389948Simp * are met: 3489948Simp * 1. Redistributions of source code must retain the above copyright 3589948Simp * notice, this list of conditions and the following disclaimer. 3689948Simp * 2. Redistributions in binary form must reproduce the above copyright 3789948Simp * notice, this list of conditions and the following disclaimer in the 3889948Simp * documentation and/or other materials provided with the distribution. 3989948Simp * 3. All advertising materials mentioning features or use of this software 4089948Simp * must display the following acknowledgement: 4189948Simp * This product includes software developed by Marc Horowitz. 4289948Simp * 4. The name of the author may not be used to endorse or promote products 4389948Simp * derived from this software without specific prior written permission. 4489948Simp * 4589948Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 4689948Simp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 4789948Simp * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 4889948Simp * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 4989948Simp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 5089948Simp * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 5189948Simp * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 5289948Simp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 5389948Simp * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 5489948Simp * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 5589948Simp */ 5689948Simp 57100703Simp#ifndef _SYS_DEV_EXCA_EXCAVAR_H 58100703Simp#define _SYS_DEV_EXCA_EXCAVAR_H 59100703Simp 6089948Simp/* 6189948Simp * Structure to manage the ExCA part of the chip. 6289948Simp */ 6389948Simpstruct exca_softc; 64110841Simptypedef uint8_t (exca_getb_fn)(struct exca_softc *, int); 65110841Simptypedef void (exca_putb_fn)(struct exca_softc *, int, uint8_t); 6689948Simp 6789948Simpstruct exca_softc 6889948Simp{ 6989948Simp device_t dev; 7089948Simp int memalloc; 7189948Simp struct pccard_mem_handle mem[EXCA_MEM_WINS]; 7289948Simp int ioalloc; 7389948Simp struct pccard_io_handle io[EXCA_IO_WINS]; 7489948Simp bus_space_tag_t bst; 7589948Simp bus_space_handle_t bsh; 7689948Simp uint32_t flags; 7789948Simp#define EXCA_SOCKET_PRESENT 0x00000001 78100703Simp#define EXCA_HAS_MEMREG_WIN 0x00000002 79115988Simp#define EXCA_CARD_OK 0x00000004 80133782Simp#define EXCA_EVENT 0x80000000 8189948Simp uint32_t offset; 82110841Simp int chipset; 83110841Simp#define EXCA_CARDBUS 0 84110841Simp#define EXCA_I82365 1 /* Intel i82365SL-A/B or clone */ 85110841Simp#define EXCA_I82365SL_DF 2 /* Intel i82365sl-DF step */ 86110841Simp#define EXCA_VLSI 3 /* VLSI chip */ 87110841Simp#define EXCA_PD6710 4 /* Cirrus logic PD6710 */ 88110841Simp#define EXCA_PD6722 5 /* Cirrus logic PD6722 */ 89110841Simp#define EXCA_PD6729 6 /* Cirrus Logic PD6729 */ 90110841Simp#define EXCA_VG365 7 /* Vadem 365 */ 91110841Simp#define EXCA_VG465 8 /* Vadem 465 */ 92110841Simp#define EXCA_VG468 9 /* Vadem 468 */ 93110841Simp#define EXCA_VG469 10 /* Vadem 469 */ 94110841Simp#define EXCA_RF5C296 11 /* Ricoh RF5C296 */ 95110841Simp#define EXCA_RF5C396 12 /* Ricoh RF5C396 */ 96110841Simp#define EXCA_IBM 13 /* IBM clone */ 97110841Simp#define EXCA_IBM_KING 14 /* IBM KING PCMCIA Controller */ 98115988Simp#define EXCA_BOGUS -1 /* Invalid/not present/etc */ 99110841Simp exca_getb_fn *getb; 100110841Simp exca_putb_fn *putb; 101115988Simp device_t pccarddev; 102133782Simp uint32_t status; /* status, hw dependent */ 10389948Simp}; 10489948Simp 105100703Simpvoid exca_init(struct exca_softc *sc, device_t dev, 106100703Simp bus_space_tag_t, bus_space_handle_t, uint32_t); 107115988Simpvoid exca_insert(struct exca_softc *sc); 10889948Simpint exca_io_map(struct exca_softc *sc, int width, struct resource *r); 10989948Simpint exca_io_unmap_res(struct exca_softc *sc, struct resource *res); 11089948Simpint exca_is_pcic(struct exca_softc *sc); 11189948Simpint exca_mem_map(struct exca_softc *sc, int kind, struct resource *res); 11289948Simpint exca_mem_set_flags(struct exca_softc *sc, struct resource *res, 11389948Simp uint32_t flags); 11489948Simpint exca_mem_set_offset(struct exca_softc *sc, struct resource *res, 11589948Simp uint32_t cardaddr, uint32_t *deltap); 11689948Simpint exca_mem_unmap_res(struct exca_softc *sc, struct resource *res); 117110841Simpint exca_probe_slots(device_t dev, struct exca_softc *exca, 118110841Simp bus_space_tag_t iot, bus_space_handle_t ioh); 119115988Simpvoid exca_removal(struct exca_softc *); 12089948Simpvoid exca_reset(struct exca_softc *, device_t child); 12189948Simp 122115988Simp/* bus/device interfaces */ 123115988Simpint exca_activate_resource(struct exca_softc *exca, device_t child, int type, 124115988Simp int rid, struct resource *res); 125115988Simpint exca_deactivate_resource(struct exca_softc *exca, device_t child, int type, 126115988Simp int rid, struct resource *res); 127115988Simp 12889948Simpstatic __inline uint8_t 129110841Simpexca_getb(struct exca_softc *sc, int reg) 13089948Simp{ 131110841Simp return (sc->getb(sc, reg)); 13289948Simp} 13389948Simp 13489948Simpstatic __inline void 135110841Simpexca_putb(struct exca_softc *sc, int reg, uint8_t val) 13689948Simp{ 137110841Simp sc->putb(sc, reg, val); 13889948Simp} 13989948Simp 14089948Simpstatic __inline void 14189948Simpexca_setb(struct exca_softc *sc, int reg, uint8_t mask) 14289948Simp{ 143110841Simp exca_putb(sc, reg, exca_getb(sc, reg) | mask); 14489948Simp} 14589948Simp 14689948Simpstatic __inline void 14789948Simpexca_clrb(struct exca_softc *sc, int reg, uint8_t mask) 14889948Simp{ 149110841Simp exca_putb(sc, reg, exca_getb(sc, reg) & ~mask); 15089948Simp} 151100703Simp 152100703Simp#endif /* !_SYS_DEV_EXCA_EXCAVAR_H */ 153