Deleted Added
full compact
proto_bus_pci.c (284315) proto_bus_pci.c (284689)
1/*-
2 * Copyright (c) 2014 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

--- 10 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>
1/*-
2 * Copyright (c) 2014 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

--- 10 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 284315 2015-06-12 12:27:10Z marcel $");
27__FBSDID("$FreeBSD: head/sys/dev/proto/proto_bus_pci.c 284689 2015-06-22 00:34:29Z 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>

--- 23 unchanged lines hidden (view full) ---

59 sizeof(struct proto_softc),
60};
61
62static int
63proto_pci_probe(device_t dev)
64{
65 struct sbuf *sb;
66
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>

--- 23 unchanged lines hidden (view full) ---

59 sizeof(struct proto_softc),
60};
61
62static int
63proto_pci_probe(device_t dev)
64{
65 struct sbuf *sb;
66
67 /* For now we only attach to function 0 devices. */
68 if (pci_get_function(dev) != 0)
67 if ((pci_read_config(dev, PCIR_HDRTYPE, 1) & PCIM_HDRTYPE) != 0)
69 return (ENXIO);
70
71 sb = sbuf_new_auto();
72 sbuf_printf(sb, "pci%d:%d:%d:%d", pci_get_domain(dev),
73 pci_get_bus(dev), pci_get_slot(dev), pci_get_function(dev));
74 sbuf_finish(sb);
75 device_set_desc_copy(dev, sbuf_data(sb));
76 sbuf_delete(sb);

--- 40 unchanged lines hidden ---
68 return (ENXIO);
69
70 sb = sbuf_new_auto();
71 sbuf_printf(sb, "pci%d:%d:%d:%d", 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);

--- 40 unchanged lines hidden ---