Deleted Added
full compact
qpi.c (260973) qpi.c (261790)
1/*-
2 * Copyright (c) 2010 Advanced Computing Technologies LLC
3 * Written by: John H. Baldwin <jhb@FreeBSD.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

28/*
29 * This driver provides a psuedo-bus to enumerate the PCI buses
30 * present on a sytem using a QPI chipset. It creates a qpi0 bus that
31 * is a child of nexus0 and then creates two Host-PCI bridges as a
32 * child of that.
33 */
34
35#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2010 Advanced Computing Technologies LLC
3 * Written by: John H. Baldwin <jhb@FreeBSD.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

28/*
29 * This driver provides a psuedo-bus to enumerate the PCI buses
30 * present on a sytem using a QPI chipset. It creates a qpi0 bus that
31 * is a child of nexus0 and then creates two Host-PCI bridges as a
32 * child of that.
33 */
34
35#include <sys/cdefs.h>
36__FBSDID("$FreeBSD: head/sys/x86/pci/qpi.c 260973 2014-01-21 03:14:19Z jhb $");
36__FBSDID("$FreeBSD: head/sys/x86/pci/qpi.c 261790 2014-02-12 04:30:37Z jhb $");
37
38#include <sys/param.h>
39#include <sys/bus.h>
40#include <sys/kernel.h>
41#include <sys/malloc.h>
42#include <sys/module.h>
43#include <sys/rman.h>
44#include <sys/systm.h>

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

233 case PCIB_IVAR_BUS:
234 *result = pcib_get_bus(dev);
235 return (0);
236 default:
237 return (ENOENT);
238 }
239}
240
37
38#include <sys/param.h>
39#include <sys/bus.h>
40#include <sys/kernel.h>
41#include <sys/malloc.h>
42#include <sys/module.h>
43#include <sys/rman.h>
44#include <sys/systm.h>

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

233 case PCIB_IVAR_BUS:
234 *result = pcib_get_bus(dev);
235 return (0);
236 default:
237 return (ENOENT);
238 }
239}
240
241#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
242static struct resource *
243qpi_pcib_alloc_resource(device_t dev, device_t child, int type, int *rid,
244 u_long start, u_long end, u_long count, u_int flags)
245{
246
247 if (type == PCI_RES_BUS)
248 return (pci_domain_alloc_bus(0, child, rid, start, end, count,
249 flags));
250 return (bus_generic_alloc_resource(dev, child, type, rid, start, end,
251 count, flags));
252}
253#endif
254
241static int
242qpi_pcib_map_msi(device_t pcib, device_t dev, int irq, uint64_t *addr,
243 uint32_t *data)
244{
245 device_t bus;
246
247 bus = device_get_parent(pcib);
248 return (PCIB_MAP_MSI(device_get_parent(bus), dev, irq, addr, data));

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

253 DEVMETHOD(device_probe, qpi_pcib_probe),
254 DEVMETHOD(device_attach, qpi_pcib_attach),
255 DEVMETHOD(device_shutdown, bus_generic_shutdown),
256 DEVMETHOD(device_suspend, bus_generic_suspend),
257 DEVMETHOD(device_resume, bus_generic_resume),
258
259 /* Bus interface */
260 DEVMETHOD(bus_read_ivar, qpi_pcib_read_ivar),
255static int
256qpi_pcib_map_msi(device_t pcib, device_t dev, int irq, uint64_t *addr,
257 uint32_t *data)
258{
259 device_t bus;
260
261 bus = device_get_parent(pcib);
262 return (PCIB_MAP_MSI(device_get_parent(bus), dev, irq, addr, data));

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

267 DEVMETHOD(device_probe, qpi_pcib_probe),
268 DEVMETHOD(device_attach, qpi_pcib_attach),
269 DEVMETHOD(device_shutdown, bus_generic_shutdown),
270 DEVMETHOD(device_suspend, bus_generic_suspend),
271 DEVMETHOD(device_resume, bus_generic_resume),
272
273 /* Bus interface */
274 DEVMETHOD(bus_read_ivar, qpi_pcib_read_ivar),
275#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
276 DEVMETHOD(bus_alloc_resource, qpi_pcib_alloc_resource),
277 DEVMETHOD(bus_adjust_resource, legacy_pcib_adjust_resource),
278 DEVMETHOD(bus_release_resource, legacy_pcib_release_resource),
279#else
261 DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
262 DEVMETHOD(bus_release_resource, bus_generic_release_resource),
280 DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
281 DEVMETHOD(bus_release_resource, bus_generic_release_resource),
282#endif
263 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
264 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
265 DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
266 DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
267
268 /* pcib interface */
269 DEVMETHOD(pcib_maxslots, pcib_maxslots),
270 DEVMETHOD(pcib_read_config, legacy_pcib_read_config),

--- 14 unchanged lines hidden ---
283 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
284 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
285 DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
286 DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
287
288 /* pcib interface */
289 DEVMETHOD(pcib_maxslots, pcib_maxslots),
290 DEVMETHOD(pcib_read_config, legacy_pcib_read_config),

--- 14 unchanged lines hidden ---