xref: /netbsd-src/sys/arch/vax/include/vsbus.h (revision 9f13cfae40d7c87f5ef2c15d6731b210f6984e47)
1 /*	$NetBSD: vsbus.h,v 1.21 2022/12/12 18:22:32 jakllsch Exp $ */
2 /*
3  * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
4  * All rights reserved.
5  *
6  * This code is derived from software contributed to Ludd by Bertram Barth.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 /*
30  * Generic definitions for the (virtual) vsbus. contains common info
31  * used by all VAXstations.
32  */
33 
34 #ifndef _VAX_VSBUS_H_
35 #define _VAX_VSBUS_H_
36 
37 #include <machine/bus.h>
38 #include <machine/sgmap.h>
39 
40 struct	vsbus_attach_args {
41 	vaddr_t	va_addr;		/* virtual CSR address */
42 	paddr_t	va_paddr;		/* physical CSR address */
43 	short	va_br;			/* Interrupt level */
44 	short	va_cvec;		/* Interrupt vector address */
45 	u_char	va_maskno;		/* Interrupt vector in mask */
46 	vaddr_t	va_dmaaddr;		/* DMA area address */
47 	vsize_t	va_dmasize;		/* DMA area size */
48 	bus_space_tag_t va_memt;
49 	bus_dma_tag_t va_dmat;
50 };
51 
52 /*
53  * Some chip addresses and constants, same on all VAXstations.
54  */
55 #define VS_CFGTST	0x20020000      /* config register */
56 #define VS_REGS         0x20080000      /* Misc CPU internal regs */
57 #define VS_REGS_KA49	0x25c00000      /* ... same, on 512KB ROM systems */
58 #define NI_ADDR         0x20090000      /* Ethernet address */
59 #define DZ_CSR          0x200a0000      /* DZ11-compatible chip csr */
60 #define DZ_CSR_KA49	0x25000000      /* ... same, on 512KB ROM systems */
61 #define VS_CLOCK        0x200b0000      /* clock chip address */
62 #define SCA_REGS        0x200c0000      /* disk device addresses */
63 #define SCA_REGS_KA49	0x26000000      /* ... same, on 512KB ROM systems */
64 #define NI_BASE         0x200e0000      /* LANCE CSRs */
65 #define NI_IOSIZE       (128 * VAX_NBPG)    /* IO address size */
66 
67 #define	KA49_SCSIMAP	0x27000000	/* KA49 SCSI SGMAP */
68 /*
69  * Small monochrome graphics framebuffer, present on all machines.
70  */
71 #define	SMADDR		0x30000000
72 #define	SMSIZE		0x20000		/* Actually 256k, only 128k used */
73 
74 struct	vsbus_softc {
75 	device_t sc_dev;
76 	volatile u_char	*sc_intmsk;	/* Mask register */
77 	volatile u_char	*sc_intclr;	/* Clear interrupt register */
78 	volatile u_char	*sc_intreq;	/* Interrupt request register */
79 	u_char	sc_mask;	/* Interrupts to enable after autoconf */
80 	vaddr_t	sc_vsregs;	/* Where the VS_REGS are mapped */
81 	vaddr_t sc_dmaaddr;	/* Mass storage virtual DMA area */
82 	vsize_t sc_dmasize;	/* Size of the DMA area */
83 
84 	bus_space_tag_t sc_iot;
85 	struct vax_bus_dma_tag sc_dmatag;
86 	struct vax_sgmap sc_sgmap;
87 };
88 
89 struct vsbus_dma {
90 	SIMPLEQ_ENTRY(vsbus_dma) vd_q;
91 	void (*vd_go)(void *);
92 	void *vd_arg;
93 };
94 
95 #ifdef _KERNEL
96 void	vsbus_dma_init(struct vsbus_softc *, unsigned ptecnt);
97 u_char	vsbus_setmask(int);
98 void	vsbus_clrintr(int);
99 void	vsbus_copytoproc(struct proc *, void *, void *, int);
100 void	vsbus_copyfromproc(struct proc *, void *, void *, int);
101 void	vsbus_dma_start(struct vsbus_dma *);
102 void	vsbus_dma_intr(void);
103 #endif
104 #endif /* _VAX_VSBUS_H_ */
105