ecppvar.h revision 08ec77c5d4647cce340afb3d6cba733d508e7e94
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_ECPPVAR_H
#define _SYS_ECPPVAR_H
#ifdef __cplusplus
extern "C" {
#endif
struct ecppunit;
/*
* Hardware-abstraction structure
*/
struct ecpp_hw {
};
/* NSC 87332/97317 and EBus DMAC */
struct ecpp_ebus {
};
/* Southbridge SuperIO and 8237 DMAC */
struct ecpp_m1553 {
int isadma_entered; /* Southbridge DMA workaround */
};
#if defined(__x86)
struct ecpp_x86 {
};
#endif
/*
* Hardware binding structure
*/
struct ecpp_hw_bind {
char *name; /* binding name */
char *info; /* info string */
};
/* ecpp e_busy states */
typedef enum {
} ecpp_busy_t;
/*
* ecpp soft state structure
*/
struct ecppunit {
int instance; /* instance number */
/*
* common SuperIO registers
*/
/*
* DMA support
*/
/*
* hardware-dependent stuff
*/
union { /* hw-dependent data */
struct ecpp_m1553 m1553;
#if defined(__x86)
#endif
} uh;
/*
*/
/*
* Modes of operation
*/
int current_mode; /* 1284 mode */
/*
* Ioctls support
*/
/*
* ecpp.conf parameters
*/
/*
* Timeouts
*/
/*
* Softintr data
*/
int softintr_flags; /* flags indicating softintr task */
/*
* Misc stuff
*/
/*
* Spurious interrupt detection
*/
long nspur; /* spurious intrs counter */
/*
* Statistics
*/
/*
* number of bytes, transferred in and out in each mode
*/
/*
* other stats
*/
/*
* interrupt stats
*/
/*
* identify second register set for ecp mode on Sx86
*/
int noecpregs;
};
/*
* current_phase values
*/
#define FAILURE_PHASE 0x80
#define UNDEFINED_PHASE 0x81
/* ecpp return values */
#define SUCCESS 1
#define FAILURE 2
#define TRUE 1
#define FALSE 0
/* message type */
#define ECPP_BACKCHANNEL 0x45
/* transfer modes */
#define ECPP_DMA 0x1
#define ECPP_PIO 0x2
/* tuneable timing defaults */
/* Centronics hanshaking defaults */
/* 1284 Extensibility Request values */
/* softintr flags */
/* Stream defaults */
/* Loop timers */
/* misc constants */
#define REV_TIMEOUT_DEFAULT 0 /* reverse xfer timeout in seconds */
/* ECP mode constants */
/* spurious interrupt detection */
/*
*/
#define ECPP_STRUCTIN 0
#define ECPP_STRUCTOUT 1
#define ECPP_ADDRIN 2
#define ECPP_ADDROUT 3
/*
* As other ioctls require the same structure, put inner struct's into union
*/
struct ecpp_copystate {
int state; /* see above */
void *uaddr; /* user address of the following structure */
union {
struct ecpp_device_id devid;
struct prn_1284_device_id prn_devid;
struct prn_interface_info prn_if;
} un;
};
/*
* The structure is dynamically created for each M_IOCTL and is bound to mblk
*/
/* kstat structure */
struct ecppkstat {
/*
* number of bytes, transferred in and out in each mode
*/
struct kstat_named ek_ctx_obytes;
struct kstat_named ek_ctxpio_obytes;
struct kstat_named ek_nib_ibytes;
struct kstat_named ek_ecp_obytes;
struct kstat_named ek_ecp_ibytes;
struct kstat_named ek_epp_obytes;
struct kstat_named ek_epp_ibytes;
struct kstat_named ek_diag_obytes;
/*
* number of transitions to particular mode
*/
struct kstat_named ek_to_ctx;
struct kstat_named ek_to_nib;
struct kstat_named ek_to_ecp;
struct kstat_named ek_to_epp;
struct kstat_named ek_to_diag;
/*
* other stats
*/
/* isr has looped */
};
/* Macros for superio programming */
#define DFIFO_READ(pp) \
#define TFIFO_READ(pp) \
/*
* Macros to manipulate register bits
*/
{ \
}
{ \
}
{ \
}
{ \
}
{ \
}
/*
*/
/*
* Macros to distinguish between PIO and DMA Compatibility mode
*/
/*
* Other useful macros
*/
#define NELEM(a) (sizeof (a) / sizeof (*(a)))
#ifdef __cplusplus
}
#endif
#endif /* _SYS_ECPPVAR_H */