1/* $NetBSD: sysarch.h,v 1.19 2011/08/12 22:22:49 dyoung 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 *
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
32#ifndef _ALPHA_SYSARCH_H_
33#define _ALPHA_SYSARCH_H_
34
35#include <machine/bus_user.h>
36#include <machine/ieeefp.h>
37
38/*
39 * Architecture specific syscalls (ALPHA)
40 */
41
42#define	ALPHA_FPGETMASK			0
43#define	ALPHA_FPSETMASK			1
44#define	ALPHA_FPSETSTICKY		2
45#define	ALPHA_BUS_GET_WINDOW_COUNT	3
46#define	ALPHA_BUS_GET_WINDOW		4
47#define	ALPHA_PCI_CONF_READWRITE	5
48#define	ALPHA_FPGETSTICKY		6
49#define	ALPHA_GET_FP_C			7
50#define	ALPHA_SET_FP_C			8
51
52struct alpha_fp_except_args {
53	fp_except mask;
54};
55
56struct alpha_fp_c_args {
57	uint64_t fp_c;
58};
59
60struct alpha_bus_get_window_count_args {
61	u_int type;
62	u_int count;	/* output */
63};
64
65struct alpha_bus_get_window_args {
66	u_int type;
67	u_int window;
68	struct alpha_bus_space_translation *translation; /* output */
69};
70
71#define	ALPHA_BUS_TYPE_PCI_IO		0
72#define	ALPHA_BUS_TYPE_PCI_MEM		1
73#define	ALPHA_BUS_TYPE_MAX		1
74
75struct alpha_pci_conf_readwrite_args {
76	int write;
77	u_int bus;
78	u_int device;
79	u_int function;
80	u_int reg;
81	uint32_t val;
82};
83
84#ifdef _KERNEL
85extern	u_int alpha_bus_window_count[];
86extern	int (*alpha_bus_get_window)(int, int,
87	    struct alpha_bus_space_translation *);
88extern	struct alpha_pci_chipset *alpha_pci_chipset;
89#else
90#include <sys/cdefs.h>
91
92struct alpha_bus_window {
93	void *		abw_addr;
94	size_t		abw_size;
95	struct alpha_bus_space_translation abw_abst;
96};
97
98__BEGIN_DECLS
99int	alpha_bus_getwindows(int, struct alpha_bus_window **);
100int	alpha_bus_mapwindow(struct alpha_bus_window *);
101void	alpha_bus_unmapwindow(struct alpha_bus_window *);
102
103void	*alpha_pci_mem_map(bus_addr_t, bus_size_t, int,
104	    struct alpha_bus_space_translation *);
105void	alpha_pci_mem_unmap(struct alpha_bus_space_translation *,
106	    void *addr, bus_size_t);
107
108uint32_t alpha_pci_conf_read(u_int, u_int, u_int, u_int);
109void	alpha_pci_conf_write(u_int, u_int, u_int, u_int, uint32_t);
110
111int	sysarch(int, void *);
112__END_DECLS
113#endif /* _KERNEL */
114
115#endif /* !_ALPHA_SYSARCH_H_ */
116