summaryrefslogtreecommitdiff
path: root/sys/arch/alpha/include/pio.h
blob: 9fd16f4af209d404e99061ce2395d6c5d340df3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*	$NetBSD: pio.h,v 1.1 1995/06/28 01:16:33 cgd Exp $	*/

/*
 * Copyright (c) 1995 Carnegie-Mellon University.
 * All rights reserved.
 *
 * Author: Chris G. Demetriou
 * 
 * Permission to use, copy, modify and distribute this software and
 * its documentation is hereby granted, provided that both the copyright
 * notice and this permission notice appear in all copies of the
 * software, derivative works or modified versions, and any portions
 * thereof, and that both notices appear in supporting documentation.
 * 
 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 
 * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 
 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
 * 
 * Carnegie Mellon requests users of this software to return to
 *
 *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
 *  School of Computer Science
 *  Carnegie Mellon University
 *  Pittsburgh PA 15213-3890
 *
 * any improvements or extensions that they make and grant Carnegie the
 * rights to redistribute these changes.
 */

/* Prototypes for ISA-ish I/O space access functions. */

/*
 * XXX
 * XXX THIS WILL LIKELY HAVE TO BE COMPLETELY CHANGED.
 * XXX e.g. to take softc for bus.
 * XXX
 */

struct	isa_pio_fcns {
	/* input functions */
	u_int8_t	(*isa_inb) __P((int port));
	void		(*isa_insb) __P((int port, void *addr, int cnt));
	u_int16_t	(*isa_inw) __P((int port));
	void		(*isa_insw) __P((int port, void *addr, int cnt));
	u_int32_t	(*isa_inl) __P((int port));
	void		(*isa_insl) __P((int port, void *addr, int cnt));

	/* output functions */
	void		(*isa_outb) __P((int port, u_int8_t datum));
	void		(*isa_outsb) __P((int port, void *addr, int cnt));
	void		(*isa_outw) __P((int port, u_int16_t datum));
	void		(*isa_outsw) __P((int port, void *addr, int cnt));
	void		(*isa_outl) __P((int port, u_int32_t datum));
	void		(*isa_outsl) __P((int port, void *addr, int cnt));
};

/*
 * Global which tells which set of functions are correct
 * for this machine.
 */
struct isa_pio_fcns *isa_pio_fcns;

/*
 * Individual chipsets' versions.
 */
extern struct isa_pio_fcns apecs_pio_fcns;
extern struct isa_pio_fcns jensen_pio_fcns;


/*
 * macros to use input functions
 */
#define	inb(p)		(*isa_pio_fcns->isa_inb)(p)
#define	insb(p, a, c)	(*isa_pio_fcns->isa_insb)(p, a, c)
#define	inw(p)		(*isa_pio_fcns->isa_inw)(p)
#define	insw(p, a, c)	(*isa_pio_fcns->isa_insw)(p, a, c)
#define	inl(p)		(*isa_pio_fcns->isa_inl)(p)
#define	insl(p, a, c)	(*isa_pio_fcns->isa_insl)(p, a, c)

/*
 * macros to use output functions
 */
#define	outb(p, d)	(*isa_pio_fcns->isa_outb)(p, d)
#define	outsb(p, a, c)	(*isa_pio_fcns->isa_outsb)(p, a, c)
#define	outw(p, d)	(*isa_pio_fcns->isa_outw)(p, d)
#define	outsw(p, a, c)	(*isa_pio_fcns->isa_outsw)(p, a, c)
#define	outl(p, d)	(*isa_pio_fcns->isa_outl)(p, d)
#define	outsl(p, a, c)	(*isa_pio_fcns->isa_outsl)(p, a, c)