Sat Jan 23 17:09:51 2016 UTC ()
add another special case so SM50x's framebuffer gets mapped with prefetching /
write combining enabled.
This needs to be generalized somewhere...


(macallan)
diff -r1.150 -r1.151 src/sys/dev/pci/pci.c

cvs diff -r1.150 -r1.151 src/sys/dev/pci/pci.c (expand / switch to unified diff)

--- src/sys/dev/pci/pci.c 2015/11/02 09:29:08 1.150
+++ src/sys/dev/pci/pci.c 2016/01/23 17:09:51 1.151
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pci.c,v 1.150 2015/11/02 09:29:08 knakahara Exp $ */ 1/* $NetBSD: pci.c,v 1.151 2016/01/23 17:09:51 macallan Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1995, 1996, 1997, 1998 4 * Copyright (c) 1995, 1996, 1997, 1998
5 * Christopher G. Demetriou. All rights reserved. 5 * Christopher G. Demetriou. All rights reserved.
6 * Copyright (c) 1994 Charles M. Hannum. All rights reserved. 6 * Copyright (c) 1994 Charles M. Hannum. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -26,27 +26,27 @@ @@ -26,27 +26,27 @@
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34/* 34/*
35 * PCI bus autoconfiguration. 35 * PCI bus autoconfiguration.
36 */ 36 */
37 37
38#include <sys/cdefs.h> 38#include <sys/cdefs.h>
39__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.150 2015/11/02 09:29:08 knakahara Exp $"); 39__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.151 2016/01/23 17:09:51 macallan Exp $");
40 40
41#ifdef _KERNEL_OPT 41#ifdef _KERNEL_OPT
42#include "opt_pci.h" 42#include "opt_pci.h"
43#endif 43#endif
44 44
45#include <sys/param.h> 45#include <sys/param.h>
46#include <sys/malloc.h> 46#include <sys/malloc.h>
47#include <sys/systm.h> 47#include <sys/systm.h>
48#include <sys/device.h> 48#include <sys/device.h>
49#include <sys/module.h> 49#include <sys/module.h>
50 50
51#include <dev/pci/pcireg.h> 51#include <dev/pci/pcireg.h>
52#include <dev/pci/pcivar.h> 52#include <dev/pci/pcivar.h>
@@ -342,28 +342,32 @@ pci_probe_device(struct pci_softc *sc, p @@ -342,28 +342,32 @@ pci_probe_device(struct pci_softc *sc, p
342 * split things up so each half-aperture can 342 * split things up so each half-aperture can
343 * be mapped PREFETCHABLE except the last page 343 * be mapped PREFETCHABLE except the last page
344 * which may contain registers 344 * which may contain registers
345 */ 345 */
346 r->r_size = 0x7ff000; 346 r->r_size = 0x7ff000;
347 r->r_flags = BUS_SPACE_MAP_LINEAR | 347 r->r_flags = BUS_SPACE_MAP_LINEAR |
348 BUS_SPACE_MAP_PREFETCHABLE; 348 BUS_SPACE_MAP_PREFETCHABLE;
349 nr = &sc->PCI_SC_DEVICESC(device, 349 nr = &sc->PCI_SC_DEVICESC(device,
350 function).c_range[i++]; 350 function).c_range[i++];
351 nr->r_offset = r->r_offset + 0x800000; 351 nr->r_offset = r->r_offset + 0x800000;
352 nr->r_size = 0x7ff000; 352 nr->r_size = 0x7ff000;
353 nr->r_flags = BUS_SPACE_MAP_LINEAR | 353 nr->r_flags = BUS_SPACE_MAP_LINEAR |
354 BUS_SPACE_MAP_PREFETCHABLE; 354 BUS_SPACE_MAP_PREFETCHABLE;
 355 } else if ((PCI_VENDOR(id) == PCI_VENDOR_SILMOTION) &&
 356 (PCI_PRODUCT(id) == PCI_PRODUCT_SILMOTION_SM502) &&
 357 (bar == 0x10)) {
 358 r->r_flags = BUS_SPACE_MAP_LINEAR |
 359 BUS_SPACE_MAP_PREFETCHABLE;
355 } 360 }
356  
357 } 361 }
358 } 362 }
359 363
360 pa.pa_iot = sc->sc_iot; 364 pa.pa_iot = sc->sc_iot;
361 pa.pa_memt = sc->sc_memt; 365 pa.pa_memt = sc->sc_memt;
362 pa.pa_dmat = sc->sc_dmat; 366 pa.pa_dmat = sc->sc_dmat;
363 pa.pa_dmat64 = sc->sc_dmat64; 367 pa.pa_dmat64 = sc->sc_dmat64;
364 pa.pa_pc = pc; 368 pa.pa_pc = pc;
365 pa.pa_bus = bus; 369 pa.pa_bus = bus;
366 pa.pa_device = device; 370 pa.pa_device = device;
367 pa.pa_function = function; 371 pa.pa_function = function;
368 pa.pa_tag = tag; 372 pa.pa_tag = tag;
369 pa.pa_id = id; 373 pa.pa_id = id;