Index: sys/arch/sparc64/conf/GENERIC.DEBUG =================================================================== RCS file: /cvsroot/src/sys/arch/sparc64/conf/GENERIC.DEBUG,v retrieving revision 1.2 diff -u -r1.2 GENERIC.DEBUG --- sys/arch/sparc64/conf/GENERIC.DEBUG 26 Dec 2011 19:33:20 -0000 1.2 +++ sys/arch/sparc64/conf/GENERIC.DEBUG 5 Jun 2015 19:08:41 -0000 @@ -14,3 +14,5 @@ options DB_MAX_WIDTH=160 options DDB_ONPANIC=2 # print stack trace + +options BUS_SPACE_DEBUG Index: sys/arch/sparc64/include/bus_funcs.h =================================================================== RCS file: /cvsroot/src/sys/arch/sparc64/include/bus_funcs.h,v retrieving revision 1.3 diff -u -r1.3 bus_funcs.h --- sys/arch/sparc64/include/bus_funcs.h 14 Jul 2014 12:40:38 -0000 1.3 +++ sys/arch/sparc64/include/bus_funcs.h 5 Jun 2015 19:08:41 -0000 @@ -169,41 +169,7 @@ #define bus_space_read_8(t, h, o) \ (0 ? (t)->type : ldxa((h)._ptr + (o), (h)._asi)) #else -#define bus_space_read_1(t, h, o) ({ \ - uint8_t __bv = \ - lduba((h)._ptr + (o), (h)._asi); \ - if (bus_space_debug & BSDB_ACCESS) \ - printf("bsr1(%llx + %llx, %x) -> %x\n", (long long)(h)._ptr, \ - (long long)(o), \ - (h)._asi, (uint32_t) __bv); \ - __bv; }) -#define bus_space_read_2(t, h, o) ({ \ - uint16_t __bv = \ - lduha((h)._ptr + (o), (h)._asi); \ - if (bus_space_debug & BSDB_ACCESS) \ - printf("bsr2(%llx + %llx, %x) -> %x\n", (long long)(h)._ptr, \ - (long long)(o), \ - (h)._asi, (uint32_t)__bv); \ - __bv; }) - -#define bus_space_read_4(t, h, o) ({ \ - uint32_t __bv = \ - lda((h)._ptr + (o), (h)._asi); \ - if (bus_space_debug & BSDB_ACCESS) \ - printf("bsr4(%llx + %llx, %x) -> %x\n", (long long)(h)._ptr, \ - (long long)(o), \ - (h)._asi, __bv); \ - __bv; }) - -#define bus_space_read_8(t, h, o) ({ \ - uint64_t __bv = \ - ldxa((h)._ptr + (o), (h)._asi); \ - if (bus_space_debug & BSDB_ACCESS) \ - printf("bsr8(%llx + %llx, %x) -> %llx\n", (long long)(h)._ptr, \ - (long long)(o), \ - (h)._asi, (long long)__bv); \ - __bv; }) #endif /* * void bus_space_write_N(bus_space_tag_t tag, @@ -226,33 +192,6 @@ #define bus_space_write_8(t, h, o, v) \ (0 ? (t)->type : ((void)(stxa((h)._ptr + (o), (h)._asi, (v))))) #else -#define bus_space_write_1(t, h, o, v) ({ \ - if (bus_space_debug & BSDB_ACCESS) \ - printf("bsw1(%llx + %llx, %x) <- %x\n", (long long)(h)._ptr, \ - (long long)(o), \ - (h)._asi, (uint32_t) v); \ - ((void)(stba((h)._ptr + (o), (h)._asi, (v)))); }) - -#define bus_space_write_2(t, h, o, v) ({ \ - if (bus_space_debug & BSDB_ACCESS) \ - printf("bsw2(%llx + %llx, %x) <- %x\n", (long long)(h)._ptr, \ - (long long)(o), \ - (h)._asi, (uint32_t) v); \ - ((void)(stha((h)._ptr + (o), (h)._asi, (v)))); }) - -#define bus_space_write_4(t, h, o, v) ({ \ - if (bus_space_debug & BSDB_ACCESS) \ - printf("bsw4(%llx + %llx, %x) <- %x\n", (long long)(h)._ptr, \ - (long long)(o), \ - (h)._asi, (uint32_t) v); \ - ((void)(sta((h)._ptr + (o), (h)._asi, (v)))); }) - -#define bus_space_write_8(t, h, o, v) ({ \ - if (bus_space_debug & BSDB_ACCESS) \ - printf("bsw8(%llx + %llx, %x) <- %llx\n", (long long)(h)._ptr, \ - (long long)(o), \ - (h)._asi, (long long) v); \ - ((void)(stxa((h)._ptr + (o), (h)._asi, (v)))); }) #endif /* * uintN_t bus_space_read_stream_N(bus_space_tag_t tag, @@ -275,6 +214,7 @@ (0 ? (t)->type : ldxa((h)._ptr + (o), (h)._sasi)) #else #define bus_space_read_stream_1(t, h, o) ({ \ + (void)t; \ uint8_t __bv = \ lduba((h)._ptr + (o), (h)._sasi); \ if (bus_space_debug & BSDB_ACCESS) \ @@ -284,6 +224,7 @@ __bv; }) #define bus_space_read_stream_2(t, h, o) ({ \ + (void)t; \ uint16_t __bv = \ lduha((h)._ptr + (o), (h)._sasi); \ if (bus_space_debug & BSDB_ACCESS) \ @@ -293,6 +234,7 @@ __bv; }) #define bus_space_read_stream_4(t, h, o) ({ \ + (void)t; \ uint32_t __bv = \ lda((h)._ptr + (o), (h)._sasi); \ if (bus_space_debug & BSDB_ACCESS) \ @@ -302,6 +244,7 @@ __bv; }) #define bus_space_read_stream_8(t, h, o) ({ \ + (void)t; \ uint64_t __bv = \ ldxa((h)._ptr + (o), (h)._sasi); \ if (bus_space_debug & BSDB_ACCESS) \ @@ -332,31 +275,35 @@ (0 ? (t)->type : ((void)(stxa((h)._ptr + (o), (h)._sasi, (v))))) #else #define bus_space_write_stream_1(t, h, o, v) ({ \ + (void)t; \ if (bus_space_debug & BSDB_ACCESS) \ printf("bsw1(%llx + %llx, %x) <- %x\n", (long long)(h)._ptr, \ (long long)(o), \ - (h)._sasi, (uint32_t) v); \ + (h)._sasi, (uint32_t)(v)); \ ((void)(stba((h)._ptr + (o), (h)._sasi, (v)))); }) #define bus_space_write_stream_2(t, h, o, v) ({ \ + (void)t; \ if (bus_space_debug & BSDB_ACCESS) \ printf("bsw2(%llx + %llx, %x) <- %x\n", (long long)(h)._ptr, \ (long long)(o), \ - (h)._sasi, (uint32_t) v); \ + (h)._sasi, (uint32_t)(v)); \ ((void)(stha((h)._ptr + (o), (h)._sasi, (v)))); }) #define bus_space_write_stream_4(t, h, o, v) ({ \ + (void)t; \ if (bus_space_debug & BSDB_ACCESS) \ printf("bsw4(%llx + %llx, %x) <- %x\n", (long long)(h)._ptr, \ (long long)(o), \ - (h)._sasi, (uint32_t) v); \ + (h)._sasi, (uint32_t)(v)); \ ((void)(sta((h)._ptr + (o), (h)._sasi, (v)))); }) #define bus_space_write_stream_8(t, h, o, v) ({ \ + (void)t; \ if (bus_space_debug & BSDB_ACCESS) \ printf("bsw8(%llx + %llx, %x) <- %llx\n", (long long)(h)._ptr, \ (long long)(o), \ - (h)._sasi, (long long) v); \ + (h)._sasi, (long long)(v)); \ ((void)(stxa((h)._ptr + (o), (h)._sasi, (v)))); }) #endif /* Forwards needed by prototypes below. */ Index: sys/arch/sparc64/sparc64/machdep.c =================================================================== RCS file: /cvsroot/src/sys/arch/sparc64/sparc64/machdep.c,v retrieving revision 1.281 diff -u -r1.281 machdep.c --- sys/arch/sparc64/sparc64/machdep.c 15 Mar 2015 10:38:58 -0000 1.281 +++ sys/arch/sparc64/sparc64/machdep.c 5 Jun 2015 19:08:42 -0000 @@ -2217,6 +2217,108 @@ return (EINVAL); } +#ifdef BUS_SPACE_DEBUG + +uint8_t bus_space_read_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) +{ + (void)t; + if (bus_space_debug & BSDB_ACCESS) + printf("bsr1(%llx + %llx, %x)", (long long)(h)._ptr, + (long long)(o), + (h)._asi ); + uint8_t __bv = + lduba((h)._ptr + (o), (h)._asi); + if (bus_space_debug & BSDB_ACCESS) + printf(" -> %x\n", __bv); + return __bv; +} + +uint16_t bus_space_read_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) +{ + (void)t; + if (bus_space_debug & BSDB_ACCESS) + printf("bsr2(%llx + %llx, %x)", (long long)(h)._ptr, + (long long)(o), + (h)._asi); + uint16_t __bv = + lduha((h)._ptr + (o), (h)._asi); + if (bus_space_debug & BSDB_ACCESS) + printf(" -> %x\n", (uint32_t)__bv); + return __bv; +} + +uint32_t bus_space_read_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) +{ + (void)t; + if (bus_space_debug & BSDB_ACCESS) + printf("bsr4(%llx + %llx, %x)", (long long)(h)._ptr, + (long long)(o), + (h)._asi); + uint32_t __bv = + lda((h)._ptr + (o), (h)._asi); + if (bus_space_debug & BSDB_ACCESS) + printf(" -> %x\n", __bv); + return __bv; +} + +uint64_t bus_space_read_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) +{ + (void)t; + if (bus_space_debug & BSDB_ACCESS) + printf("bsr8(%llx + %llx, %x)", (long long)(h)._ptr, + (long long)(o), + (h)._asi); + uint64_t __bv = + ldxa((h)._ptr + (o), (h)._asi); + if (bus_space_debug & BSDB_ACCESS) + printf(" -> %llx\n", (long long)__bv); + return __bv; +} + +void bus_space_write_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, uint8_t v) +{ + (void)t; + if (bus_space_debug & BSDB_ACCESS) + printf("bsw1(%llx + %llx, %x) <- %x\n", (long long)(h)._ptr, + (long long)(o), + (h)._asi, (uint32_t)(v)); + ((void)(stba((h)._ptr + (o), (h)._asi, (v)))); +} + +void bus_space_write_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, uint16_t v) +{ + (void)t; + if (bus_space_debug & BSDB_ACCESS) + printf("bsw2(%llx + %llx, %x) <- %x\n", (long long)(h)._ptr, + (long long)(o), + (h)._asi, (uint32_t)(v)); + ((void)(stha((h)._ptr + (o), (h)._asi, (v)))); +} + +void bus_space_write_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, uint32_t v) +{ + (void)t; + if (bus_space_debug & BSDB_ACCESS) + printf("bsw4(%llx + %llx, %x) <- %x\n", (long long)(h)._ptr, + (long long)(o), + (h)._asi, (uint32_t)(v)); + ((void)(sta((h)._ptr + (o), (h)._asi, (v)))); +} + +void bus_space_write_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, uint64_t v) +{ + (void)t; + if (bus_space_debug & BSDB_ACCESS) + printf("bsw8(%llx + %llx, %x) <- %llx\n", (long long)(h)._ptr, + (long long)(o), + (h)._asi, (long long)(v)); + ((void)(stxa((h)._ptr + (o), (h)._asi, (v)))); +} + + +#endif + + int sparc_bus_map(bus_space_tag_t t, bus_addr_t addr, bus_size_t size, int flags, vaddr_t unused, bus_space_handle_t *hp) @@ -2235,7 +2337,6 @@ (u_long)IODEV_BASE, (u_long)IODEV_END, 0, 0, EX_NOWAIT); - size = round_page(size); if (size == 0) { printf("sparc_bus_map: zero size\n");