#-1# Copyright (c) 1999 M. Warner Losh <[email protected]>2#3# Redistribution and use in source and binary forms, with or without4# modification, are permitted provided that the following conditions5# are met:6# 1. Redistributions of source code must retain the above copyright7# notice, this list of conditions and the following disclaimer.8# 2. Redistributions in binary form must reproduce the above copyright9# notice, this list of conditions and the following disclaimer in the10# documentation and/or other materials provided with the distribution.11#12# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND13# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE14# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE15# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE16# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL17# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS18# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)19# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT20# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY21# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF22# SUCH DAMAGE.23#24#2526#include <sys/bus.h>27#include <machine/bus.h>28#include <dev/pccard/pccardvar.h>2930INTERFACE card;3132#33# Companion interface for pccard. We need to set attributes for memory34# and i/o port mappings (as well as other types of attributes) that have35# a well defined meaning inside the PC Card/CardBus system. The bus36# methods are inadequate for this because this must be done at the time the37# resources are set for the device, which predates their activation. Also,38# the driver activating the resources doesn't necessarily know or need to know39# these attributes.40#41METHOD int set_res_flags {42device_t dev;43device_t child;44int restype;45int rid;46u_long value;47};4849METHOD int get_res_flags {50device_t dev;51device_t child;52int restype;53int rid;54u_long *value;55};5657#58# Sets the memory offset of the pccard bridge's window into attribute59# or common memory space.60#61METHOD int set_memory_offset {62device_t dev;63device_t child;64int rid;65uint32_t cardaddr;66uint32_t *deltap;67}6869METHOD int get_memory_offset {70device_t dev;71device_t child;72int rid;73uint32_t *offset;74}7576#77# pccard bridges call this method to initate the attachment of a card78#79METHOD int attach_card {80device_t dev;81}8283#84# pccard bridges call this to detach a card.85#86METHOD int detach_card {87device_t dev;88}8990#91# Find "dev" in the passed table of devices. Return it or NULL.92#93METHOD const struct pccard_product * do_product_lookup {94device_t bus;95device_t dev;96const struct pccard_product *tab;97size_t ent_size;98pccard_product_match_fn matchfn;99}100101#102# Scanning function for accessing the CIS of a card in its driver.103#104METHOD int cis_scan {105device_t bus;106device_t dev;107pccard_scan_t fnp;108void *argp;109};110111#112# Convenience function to read attribute memory.113#114METHOD int attr_read {115device_t bus;116device_t dev;117uint32_t offset;118uint8_t *val;119}120121#122# Convenience function to write attribute memory.123#124METHOD int attr_write {125device_t bus;126device_t dev;127uint32_t offset;128uint8_t val;129}130131#132# Read the CCR register133#134METHOD int ccr_read {135device_t bus;136device_t dev;137uint32_t offset;138uint8_t *val;139}140141#142# Write the CCR register143#144METHOD int ccr_write {145device_t bus;146device_t dev;147uint32_t offset;148uint8_t val;149}150151152