From owner-svn-src-all@FreeBSD.ORG Thu Dec 13 21:40:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1FC0EDBA; Thu, 13 Dec 2012 21:40:12 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 04FCD8FC14; Thu, 13 Dec 2012 21:40:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBDLeBdk019752; Thu, 13 Dec 2012 21:40:11 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBDLeBhd019751; Thu, 13 Dec 2012 21:40:11 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201212132140.qBDLeBhd019751@svn.freebsd.org> From: Jim Harris Date: Thu, 13 Dec 2012 21:40:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244193 - head/sys/x86/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Dec 2012 21:40:12 -0000 Author: jimharris Date: Thu Dec 13 21:40:11 2012 New Revision: 244193 URL: http://svnweb.freebsd.org/changeset/base/244193 Log: Add bus_space_read_8 and bus_space_write_8 for amd64. Rather than trying to KASSERT for callers that invoke this on IO tags, either do nothing (for write_8) or return ~0 (for read_8). Using KASSERT here just makes bus.h too messy from both polluting bus.h with systm.h (for any number of drivers that include bus.h without first including systm.h) or ports that use bus.h directly (i.e. libpciaccess) as reported by zeising@. Also don't try to implement all of the other bus_space functions for 8 byte access since realistically only these two are needed for some devices that expose 64-bit memory-mapped registers. Put the amd64-specific functions here rather than sys/amd64/include/bus.h so that we can keep this header unified for x86, as requested by mdf@ and tijl@. Submitted by: Carl Delsey MFC after: 3 days Modified: head/sys/x86/include/bus.h Modified: head/sys/x86/include/bus.h ============================================================================== --- head/sys/x86/include/bus.h Thu Dec 13 21:39:59 2012 (r244192) +++ head/sys/x86/include/bus.h Thu Dec 13 21:40:11 2012 (r244193) @@ -130,6 +130,7 @@ #define BUS_SPACE_MAXADDR 0xFFFFFFFF #endif +#define BUS_SPACE_INVALID_DATA (~0) #define BUS_SPACE_UNRESTRICTED (~0) /* @@ -221,6 +222,12 @@ static __inline u_int32_t bus_space_read bus_space_handle_t handle, bus_size_t offset); +#ifdef __amd64__ +static __inline uint64_t bus_space_read_8(bus_space_tag_t tag, + bus_space_handle_t handle, + bus_size_t offset); +#endif + static __inline u_int8_t bus_space_read_1(bus_space_tag_t tag, bus_space_handle_t handle, bus_size_t offset) @@ -251,8 +258,16 @@ bus_space_read_4(bus_space_tag_t tag, bu return (*(volatile u_int32_t *)(handle + offset)); } -#if 0 /* Cause a link error for bus_space_read_8 */ -#define bus_space_read_8(t, h, o) !!! bus_space_read_8 unimplemented !!! +#ifdef __amd64__ +static __inline uint64_t +bus_space_read_8(bus_space_tag_t tag, bus_space_handle_t handle, + bus_size_t offset) +{ + + if (tag == X86_BUS_SPACE_IO) /* No 8 byte IO space access on x86 */ + return (BUS_SPACE_INVALID_DATA); + return (*(volatile uint64_t *)(handle + offset)); +} #endif /* @@ -479,6 +494,12 @@ static __inline void bus_space_write_4(b bus_space_handle_t bsh, bus_size_t offset, u_int32_t value); +#ifdef __amd64__ +static __inline void bus_space_write_8(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, uint64_t value); +#endif + static __inline void bus_space_write_1(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, u_int8_t value) @@ -512,8 +533,17 @@ bus_space_write_4(bus_space_tag_t tag, b *(volatile u_int32_t *)(bsh + offset) = value; } -#if 0 /* Cause a link error for bus_space_write_8 */ -#define bus_space_write_8 !!! bus_space_write_8 not implemented !!! +#ifdef __amd64__ +static __inline void +bus_space_write_8(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, uint64_t value) +{ + + if (tag == X86_BUS_SPACE_IO) /* No 8 byte IO space access on x86 */ + return; + else + *(volatile uint64_t *)(bsh + offset) = value; +} #endif /*