Home | History | Annotate | Line # | Download | only in include
      1 /* $NetBSD: sysarch.h,v 1.20 2012/02/06 02:14:13 matt 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 
     52 struct alpha_fp_except_args {
     53 	fp_except mask;
     54 };
     55 
     56 struct alpha_fp_c_args {
     57 	uint64_t fp_c;
     58 };
     59 
     60 struct alpha_bus_get_window_count_args {
     61 	u_int type;
     62 	u_int count;	/* output */
     63 };
     64 
     65 struct 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 
     75 struct 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
     85 extern	u_int alpha_bus_window_count[];
     86 extern	int (*alpha_bus_get_window)(int, int,
     87 	    struct alpha_bus_space_translation *);
     88 extern	struct alpha_pci_chipset *alpha_pci_chipset;
     89 #else
     90 #include <sys/cdefs.h>
     91 
     92 struct 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
     99 int	alpha_bus_getwindows(int, struct alpha_bus_window **);
    100 int	alpha_bus_mapwindow(struct alpha_bus_window *);
    101 void	alpha_bus_unmapwindow(struct alpha_bus_window *);
    102 
    103 void	*alpha_pci_mem_map(bus_addr_t, bus_size_t, int,
    104 	    struct alpha_bus_space_translation *);
    105 void	alpha_pci_mem_unmap(struct alpha_bus_space_translation *,
    106 	    void *addr, bus_size_t);
    107 
    108 uint32_t alpha_pci_conf_read(u_int, u_int, u_int, u_int);
    109 void	alpha_pci_conf_write(u_int, u_int, u_int, u_int, uint32_t);
    110 
    111 int	sysarch(int, void *);
    112 __END_DECLS
    113 #endif /* _KERNEL */
    114 
    115 #endif /* !_ALPHA_SYSARCH_H_ */
    116