summaryrefslogtreecommitdiff
path: root/sys/dev/marvell
diff options
context:
space:
mode:
authormsaitoh <msaitoh@NetBSD.org>2015-10-02 05:22:49 +0000
committermsaitoh <msaitoh@NetBSD.org>2015-10-02 05:22:49 +0000
commit998866035fb2f446df656a6ae9e4b0ee4ddc445c (patch)
treed95622964c21680e079f5097dd6a20e673e3c349 /sys/dev/marvell
parent058cde2471e6b21a2d85f267a5be1ec6b7a472b9 (diff)
PCI Extended Configuration stuff written by nonaka@:
- Add PCI Extended Configuration Space support into x86. - Check register offset of pci_conf_read() in MD part. It returns (pcireg_t)-1 if it isn't accessible. - Decode Extended Capability in PCI Extended Configuration Space. Currently the following extended capabilities are decoded: - Advanced Error Reporting - Virtual Channel - Device Serial Number - Power Budgeting - Root Complex Link Declaration - Root Complex Event Collector Association - Access Control Services - Alternative Routing-ID Interpretation - Address Translation Services - Single Root IO Virtualization - Page Request - TPH Requester - Latency Tolerance Reporting - Secondary PCI Express - Process Address Space ID - LN Requester - L1 PM Substates The following extended capabilities are not decoded yet: - Root Complex Internal Link Control - Multi-Function Virtual Channel - RCRB Header - Vendor Unique - Configuration Access Correction - Multiple Root IO Virtualization - Multicast - Resizable BAR - Dynamic Power Allocation - Protocol Multiplexing - Downstream Port Containment - Precision Time Management - M-PCIe - Function Reading Status Queueing - Readiness Time Reporting - Designated Vendor-Specific
Diffstat (limited to 'sys/dev/marvell')
-rw-r--r--sys/dev/marvell/gtpci.c10
-rw-r--r--sys/dev/marvell/mvpex.c10
2 files changed, 16 insertions, 4 deletions
diff --git a/sys/dev/marvell/gtpci.c b/sys/dev/marvell/gtpci.c
index 5d52cd7f866..88014b130f0 100644
--- a/sys/dev/marvell/gtpci.c
+++ b/sys/dev/marvell/gtpci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: gtpci.c,v 1.31 2013/11/06 06:20:12 mrg Exp $ */
+/* $NetBSD: gtpci.c,v 1.32 2015/10/02 05:22:52 msaitoh Exp $ */
/*
* Copyright (c) 2008, 2009 KIYOHARA Takashi
* All rights reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gtpci.c,v 1.31 2013/11/06 06:20:12 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtpci.c,v 1.32 2015/10/02 05:22:52 msaitoh Exp $");
#include "opt_pci.h"
#include "pci.h"
@@ -567,6 +567,9 @@ gtpci_conf_read(void *v, pcitag_t tag, int reg)
struct gtpci_softc *sc = v;
const pcireg_t addr = tag | reg;
+ if ((unsigned int)reg >= PCI_CONF_SIZE)
+ return -1;
+
GTPCI_WRITE(sc, GTPCI_CA, addr | GTPCI_CA_CONFIGEN);
if ((addr | GTPCI_CA_CONFIGEN) != GTPCI_READ(sc, GTPCI_CA))
return -1;
@@ -580,6 +583,9 @@ gtpci_conf_write(void *v, pcitag_t tag, int reg, pcireg_t data)
struct gtpci_softc *sc = v;
pcireg_t addr = tag | (reg & 0xfc);
+ if ((unsigned int)reg >= PCI_CONF_SIZE)
+ return;
+
GTPCI_WRITE(sc, GTPCI_CA, addr | GTPCI_CA_CONFIGEN);
if ((addr | GTPCI_CA_CONFIGEN) != GTPCI_READ(sc, GTPCI_CA))
return;
diff --git a/sys/dev/marvell/mvpex.c b/sys/dev/marvell/mvpex.c
index 2a697022ec3..f291b01ebea 100644
--- a/sys/dev/marvell/mvpex.c
+++ b/sys/dev/marvell/mvpex.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mvpex.c,v 1.14 2015/07/28 01:57:55 knakahara Exp $ */
+/* $NetBSD: mvpex.c,v 1.15 2015/10/02 05:22:52 msaitoh Exp $ */
/*
* Copyright (c) 2008 KIYOHARA Takashi
* All rights reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mvpex.c,v 1.14 2015/07/28 01:57:55 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvpex.c,v 1.15 2015/10/02 05:22:52 msaitoh Exp $");
#include "opt_pci.h"
#include "pci.h"
@@ -507,6 +507,9 @@ mvpex_conf_read(void *v, pcitag_t tag, int reg)
uint32_t stat;
int bus, dev, func, pexbus, pexdev;
+ if ((unsigned int)reg >= PCI_EXTCONF_SIZE)
+ return -1;
+
mvpex_decompose_tag(v, tag, &bus, &dev, &func);
stat = bus_space_read_4(sc->sc_iot, sc->sc_ioh, MVPEX_STAT);
@@ -552,6 +555,9 @@ mvpex_conf_write(void *v, pcitag_t tag, int reg, pcireg_t data)
uint32_t stat;
int bus, dev, func, pexbus, pexdev;
+ if ((unsigned int)reg >= PCI_EXTCONF_SIZE)
+ return;
+
mvpex_decompose_tag(v, tag, &bus, &dev, &func);
stat = bus_space_read_4(sc->sc_iot, sc->sc_ioh, MVPEX_STAT);