xref: /openbsd/sys/arch/sparc64/dev/fdvar.h (revision d874cce4)
1 /*	$OpenBSD: fdvar.h,v 1.3 2008/06/26 05:42:13 ray Exp $	*/
2 /*	$NetBSD: fdvar.h,v 1.12 2003/07/11 12:09:13 pk Exp $	*/
3 
4 /*-
5  * Copyright (c) 1998 The NetBSD Foundation, Inc.
6  * All rights reserved.
7  *
8  * This code is derived from software contributed to The NetBSD Foundation
9  * by Paul Kranenburg.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #define	FD_BSIZE(fd)	(128 << fd->sc_type->secsize)
34 #define	FDC_MAXIOSIZE	NBPG	/* XXX should be MAXBSIZE */
35 
36 #define FDC_NSTATUS	10
37 
38 struct fdcio {
39 	bus_space_handle_t	fdcio_handle;
40 
41 	/*
42 	 * Interrupt state.
43 	 */
44 	int	fdcio_itask;
45 	int	fdcio_istatus;
46 
47 	/*
48 	 * IO state.
49 	 */
50 	char	*fdcio_data;		/* pseudo-DMA data */
51 	int	fdcio_tc;		/* pseudo-DMA Terminal Count */
52 	u_char	fdcio_status[FDC_NSTATUS];	/* copy of registers */
53 	int	fdcio_nstat;		/* # of valid status bytes */
54 };
55 
56 /* itask values */
57 #define FDC_ITASK_NONE		0	/* No HW interrupt expected */
58 #define FDC_ITASK_SENSEI	1	/* Do SENSEI on next HW interrupt */
59 #define FDC_ITASK_DMA		2	/* Do Pseudo-DMA */
60 #define FDC_ITASK_RESULT	3	/* Pick up command results */
61 
62 /* istatus values */
63 #define FDC_ISTATUS_NONE	0	/* No status available */
64 #define FDC_ISTATUS_SPURIOUS	1	/* Spurious HW interrupt detected */
65 #define FDC_ISTATUS_ERROR	2	/* Operation completed abnormally */
66 #define FDC_ISTATUS_DONE	3	/* Operation completed normally */
67