proto_bus_pci.c (284689) | proto_bus_pci.c (285707) |
---|---|
1/*- | 1/*- |
2 * Copyright (c) 2014 Marcel Moolenaar | 2 * Copyright (c) 2014, 2015 Marcel Moolenaar |
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, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright --- 8 unchanged lines hidden (view full) --- 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> | 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, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright --- 8 unchanged lines hidden (view full) --- 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> |
27__FBSDID("$FreeBSD: head/sys/dev/proto/proto_bus_pci.c 284689 2015-06-22 00:34:29Z marcel $"); | 27__FBSDID("$FreeBSD: head/sys/dev/proto/proto_bus_pci.c 285707 2015-07-19 23:37:45Z marcel $"); |
28 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/bus.h> 32#include <sys/conf.h> 33#include <sys/kernel.h> 34#include <sys/module.h> 35#include <machine/bus.h> --- 18 unchanged lines hidden (view full) --- 54}; 55 56static driver_t proto_pci_driver = { 57 proto_driver_name, 58 proto_pci_methods, 59 sizeof(struct proto_softc), 60}; 61 | 28 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/bus.h> 32#include <sys/conf.h> 33#include <sys/kernel.h> 34#include <sys/module.h> 35#include <machine/bus.h> --- 18 unchanged lines hidden (view full) --- 54}; 55 56static driver_t proto_pci_driver = { 57 proto_driver_name, 58 proto_pci_methods, 59 sizeof(struct proto_softc), 60}; 61 |
62static char proto_pci_prefix[] = "pci"; 63static char **proto_pci_devnames; 64 |
|
62static int 63proto_pci_probe(device_t dev) 64{ 65 struct sbuf *sb; 66 67 if ((pci_read_config(dev, PCIR_HDRTYPE, 1) & PCIM_HDRTYPE) != 0) 68 return (ENXIO); 69 70 sb = sbuf_new_auto(); | 65static int 66proto_pci_probe(device_t dev) 67{ 68 struct sbuf *sb; 69 70 if ((pci_read_config(dev, PCIR_HDRTYPE, 1) & PCIM_HDRTYPE) != 0) 71 return (ENXIO); 72 73 sb = sbuf_new_auto(); |
71 sbuf_printf(sb, "pci%d:%d:%d:%d", pci_get_domain(dev), | 74 sbuf_printf(sb, "%s%d:%d:%d:%d", proto_pci_prefix, pci_get_domain(dev), |
72 pci_get_bus(dev), pci_get_slot(dev), pci_get_function(dev)); 73 sbuf_finish(sb); 74 device_set_desc_copy(dev, sbuf_data(sb)); 75 sbuf_delete(sb); | 75 pci_get_bus(dev), pci_get_slot(dev), pci_get_function(dev)); 76 sbuf_finish(sb); 77 device_set_desc_copy(dev, sbuf_data(sb)); 78 sbuf_delete(sb); |
76 return (BUS_PROBE_HOOVER); | 79 return (proto_probe(dev, proto_pci_prefix, &proto_pci_devnames)); |
77} 78 79static int 80proto_pci_attach(device_t dev) 81{ 82 struct proto_softc *sc; 83 struct resource *res; 84 uint32_t val; --- 31 unchanged lines hidden --- | 80} 81 82static int 83proto_pci_attach(device_t dev) 84{ 85 struct proto_softc *sc; 86 struct resource *res; 87 uint32_t val; --- 31 unchanged lines hidden --- |