/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2000,2001 Jonathan Chen. All rights reserved.4* Copyright (c) 2008 M. Warner Losh <[email protected]>5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in the13* documentation and/or other materials provided with the distribution.14*15* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND16* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE17* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE18* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE19* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL20* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS21* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)22* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT23* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY24* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF25* SUCH DAMAGE.26*/2728/*29* Structure definitions for the Cardbus Bus driver30*/3132/*33* Static copy of the CIS buffer. Technically, you aren't supposed34* to do this. In practice, however, it works well.35*/36struct cis_buffer37{38size_t len; /* Actual length of the CIS */39uint8_t buffer[2040]; /* small enough to be 2k */40};4142/*43* Per child information for the PCI device. Cardbus layers on some44* additional data.45*/46struct cardbus_devinfo47{48struct pci_devinfo pci;49uint8_t mprefetchable; /* bit mask of prefetchable BARs */50uint8_t mbelow1mb; /* bit mask of BARs which require below 1Mb */51uint16_t mfrid; /* manufacturer id */52uint16_t prodid; /* product id */53u_int funcid; /* function id */54union {55struct {56uint8_t nid[6]; /* MAC address */57} lan;58} funce;59uint32_t fepresent; /* bit mask of funce values present */60struct cdev *sc_cisdev;61struct cis_buffer sc_cis;62};6364/*65* Per cardbus soft info. Not sure why we even keep this around...66*/67struct cardbus_softc68{69device_t sc_dev;70struct resource *sc_bus;71};7273/*74* Per node callback structures.75*/76struct tuple_callbacks;77typedef int (tuple_cb) (device_t cbdev, device_t child, int id, int len,78uint8_t *tupledata, uint32_t start, uint32_t *off,79struct tuple_callbacks *info, void *);80struct tuple_callbacks {81int id;82char *name;83tuple_cb *func;84};8586int cardbus_device_create(struct cardbus_softc *sc,87struct cardbus_devinfo *devi, device_t parent, device_t child);88int cardbus_device_destroy(struct cardbus_devinfo *devi);89int cardbus_parse_cis(device_t cbdev, device_t child,90struct tuple_callbacks *callbacks, void *);919293