Thu Mar 10 00:14:25 2022 UTC ()
gffb(4): Use bus_space_barrier, not membar_sync.


(riastradh)
diff -r1.17 -r1.18 src/sys/dev/pci/gffb.c

cvs diff -r1.17 -r1.18 src/sys/dev/pci/gffb.c (expand / switch to unified diff)

--- src/sys/dev/pci/gffb.c 2021/08/07 16:19:14 1.17
+++ src/sys/dev/pci/gffb.c 2022/03/10 00:14:25 1.18
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: gffb.c,v 1.17 2021/08/07 16:19:14 thorpej Exp $ */ 1/* $NetBSD: gffb.c,v 1.18 2022/03/10 00:14:25 riastradh Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2013 Michael Lorenz 4 * Copyright (c) 2013 Michael Lorenz
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28/* 28/*
29 * A console driver for nvidia geforce graphics controllers 29 * A console driver for nvidia geforce graphics controllers
30 * tested on macppc only so far, should work on other hardware as long as 30 * tested on macppc only so far, should work on other hardware as long as
31 * something sets up a usable graphics mode and sets the right device properties 31 * something sets up a usable graphics mode and sets the right device properties
32 * This driver should work with all NV1x hardware but so far it's been tested 32 * This driver should work with all NV1x hardware but so far it's been tested
33 * only on NV11 / GeForce2 MX. Needs testing with more hardware and if 33 * only on NV11 / GeForce2 MX. Needs testing with more hardware and if
34 * successful, PCI IDs need to be added to gffb_match() 34 * successful, PCI IDs need to be added to gffb_match()
35 */ 35 */
36 36
37#include <sys/cdefs.h> 37#include <sys/cdefs.h>
38__KERNEL_RCSID(0, "$NetBSD: gffb.c,v 1.17 2021/08/07 16:19:14 thorpej Exp $"); 38__KERNEL_RCSID(0, "$NetBSD: gffb.c,v 1.18 2022/03/10 00:14:25 riastradh Exp $");
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/systm.h> 41#include <sys/systm.h>
42#include <sys/kernel.h> 42#include <sys/kernel.h>
43#include <sys/device.h> 43#include <sys/device.h>
44#include <sys/malloc.h> 44#include <sys/malloc.h>
45#include <sys/lwp.h> 45#include <sys/lwp.h>
46#include <sys/kauth.h> 46#include <sys/kauth.h>
47#include <sys/atomic.h> 47#include <sys/atomic.h>
48 48
49#include <dev/pci/pcivar.h> 49#include <dev/pci/pcivar.h>
50#include <dev/pci/pcireg.h> 50#include <dev/pci/pcireg.h>
51#include <dev/pci/pcidevs.h> 51#include <dev/pci/pcidevs.h>
@@ -674,30 +674,32 @@ gffb_putpalreg(struct gffb_softc *sc, ui @@ -674,30 +674,32 @@ gffb_putpalreg(struct gffb_softc *sc, ui
674 bus_space_write_1(sc->sc_memt, sc->sc_regh, 674 bus_space_write_1(sc->sc_memt, sc->sc_regh,
675 GFFB_PDIO1 + GFFB_PEL_D, b); 675 GFFB_PDIO1 + GFFB_PEL_D, b);
676 676
677 return 0; 677 return 0;
678} 678}
679 679
680 680
681static void 681static void
682gffb_dma_kickoff(struct gffb_softc *sc) 682gffb_dma_kickoff(struct gffb_softc *sc)
683{ 683{
684 684
685 if (sc->sc_current != sc->sc_put) { 685 if (sc->sc_current != sc->sc_put) {
686 sc->sc_put = sc->sc_current; 686 sc->sc_put = sc->sc_current;
687 membar_sync(); 687 bus_space_barrier(sc->sc_memt, sc->sc_fbh, 0, 0x1000000,
 688 BUS_SPACE_BARRIER_WRITE);
688 (void)*sc->sc_fbaddr; 689 (void)*sc->sc_fbaddr;
689 GFFB_WRITE_4(GFFB_FIFO_PUT, sc->sc_put); 690 GFFB_WRITE_4(GFFB_FIFO_PUT, sc->sc_put);
690 membar_sync(); 691 bus_space_barrier(sc->sc_memt, sc->sc_regh, GFFB_FIFO_PUT, 4,
 692 BUS_SPACE_BARRIER_WRITE);
691 } 693 }
692} 694}
693 695
694static void 696static void
695gffb_dmanext(struct gffb_softc *sc, uint32_t data) 697gffb_dmanext(struct gffb_softc *sc, uint32_t data)
696{ 698{
697 bus_space_write_stream_4(sc->sc_memt, sc->sc_fbh, sc->sc_current, data); 699 bus_space_write_stream_4(sc->sc_memt, sc->sc_fbh, sc->sc_current, data);
698 sc->sc_current += 4; 700 sc->sc_current += 4;
699} 701}
700 702
701static void 703static void
702gffb_dmastart(struct gffb_softc *sc, uint32_t tag, int size) 704gffb_dmastart(struct gffb_softc *sc, uint32_t tag, int size)
703{ 705{