Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jan 2018 09:45:18 +0000 (UTC)
From:      Wojciech Macek <wma@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r328080 - head/sys/powerpc/powerpc
Message-ID:  <201801170945.w0H9jIP5090022@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: wma
Date: Wed Jan 17 09:45:18 2018
New Revision: 328080
URL: https://svnweb.freebsd.org/changeset/base/328080

Log:
  PPC64: implement missing busdma ops
  
  Add missing little-endian 64-bit read and write. Since there
  is no direct ASM opcode for this, perform byte swap if
  necessary.
  
  Created by:            Wojciech Macek <wma@semihalf.com>
  Obtained from:         Semihalf
  Sponsored by:          QCM Technologies

Modified:
  head/sys/powerpc/powerpc/bus_machdep.c

Modified: head/sys/powerpc/powerpc/bus_machdep.c
==============================================================================
--- head/sys/powerpc/powerpc/bus_machdep.c	Wed Jan 17 09:36:48 2018	(r328079)
+++ head/sys/powerpc/powerpc/bus_machdep.c	Wed Jan 17 09:45:18 2018	(r328080)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/ktr.h>
 #include <vm/vm.h>
 #include <vm/pmap.h>
+#include <sys/endian.h>
 
 #include <machine/bus.h>
 #include <machine/pio.h>
@@ -333,6 +334,7 @@ bs_be_ws_8(bus_space_handle_t bsh, bus_size_t ofs, uin
 	addr = __ppc_ba(bsh, ofs);
 	*addr = val;
 	powerpc_iomb();
+	CTR4(KTR_BE_IO, "%s(bsh=%#x, ofs=%#x, val=%#x)", __func__, bsh, ofs, val);
 }
 
 static void
@@ -532,7 +534,14 @@ bs_le_rs_4(bus_space_handle_t bsh, bus_size_t ofs)
 static uint64_t
 bs_le_rs_8(bus_space_handle_t bsh, bus_size_t ofs)
 {
-	TODO;
+	volatile uint64_t *addr;
+	uint64_t res;
+
+	addr = __ppc_ba(bsh, ofs);
+	res = le64toh(*addr);
+	powerpc_iomb();
+	CTR4(KTR_LE_IO, "%s(bsh=%#x, ofs=%#x) = %#x", __func__, bsh, ofs, res);
+	return (res);
 }
 
 static void
@@ -631,7 +640,12 @@ bs_le_ws_4(bus_space_handle_t bsh, bus_size_t ofs, uin
 static void
 bs_le_ws_8(bus_space_handle_t bsh, bus_size_t ofs, uint64_t val)
 {
-	TODO;
+	volatile uint64_t *addr;
+
+	addr = __ppc_ba(bsh, ofs);
+	*addr = htole64(val);
+	powerpc_iomb();
+	CTR4(KTR_LE_IO, "%s(bsh=%#x, ofs=%#x, val=%#x)", __func__, bsh, ofs, val);
 }
 
 static void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801170945.w0H9jIP5090022>