xref: /netbsd/sys/arch/alpha/include/sysarch.h (revision bf9ec67e)
1 /* $NetBSD: sysarch.h,v 1.9 2002/01/14 00:53:16 thorpej Exp $ */
2 
3 /*-
4  * Copyright (c) 2000 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Jason R. Thorpe.
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  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *	This product includes software developed by the NetBSD
21  *	Foundation, Inc. and its contributors.
22  * 4. Neither the name of The NetBSD Foundation nor the names of its
23  *    contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 #ifndef _ALPHA_SYSARCH_H_
40 #define _ALPHA_SYSARCH_H_
41 
42 #include <machine/bus.h>
43 #include <machine/ieeefp.h>
44 
45 /*
46  * Architecture specific syscalls (ALPHA)
47  */
48 
49 #define	ALPHA_FPGETMASK			0
50 #define	ALPHA_FPSETMASK			1
51 #define	ALPHA_FPSETSTICKY		2
52 #define	ALPHA_BUS_GET_WINDOW_COUNT	3
53 #define	ALPHA_BUS_GET_WINDOW		4
54 #define	ALPHA_PCI_CONF_READWRITE	5
55 #define	ALPHA_FPGETSTICKY		6
56 #define	ALPHA_GET_FP_C			7
57 #define	ALPHA_SET_FP_C			8
58 
59 struct alpha_fp_except_args {
60 	fp_except mask;
61 };
62 
63 struct alpha_fp_c_args {
64 	uint64_t fp_c;
65 };
66 
67 struct alpha_bus_get_window_count_args {
68 	u_int type;
69 	u_int count;	/* output */
70 };
71 
72 struct alpha_bus_get_window_args {
73 	u_int type;
74 	u_int window;
75 	struct alpha_bus_space_translation *translation; /* output */
76 };
77 
78 #define	ALPHA_BUS_TYPE_PCI_IO		0
79 #define	ALPHA_BUS_TYPE_PCI_MEM		1
80 #define	ALPHA_BUS_TYPE_MAX		1
81 
82 struct alpha_pci_conf_readwrite_args {
83 	int write;
84 	u_int bus;
85 	u_int device;
86 	u_int function;
87 	u_int reg;
88 	u_int32_t val;
89 };
90 
91 #ifdef _KERNEL
92 extern	u_int alpha_bus_window_count[];
93 extern	int (*alpha_bus_get_window)(int, int,
94 	    struct alpha_bus_space_translation *);
95 extern	struct alpha_pci_chipset *alpha_pci_chipset;
96 #else
97 struct alpha_bus_window {
98 	caddr_t		abw_addr;
99 	size_t		abw_size;
100 	struct alpha_bus_space_translation abw_abst;
101 };
102 
103 int	alpha_bus_getwindows(int, struct alpha_bus_window **);
104 int	alpha_bus_mapwindow(struct alpha_bus_window *);
105 void	alpha_bus_unmapwindow(struct alpha_bus_window *);
106 
107 void	*alpha_pci_mem_map(bus_addr_t, bus_size_t, int,
108 	    struct alpha_bus_space_translation *);
109 void	alpha_pci_mem_unmap(struct alpha_bus_space_translation *,
110 	    void *addr, bus_size_t);
111 
112 u_int32_t alpha_pci_conf_read(u_int, u_int, u_int, u_int);
113 void	alpha_pci_conf_write(u_int, u_int, u_int, u_int, u_int32_t);
114 
115 int	sysarch(int, void *);
116 #endif /* _KERNEL */
117 
118 #endif /* !_ALPHA_SYSARCH_H_ */
119