summaryrefslogtreecommitdiff
path: root/sys/arch/atari
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/arch/atari
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/arch/atari')
-rw-r--r--sys/arch/atari/pci/pci_hades.c11
-rw-r--r--sys/arch/atari/pci/pci_milan.c11
2 files changed, 18 insertions, 4 deletions
diff --git a/sys/arch/atari/pci/pci_hades.c b/sys/arch/atari/pci/pci_hades.c
index 1a38b8ceea8..86d0073de10 100644
--- a/sys/arch/atari/pci/pci_hades.c
+++ b/sys/arch/atari/pci/pci_hades.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_hades.c,v 1.13 2012/02/13 20:00:00 jdc Exp $ */
+/* $NetBSD: pci_hades.c,v 1.14 2015/10/02 05:22:50 msaitoh Exp $ */
/*
* Copyright (c) 1996 Leo Weppelman. All rights reserved.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_hades.c,v 1.13 2012/02/13 20:00:00 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_hades.c,v 1.14 2015/10/02 05:22:50 msaitoh Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -79,6 +79,9 @@ pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
{
u_long data;
+ if ((unsigned int)reg >= PCI_CONF_SIZE)
+ return ((pcireg_t) -1);
+
data = *(u_long *)(pci_conf_addr + pci_config_offset(tag) + reg);
return (bswap32(data));
}
@@ -86,6 +89,10 @@ pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
void
pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t data)
{
+
+ if ((unsigned int)reg >= PCI_CONF_SIZE)
+ return;
+
*((u_long *)(pci_conf_addr + pci_config_offset(tag) + reg))
= bswap32(data);
}
diff --git a/sys/arch/atari/pci/pci_milan.c b/sys/arch/atari/pci/pci_milan.c
index f2572aee5ed..61ca8a0a050 100644
--- a/sys/arch/atari/pci/pci_milan.c
+++ b/sys/arch/atari/pci/pci_milan.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_milan.c,v 1.13 2012/08/12 20:50:39 martin Exp $ */
+/* $NetBSD: pci_milan.c,v 1.14 2015/10/02 05:22:50 msaitoh Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_milan.c,v 1.13 2012/08/12 20:50:39 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_milan.c,v 1.14 2015/10/02 05:22:50 msaitoh Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -67,6 +67,9 @@ pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
{
u_long data;
+ if ((unsigned int)reg >= PCI_CONF_SIZE)
+ return 0xffffffff;
+
data = bswap32(milan_pci_confread(tag | reg));
if ((plx_status) & 0xf9000000) {
/*
@@ -81,6 +84,10 @@ pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
void
pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t data)
{
+
+ if ((unsigned int)reg >= PCI_CONF_SIZE)
+ return;
+
milan_pci_confwrite(tag | reg, bswap32(data));
}