xref: /netbsd-src/sys/arch/amiga/dev/z3rambdvar.h (revision d2a8a7584ba8268ef7d35cab5edba6c173fee24b)
1 /*	$NetBSD: z3rambdvar.h,v 1.1 2012/11/26 22:58:24 rkujawa Exp $ */
2 
3 /*-
4  * Copyright (c) 2012 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Radoslaw Kujawa.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 #ifndef _AMIGA_Z3RAMBDVAR_H_
32 
33 #include <sys/bus.h>
34 
35 /* there are a couple of hacks that check for presence of Z3 RAM boards */
36 #define ZORRO_MANID_E3B		3643
37 #define ZORRO_PRODID_ZORRAM	32	/* BigRamPlus has the same */
38 
39 #define ZORRO_MANID_DKB		2012
40 #define ZORRO_PRODID_3128	14
41 
42 #define ZORRO_MANID_PHASE5	8512
43 #define ZORRO_PRODID_FLZ3MEM	10
44 
45 struct z3rambd_softc {
46 	device_t		sc_dev;
47 
48 	size_t			sc_size;
49 
50 	struct bus_space_tag	sc_bst;
51 
52 	bus_space_tag_t		sc_iot;
53 	bus_space_handle_t	sc_ioh;
54 
55 	void			*sc_va;
56 };
57 
58 inline int z3rambd_match_id(uint16_t, uint8_t);
59 
60 inline int
z3rambd_match_id(uint16_t manid,uint8_t prodid)61 z3rambd_match_id(uint16_t manid, uint8_t prodid)
62 {
63 	if (manid == ZORRO_MANID_E3B)
64 		if (prodid == ZORRO_PRODID_ZORRAM)
65 			return 1;
66 
67 	if (manid == ZORRO_MANID_DKB)
68 		if (prodid == ZORRO_PRODID_3128)
69 			return 1;
70 
71 	if (manid == ZORRO_MANID_PHASE5)
72 		if (prodid == ZORRO_PRODID_FLZ3MEM)
73 			return 1;
74 
75 	return 0;
76 }
77 
78 #endif /* _AMIGA_Z3RAMBDVAR_H_ */
79 
80