/*
* Copyright (c) 1997 Marc Horowitz. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Marc Horowitz.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
struct pcic_handle {
device_t ph_parent;
bus_space_tag_t ph_bus_t; /* I/O or MEM? I don't mind */
bus_space_handle_t ph_bus_h;
uint8_t (*ph_read)(struct pcic_handle *, int);
void (*ph_write)(struct pcic_handle *, int, uint8_t);
int vendor; /* vendor of chip */
int chip; /* chip index 0 or 1 */
int socket; /* socket index 0 or 1 */
int sock; /* register offset */
int flags;
int laststate;
int memalloc;
struct {
bus_addr_t addr;
bus_size_t size;
long offset;
int kind;
} mem[PCIC_MEM_WINS];
int ioalloc;
struct {
bus_addr_t addr;
bus_size_t size;
int width;
} io[PCIC_IO_WINS];
int ih_irq;
device_t pcmcia;
int shutdown;
struct lwp *event_thread;
SIMPLEQ_HEAD(, pcic_event) events;
};
/* this needs to be large enough to hold PCIC_MEM_PAGES bits */
int subregionmask;
#define PCIC_MAX_MEM_PAGES (8 * sizeof(int))
/* used by memory window mapping functions */
bus_addr_t membase;
/*
* used by io window mapping functions. These can actually overlap
* with another pcic, since the underlying extent mapper will deal
* with individual allocations. This is here to deal with the fact
* that different busses have different real widths (different pc
* hardware seems to use 10 or 12 bits for the I/O bus).
*/
bus_addr_t iobase;
bus_addr_t iosize;
int irq;
void *ih;
struct pcic_handle handle[PCIC_NSLOTS];
/* for use by underlying chip code for discovering irqs */
int intr_detect, intr_false;
int intr_mask[PCIC_NSLOTS / 2]; /* probed interrupts if possible */
};
int pcic_ident_ok(int);
int pcic_vendor(struct pcic_handle *);
const char *pcic_vendor_to_string(int);