Module Name: src
Committed By: snj
Date: Tue Sep 29 23:53:14 UTC 2009
Modified Files:
src/sys/arch/x86/include [netbsd-5]: bus.h isa_machdep.h
src/sys/arch/x86/x86 [netbsd-5]: bus_space.c
Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1040):
sys/arch/x86/include/bus.h: revision 1.18
sys/arch/x86/include/isa_machdep.h: revision 1.7
sys/arch/x86/x86/bus_space.c: revision 1.21
Apply patch proposed on port-amd64/port-i386, allowing to use a 64bit
bus_addr_t on i386PAE kernels:
change bus_addr_t to be a paddr_t (so its size follows paddr_t depending
on options PAE)
remplace bus_addr_t with vaddr_t where the value is used as a virtual address.
Difference with the proposed patch: cast to uintmax_t and use %jx in
printf() as suggested by Joerg.
To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.16.10.1 src/sys/arch/x86/include/bus.h
cvs rdiff -u -r1.6 -r1.6.6.1 src/sys/arch/x86/include/isa_machdep.h
cvs rdiff -u -r1.20.4.1 -r1.20.4.2 src/sys/arch/x86/x86/bus_space.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/include/bus.h
diff -u src/sys/arch/x86/include/bus.h:1.16 src/sys/arch/x86/include/bus.h:1.16.10.1
--- src/sys/arch/x86/include/bus.h:1.16 Mon Apr 28 20:23:40 2008
+++ src/sys/arch/x86/include/bus.h Tue Sep 29 23:53:14 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: bus.h,v 1.16 2008/04/28 20:23:40 martin Exp $ */
+/* $NetBSD: bus.h,v 1.16.10.1 2009/09/29 23:53:14 snj Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -77,11 +77,11 @@
/*
* Bus address and size types
*/
-typedef u_long bus_addr_t;
-typedef u_long bus_size_t;
+typedef paddr_t bus_addr_t;
+typedef paddr_t bus_size_t;
typedef int bus_space_tag_t;
-typedef u_long bus_space_handle_t;
+typedef vaddr_t bus_space_handle_t;
int _x86_memio_map(bus_space_tag_t t, bus_addr_t addr,
bus_size_t size, int flags, bus_space_handle_t *bshp);
Index: src/sys/arch/x86/include/isa_machdep.h
diff -u src/sys/arch/x86/include/isa_machdep.h:1.6 src/sys/arch/x86/include/isa_machdep.h:1.6.6.1
--- src/sys/arch/x86/include/isa_machdep.h:1.6 Fri Jun 27 11:03:13 2008
+++ src/sys/arch/x86/include/isa_machdep.h Tue Sep 29 23:53:14 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: isa_machdep.h,v 1.6 2008/06/27 11:03:13 cegger Exp $ */
+/* $NetBSD: isa_machdep.h,v 1.6.6.1 2009/09/29 23:53:14 snj Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -202,19 +202,19 @@
* function definitions, invoked through the softc.
*/
-extern u_long atdevbase; /* kernel virtual address of "hole" */
+extern vaddr_t atdevbase; /* kernel virtual address of "hole" */
/*
* Given a kernel virtual address for some location
* in the "hole" I/O space, return a physical address.
*/
-#define ISA_PHYSADDR(v) ((void *) ((u_long)(v) - atdevbase + IOM_BEGIN))
+#define ISA_PHYSADDR(v) ((bus_addr_t)(v) - atdevbase + IOM_BEGIN)
/*
* Given a physical address in the "hole",
* return a kernel virtual address.
*/
-#define ISA_HOLE_VADDR(p) ((void *) ((u_long)(p) - IOM_BEGIN + atdevbase))
+#define ISA_HOLE_VADDR(p) ((void *) ((vaddr_t)(p) - IOM_BEGIN + atdevbase))
/*
Index: src/sys/arch/x86/x86/bus_space.c
diff -u src/sys/arch/x86/x86/bus_space.c:1.20.4.1 src/sys/arch/x86/x86/bus_space.c:1.20.4.2
--- src/sys/arch/x86/x86/bus_space.c:1.20.4.1 Wed Sep 16 03:45:45 2009
+++ src/sys/arch/x86/x86/bus_space.c Tue Sep 29 23:53:14 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_space.c,v 1.20.4.1 2009/09/16 03:45:45 snj Exp $ */
+/* $NetBSD: bus_space.c,v 1.20.4.2 2009/09/29 23:53:14 snj Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_space.c,v 1.20.4.1 2009/09/16 03:45:45 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_space.c,v 1.20.4.2 2009/09/29 23:53:14 snj Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -199,8 +199,8 @@
if (error) {
if (extent_free(ex, bpa, size, EX_NOWAIT |
(ioport_malloc_safe ? EX_MALLOCOK : 0))) {
- printf("x86_memio_map: pa 0x%lx, size 0x%lx\n",
- bpa, size);
+ printf("x86_memio_map: pa 0x%jx, size 0x%jx\n",
+ (uintmax_t)bpa, (uintmax_t)size);
printf("x86_memio_map: can't free region\n");
}
}
@@ -286,8 +286,8 @@
if (error) {
if (extent_free(iomem_ex, bpa, size, EX_NOWAIT |
(ioport_malloc_safe ? EX_MALLOCOK : 0))) {
- printf("x86_memio_alloc: pa 0x%lx, size 0x%lx\n",
- bpa, size);
+ printf("x86_memio_alloc: pa 0x%jx, size 0x%jx\n",
+ (uintmax_t)bpa, (uintmax_t)size);
printf("x86_memio_alloc: can't free region\n");
}
}
@@ -464,8 +464,9 @@
ok:
if (extent_free(ex, bpa, size,
EX_NOWAIT | (ioport_malloc_safe ? EX_MALLOCOK : 0))) {
- printf("x86_memio_unmap: %s 0x%lx, size 0x%lx\n",
- (t == X86_BUS_SPACE_IO) ? "port" : "pa", bpa, size);
+ printf("x86_memio_unmap: %s 0x%jx, size 0x%jx\n",
+ (t == X86_BUS_SPACE_IO) ? "port" : "pa",
+ (uintmax_t)bpa, (uintmax_t)size);
printf("x86_memio_unmap: can't free region\n");
}
}
@@ -510,7 +511,7 @@
bus_space_set_multi_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint8_t v, size_t c)
{
- bus_addr_t addr = h + o;
+ vaddr_t addr = h + o;
if (t == X86_BUS_SPACE_IO)
while (c--)
@@ -524,7 +525,7 @@
bus_space_set_multi_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint16_t v, size_t c)
{
- bus_addr_t addr = h + o;
+ vaddr_t addr = h + o;
BUS_SPACE_ADDRESS_SANITY(addr, uint16_t, "bus addr");
@@ -540,7 +541,7 @@
bus_space_set_multi_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint32_t v, size_t c)
{
- bus_addr_t addr = h + o;
+ vaddr_t addr = h + o;
BUS_SPACE_ADDRESS_SANITY(addr, uint32_t, "bus addr");
@@ -556,7 +557,7 @@
bus_space_set_region_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint8_t v, size_t c)
{
- bus_addr_t addr = h + o;
+ vaddr_t addr = h + o;
if (t == X86_BUS_SPACE_IO)
for (; c != 0; c--, addr++)
@@ -570,7 +571,7 @@
bus_space_set_region_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint16_t v, size_t c)
{
- bus_addr_t addr = h + o;
+ vaddr_t addr = h + o;
BUS_SPACE_ADDRESS_SANITY(addr, uint16_t, "bus addr");
@@ -586,7 +587,7 @@
bus_space_set_region_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint32_t v, size_t c)
{
- bus_addr_t addr = h + o;
+ vaddr_t addr = h + o;
BUS_SPACE_ADDRESS_SANITY(addr, uint32_t, "bus addr");
@@ -603,8 +604,8 @@
bus_size_t o1, bus_space_handle_t h2,
bus_size_t o2, size_t c)
{
- bus_addr_t addr1 = h1 + o1;
- bus_addr_t addr2 = h2 + o2;
+ vaddr_t addr1 = h1 + o1;
+ vaddr_t addr2 = h2 + o2;
if (t == X86_BUS_SPACE_IO) {
if (addr1 >= addr2) {
@@ -638,8 +639,8 @@
bus_size_t o1, bus_space_handle_t h2,
bus_size_t o2, size_t c)
{
- bus_addr_t addr1 = h1 + o1;
- bus_addr_t addr2 = h2 + o2;
+ vaddr_t addr1 = h1 + o1;
+ vaddr_t addr2 = h2 + o2;
BUS_SPACE_ADDRESS_SANITY(addr1, uint16_t, "bus addr 1");
BUS_SPACE_ADDRESS_SANITY(addr2, uint16_t, "bus addr 2");
@@ -676,8 +677,8 @@
bus_size_t o1, bus_space_handle_t h2,
bus_size_t o2, size_t c)
{
- bus_addr_t addr1 = h1 + o1;
- bus_addr_t addr2 = h2 + o2;
+ vaddr_t addr1 = h1 + o1;
+ vaddr_t addr2 = h2 + o2;
BUS_SPACE_ADDRESS_SANITY(addr1, uint32_t, "bus addr 1");
BUS_SPACE_ADDRESS_SANITY(addr2, uint32_t, "bus addr 2");