1 /* 2 * Copyright (c) 2004, Joerg Sonnenberger <joerg@bec.de> 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 unmodified, this list of conditions, and the following 10 * disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * 26 * $DragonFly: src/sys/bus/pci/pci_private.h,v 1.6 2008/09/05 10:39:36 hasso Exp $ 27 * 28 */ 29 30 extern devclass_t pci_devclass; 31 32 struct pci_devinfo *pci_read_device(device_t, int, int, int, size_t); 33 struct resource_list *pci_get_resource_list (device_t dev, device_t child); 34 struct resource *pci_alloc_resource(device_t dev, device_t child, 35 int type, int *rid, u_long start, u_long end, 36 u_long count, u_int flags); 37 38 39 u_int32_t pci_read_config_method(device_t dev, device_t child, 40 int reg, int width); 41 void pci_write_config_method(device_t dev, device_t child, 42 int reg, u_int32_t val, int width); 43 44 const char *pci_class_to_string(int class); 45 void pci_delete_resource(device_t dev, device_t child, int type, int rid); 46 void pci_print_verbose(struct pci_devinfo *); 47 void pci_probe_nomatch(device_t dev, device_t child); 48 void pci_add_children(device_t dev, int busno, size_t dinfo_size); 49 void pci_add_child(device_t bus, struct pci_devinfo *dinfo); 50 void pci_driver_added(device_t dev, driver_t *driver); 51 int pci_freecfg(struct pci_devinfo *); 52 int pci_read_ivar(device_t, device_t, int, uintptr_t *); 53 int pci_write_ivar(device_t, device_t, int, uintptr_t); 54 int pci_resume(device_t dev); 55 int pci_print_child(device_t dev, device_t child); 56 int pci_assign_interrupt_method(device_t dev, device_t child); 57 int pci_set_powerstate_method(device_t dev, device_t child, int state); 58 int pci_get_powerstate_method(device_t dev, device_t child); 59 int pci_enable_busmaster_method(device_t dev, device_t child); 60 int pci_disable_busmaster_method(device_t dev, device_t child); 61 int pci_enable_io_method(device_t dev, device_t child, int space); 62 int pci_disable_io_method(device_t dev, device_t child, int space); 63 64 int pci_child_pnpinfo_str_method(device_t cbdev, device_t child, 65 char *buf, size_t buflen); 66 int pci_child_location_str_method(device_t cbdev, device_t child, 67 char *buf, size_t buflen); 68 69 /** Restore the config register state. The state must be previously 70 * saved with pci_cfg_save. However, the pci bus driver takes care of 71 * that. This function will also return the device to PCI_POWERSTATE_D0 72 * if it is currently in a lower power mode. 73 */ 74 void pci_cfg_restore(device_t, struct pci_devinfo *); 75 76 /** Save the config register state. Optionally set the power state to D3 77 * if the third argument is non-zero. 78 */ 79 void pci_cfg_save(device_t, struct pci_devinfo *, int); 80 81