Sun Mar 8 10:28:17 2020 UTC ()
Pull up following revision(s) (requested by is in ticket #760):

	sys/arch/amiga/dev/gayle_pcmcia.c: revision 1.32
	sys/arch/amigappc/include/bus_defs.h: revision 1.8

The Gayle interface uses swapped (little-endian) word accesses, so we
need to use the amiga_bus_stride_1swap methods for the word accesses.

Analyzed and submitted via port-amiga@ by Martin �berg.

Tested on formerly working hardware
- by Jukka Andberg	with Dlink DE-660+		(ne)
- by Frank Wille	with D-Link DFE-670TXD		(ne)

Tested on formerly not working hardware:
- by Martin		with 3Com 3c589 Etherling III	(ep)
- by Martin and Frank	with CompactFlash cards		(wdc)

 -

gayle wants stride_1swap now, so declare the rest of the bus methods since
we already define them anyway.


(martin)
diff -r1.31 -r1.31.22.1 src/sys/arch/amiga/dev/gayle_pcmcia.c
diff -r1.6 -r1.6.34.1 src/sys/arch/amigappc/include/bus_defs.h

cvs diff -r1.31 -r1.31.22.1 src/sys/arch/amiga/dev/gayle_pcmcia.c (expand / switch to unified diff)

--- src/sys/arch/amiga/dev/gayle_pcmcia.c 2015/02/08 09:55:25 1.31
+++ src/sys/arch/amiga/dev/gayle_pcmcia.c 2020/03/08 10:28:16 1.31.22.1
@@ -1,19 +1,19 @@ @@ -1,19 +1,19 @@
1/* $NetBSD: gayle_pcmcia.c,v 1.31 2015/02/08 09:55:25 jandberg Exp $ */ 1/* $NetBSD: gayle_pcmcia.c,v 1.31.22.1 2020/03/08 10:28:16 martin Exp $ */
2 2
3/* public domain */ 3/* public domain */
4 4
5#include <sys/cdefs.h> 5#include <sys/cdefs.h>
6__KERNEL_RCSID(0, "$NetBSD: gayle_pcmcia.c,v 1.31 2015/02/08 09:55:25 jandberg Exp $"); 6__KERNEL_RCSID(0, "$NetBSD: gayle_pcmcia.c,v 1.31.22.1 2020/03/08 10:28:16 martin Exp $");
7 7
8/* PCMCIA front-end driver for A1200's and A600's. */ 8/* PCMCIA front-end driver for A1200's and A600's. */
9 9
10#include <sys/param.h> 10#include <sys/param.h>
11#include <sys/device.h> 11#include <sys/device.h>
12#include <sys/kernel.h> 12#include <sys/kernel.h>
13#include <sys/kthread.h> 13#include <sys/kthread.h>
14#include <sys/systm.h> 14#include <sys/systm.h>
15 15
16#include <uvm/uvm.h> 16#include <uvm/uvm.h>
17 17
18#include <dev/pcmcia/pcmciareg.h> 18#include <dev/pcmcia/pcmciareg.h>
19#include <dev/pcmcia/pcmciavar.h> 19#include <dev/pcmcia/pcmciavar.h>
@@ -121,27 +121,27 @@ pccard_attach(device_t parent, device_t  @@ -121,27 +121,27 @@ pccard_attach(device_t parent, device_t
121 0, UVM_KMF_VAONLY | UVM_KMF_NOWAIT); 121 0, UVM_KMF_VAONLY | UVM_KMF_NOWAIT);
122 if (pcmcia_base == 0) { 122 if (pcmcia_base == 0) {
123 printf("attach failed (no virtual memory)\n"); 123 printf("attach failed (no virtual memory)\n");
124 return; 124 return;
125 } 125 }
126 126
127 for (i = GAYLE_PCMCIA_START; i < GAYLE_PCMCIA_END; i += PAGE_SIZE) 127 for (i = GAYLE_PCMCIA_START; i < GAYLE_PCMCIA_END; i += PAGE_SIZE)
128 pmap_enter(vm_map_pmap(kernel_map), 128 pmap_enter(vm_map_pmap(kernel_map),
129 i - GAYLE_PCMCIA_START + pcmcia_base, i, 129 i - GAYLE_PCMCIA_START + pcmcia_base, i,
130 VM_PROT_READ | VM_PROT_WRITE, true); 130 VM_PROT_READ | VM_PROT_WRITE, true);
131 pmap_update(vm_map_pmap(kernel_map)); 131 pmap_update(vm_map_pmap(kernel_map));
132 132
133 /* override the one-byte access methods for I/O space */ 133 /* override the one-byte access methods for I/O space */
134 pcmio_bs_methods = amiga_bus_stride_1; 134 pcmio_bs_methods = amiga_bus_stride_1swap;
135 pcmio_bs_methods.bsr1 = pcmio_bsr1; 135 pcmio_bs_methods.bsr1 = pcmio_bsr1;
136 pcmio_bs_methods.bsw1 = pcmio_bsw1; 136 pcmio_bs_methods.bsw1 = pcmio_bsw1;
137 pcmio_bs_methods.bsrm1 = pcmio_bsrm1; 137 pcmio_bs_methods.bsrm1 = pcmio_bsrm1;
138 pcmio_bs_methods.bswm1 = pcmio_bswm1; 138 pcmio_bs_methods.bswm1 = pcmio_bswm1;
139 pcmio_bs_methods.bsrr1 = pcmio_bsrr1; 139 pcmio_bs_methods.bsrr1 = pcmio_bsrr1;
140 pcmio_bs_methods.bswr1 = pcmio_bswr1; 140 pcmio_bs_methods.bswr1 = pcmio_bswr1;
141 pcmio_bs_methods.bssr1 = pcmio_bssr1; 141 pcmio_bs_methods.bssr1 = pcmio_bssr1;
142 pcmio_bs_methods.bscr1 = pcmio_bscr1; 142 pcmio_bs_methods.bscr1 = pcmio_bscr1;
143 143
144 reset_card_reg = (u_int8_t *) pcmcia_base + 144 reset_card_reg = (u_int8_t *) pcmcia_base +
145 (GAYLE_PCMCIA_RESET - GAYLE_PCMCIA_START); 145 (GAYLE_PCMCIA_RESET - GAYLE_PCMCIA_START);
146 146
147 sc->io_space.base = (bus_addr_t) pcmcia_base + 147 sc->io_space.base = (bus_addr_t) pcmcia_base +

cvs diff -r1.6 -r1.6.34.1 src/sys/arch/amigappc/include/bus_defs.h (expand / switch to unified diff)

--- src/sys/arch/amigappc/include/bus_defs.h 2014/01/22 00:24:53 1.6
+++ src/sys/arch/amigappc/include/bus_defs.h 2020/03/08 10:28:16 1.6.34.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bus_defs.h,v 1.6 2014/01/22 00:24:53 christos Exp $ */ 1/* $NetBSD: bus_defs.h,v 1.6.34.1 2020/03/08 10:28:16 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 Leo Weppelman. All rights reserved. 4 * Copyright (c) 1996 Leo Weppelman. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -161,20 +161,23 @@ struct amiga_bus_space_methods { @@ -161,20 +161,23 @@ struct amiga_bus_space_methods {
161 bswm(*bswrs4, uint32_t); 161 bswm(*bswrs4, uint32_t);
162 bssr(*bssr4, uint32_t); 162 bssr(*bssr4, uint32_t);
163 bscr(*bscr4, uint32_t); 163 bscr(*bscr4, uint32_t);
164}; 164};
165 165
166#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */ 166#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */
167#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */ 167#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */
168 168
169#define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t) 169#define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t)
170 170
171#define __BUS_SPACE_HAS_STREAM_METHODS 171#define __BUS_SPACE_HAS_STREAM_METHODS
172 172
173extern const struct amiga_bus_space_methods amiga_bus_stride_1; 173extern const struct amiga_bus_space_methods amiga_bus_stride_1;
 174extern const struct amiga_bus_space_methods amiga_bus_stride_1swap;
 175extern const struct amiga_bus_space_methods amiga_bus_stride_1swap_abs;
174extern const struct amiga_bus_space_methods amiga_bus_stride_2; 176extern const struct amiga_bus_space_methods amiga_bus_stride_2;
175extern const struct amiga_bus_space_methods amiga_bus_stride_4; 177extern const struct amiga_bus_space_methods amiga_bus_stride_4;
176extern const struct amiga_bus_space_methods amiga_bus_stride_4swap; 178extern const struct amiga_bus_space_methods amiga_bus_stride_4swap;
177extern const struct amiga_bus_space_methods amiga_bus_stride_16; 179extern const struct amiga_bus_space_methods amiga_bus_stride_16;
178extern const struct amiga_bus_space_methods amiga_bus_stride_0x1000; 180extern const struct amiga_bus_space_methods amiga_bus_stride_0x1000;
 181extern const struct amiga_bus_space_methods amiga_bus_stride_0x4000;
179 182
180#endif /* _AMIGAPPC_BUS_DEFS_H_ */ 183#endif /* _AMIGAPPC_BUS_DEFS_H_ */