Deleted Added
full compact
pci_cfgreg.c (243712) pci_cfgreg.c (243737)
1/*-
2 * Copyright (c) 1997, Stefan Esser <se@freebsd.org>
3 * Copyright (c) 2000, Michael Smith <msmith@freebsd.org>
4 * Copyright (c) 2000, BSDi
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1997, Stefan Esser <se@freebsd.org>
3 * Copyright (c) 2000, Michael Smith <msmith@freebsd.org>
4 * Copyright (c) 2000, BSDi
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/amd64/pci/pci_cfgreg.c 243712 2012-11-30 20:15:01Z jkim $");
30__FBSDID("$FreeBSD: head/sys/amd64/pci/pci_cfgreg.c 243737 2012-12-01 00:56:19Z jkim $");
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/bus.h>
35#include <sys/lock.h>
36#include <sys/kernel.h>
37#include <sys/mutex.h>
38#include <sys/sysctl.h>

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

290 if (val2 != val1)
291 pcie_badslots |= (1 << slot);
292 }
293 }
294
295 return (1);
296}
297
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/bus.h>
35#include <sys/lock.h>
36#include <sys/kernel.h>
37#include <sys/mutex.h>
38#include <sys/sysctl.h>

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

290 if (val2 != val1)
291 pcie_badslots |= (1 << slot);
292 }
293 }
294
295 return (1);
296}
297
298#define PCIE_VADDR(base, reg, bus, slot, func) \
299 ((base) + \
300 ((((bus) & 0xff) << 20) | \
301 (((slot) & 0x1f) << 15) | \
302 (((func) & 0x7) << 12) | \
303 ((reg) & 0xfff)))
304
298/*
299 * AMD BIOS And Kernel Developer's Guides for CPU families starting with 10h
300 * have a requirement that all accesses to the memory mapped PCI configuration
301 * space are done using AX class of registers.
302 * Since other vendors do not currently have any contradicting requirements
303 * the AMD access pattern is applied universally.
304 */
305/*
306 * AMD BIOS And Kernel Developer's Guides for CPU families starting with 10h
307 * have a requirement that all accesses to the memory mapped PCI configuration
308 * space are done using AX class of registers.
309 * Since other vendors do not currently have any contradicting requirements
310 * the AMD access pattern is applied universally.
311 */
305#define PCIE_VADDR(base, reg, bus, slot, func) \
306 ((base) + \
307 ((((bus) & 0xff) << 20) | \
308 (((slot) & 0x1f) << 15) | \
309 (((func) & 0x7) << 12) | \
310 ((reg) & 0xfff)))
311
312static int
313pciereg_cfgread(int bus, unsigned slot, unsigned func, unsigned reg,
314 unsigned bytes)
315{
316 vm_offset_t va;
317 int data = -1;
318

--- 51 unchanged lines hidden ---
312
313static int
314pciereg_cfgread(int bus, unsigned slot, unsigned func, unsigned reg,
315 unsigned bytes)
316{
317 vm_offset_t va;
318 int data = -1;
319

--- 51 unchanged lines hidden ---