vpoio.h revision 70608
133965Sjdp/*-
289857Sobrien * Copyright (c) 1998 Nicolas Souchu
3218822Sdim * All rights reserved.
433965Sjdp *
533965Sjdp * Redistribution and use in source and binary forms, with or without
6130561Sobrien * modification, are permitted provided that the following conditions
733965Sjdp * are met:
8130561Sobrien * 1. Redistributions of source code must retain the above copyright
9130561Sobrien *    notice, this list of conditions and the following disclaimer.
10130561Sobrien * 2. Redistributions in binary form must reproduce the above copyright
11130561Sobrien *    notice, this list of conditions and the following disclaimer in the
1233965Sjdp *    documentation and/or other materials provided with the distribution.
13130561Sobrien *
14130561Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15130561Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16130561Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1733965Sjdp * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18130561Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19130561Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20218822Sdim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2133965Sjdp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2233965Sjdp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2333965Sjdp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2433965Sjdp * SUCH DAMAGE.
2533965Sjdp *
2633965Sjdp * $FreeBSD: head/sys/dev/ppbus/vpoio.h 70608 2001-01-02 21:29:06Z nsouch $
2733965Sjdp *
2833965Sjdp */
2933965Sjdp#ifndef __VP0IO_H
3078828Sobrien#define __VP0IO_H
3189857Sobrien
3278828Sobrien/*
3378828Sobrien * The ZIP drive cannot act as an initiator.
3478828Sobrien */
3533965Sjdp#define VP0_INITIATOR	0x7
3633965Sjdp
37130561Sobrien#define VP0_ESELECT_TIMEOUT	1
38130561Sobrien#define VP0_ECMD_TIMEOUT	2
3933965Sjdp#define VP0_ECONNECT		3
40130561Sobrien#define VP0_ESTATUS_TIMEOUT	4
41130561Sobrien#define VP0_EDATA_OVERFLOW	5
4233965Sjdp#define VP0_EDISCONNECT		6
4333965Sjdp#define VP0_EPPDATA_TIMEOUT	7
4433965Sjdp#define VP0_ENEGOCIATE		8
4533965Sjdp#define VP0_ENOPORT		9
46130561Sobrien#define VP0_EINITFAILED		10
4733965Sjdp#define VP0_EINTR		12
4833965Sjdp
4933965Sjdp#define VP0_EOTHER		13
5033965Sjdp
5133965Sjdp#define VP0_OPENNINGS	1
5233965Sjdp
5333965Sjdp/*
5433965Sjdp * Data structure used during microsequence execution
5533965Sjdp * when characters are received in nibble mode
5633965Sjdp */
5733965Sjdpstruct vpo_nibble {
5833965Sjdp	char h;			/* most significant nibble */
5933965Sjdp	char l;			/* less significant nibble */
6033965Sjdp};
6133965Sjdp
6233965Sjdp/* Mode found during initialisation */
6333965Sjdp#define VP0_MODE_UNDEFINED	0x0
6433965Sjdp#define VP0_MODE_NIBBLE		0x1
6533965Sjdp#define VP0_MODE_PS2		0x2
6633965Sjdp#define VP0_MODE_EPP		0x3
67130561Sobrien
68130561Sobrienstruct vpoio_data {
6933965Sjdp	unsigned short int vpo_unit;
7033965Sjdp	int vpo_mode_found;		/* Mode found during init */
7133965Sjdp
7233965Sjdp	struct vpo_nibble vpo_nibble;
7333965Sjdp
7433965Sjdp	/* each device must have its own nibble inbyte microsequence */
7533965Sjdp	struct ppb_microseq *vpo_nibble_inbyte_msq;
7633965Sjdp
7733965Sjdp	device_t vpo_dev;
7833965Sjdp};
7989857Sobrien
80130561Sobrien#define vpoio_set_unit(vpo,unit) ((vpo)->vpo_unit = unit)
81130561Sobrien
8289857Sobrienint vpoio_probe(device_t dev, struct vpoio_data *vpo);
8333965Sjdp
8433965Sjdpint vpoio_attach(struct vpoio_data *vpo);
8533965Sjdpint vpoio_reset_bus(struct vpoio_data *vpo);
8633965Sjdp
8733965Sjdpint vpoio_do_scsi(struct vpoio_data *vpo, int host, int target, char *command,
8833965Sjdp		int clen, char *buffer, int blen, int *result, int *count,
8933965Sjdp		int *ret);
9033965Sjdp
9133965Sjdpint imm_probe(device_t dev, struct vpoio_data *vpo);
9233965Sjdp
9333965Sjdpint imm_attach(struct vpoio_data *vpo);
9433965Sjdpint imm_reset_bus(struct vpoio_data *vpo);
9560484Sobrien
9660484Sobrienint imm_do_scsi(struct vpoio_data *vpo, int host, int target, char *command,
9760484Sobrien		int clen, char *buffer, int blen, int *result, int *count,
9860484Sobrien		int *ret);
9960484Sobrien
10060484Sobrien#endif
10160484Sobrien