138061Smsmith/*-
238061Smsmith * Copyright (c) 1998 Nicolas Souchu
338061Smsmith * All rights reserved.
438061Smsmith *
538061Smsmith * Redistribution and use in source and binary forms, with or without
638061Smsmith * modification, are permitted provided that the following conditions
738061Smsmith * are met:
838061Smsmith * 1. Redistributions of source code must retain the above copyright
938061Smsmith *    notice, this list of conditions and the following disclaimer.
1038061Smsmith * 2. Redistributions in binary form must reproduce the above copyright
1138061Smsmith *    notice, this list of conditions and the following disclaimer in the
1238061Smsmith *    documentation and/or other materials provided with the distribution.
1338061Smsmith *
1438061Smsmith * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1538061Smsmith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1638061Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1738061Smsmith * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1838061Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1938061Smsmith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2038061Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2138061Smsmith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2238061Smsmith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2338061Smsmith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2438061Smsmith * SUCH DAMAGE.
2538061Smsmith *
2650477Speter * $FreeBSD$
2738061Smsmith *
2838061Smsmith */
2938061Smsmith#ifndef __VP0IO_H
3038061Smsmith#define __VP0IO_H
3138061Smsmith
3238061Smsmith/*
3338061Smsmith * The ZIP drive cannot act as an initiator.
3438061Smsmith */
3538061Smsmith#define VP0_INITIATOR	0x7
3638061Smsmith
3738061Smsmith#define VP0_ESELECT_TIMEOUT	1
3838061Smsmith#define VP0_ECMD_TIMEOUT	2
3938061Smsmith#define VP0_ECONNECT		3
4038061Smsmith#define VP0_ESTATUS_TIMEOUT	4
41185003Sjhb#define VP0_EDATA_OVERFLOW	5
4238061Smsmith#define VP0_EDISCONNECT		6
4338061Smsmith#define VP0_EPPDATA_TIMEOUT	7
4439134Snsouch#define VP0_ENEGOCIATE		8
4538061Smsmith#define VP0_ENOPORT		9
4638061Smsmith#define VP0_EINITFAILED		10
4738061Smsmith#define VP0_EINTR		12
4838061Smsmith
4938061Smsmith#define VP0_EOTHER		13
5038061Smsmith
5138061Smsmith#define VP0_OPENNINGS	1
5238061Smsmith
5338061Smsmith/*
5438061Smsmith * Data structure used during microsequence execution
5538061Smsmith * when characters are received in nibble mode
5638061Smsmith */
5738061Smsmithstruct vpo_nibble {
5838061Smsmith	char h;			/* most significant nibble */
5938061Smsmith	char l;			/* less significant nibble */
6038061Smsmith};
6138061Smsmith
6270608Snsouch/* Mode found during initialisation */
6370608Snsouch#define VP0_MODE_UNDEFINED	0x0
6470608Snsouch#define VP0_MODE_NIBBLE		0x1
6570608Snsouch#define VP0_MODE_PS2		0x2
6670608Snsouch#define VP0_MODE_EPP		0x3
6770608Snsouch
6838061Smsmithstruct vpoio_data {
6970608Snsouch	int vpo_mode_found;		/* Mode found during init */
7038061Smsmith
7138061Smsmith	struct vpo_nibble vpo_nibble;
7238061Smsmith
7338061Smsmith	/* each device must have its own nibble inbyte microsequence */
7438061Smsmith	struct ppb_microseq *vpo_nibble_inbyte_msq;
7538061Smsmith
7655939Snsouch	device_t vpo_dev;
7738061Smsmith};
7838061Smsmith
7955939Snsouchint vpoio_probe(device_t dev, struct vpoio_data *vpo);
8038061Smsmith
8138061Smsmithint vpoio_attach(struct vpoio_data *vpo);
8238061Smsmithint vpoio_reset_bus(struct vpoio_data *vpo);
8338061Smsmith
8438061Smsmithint vpoio_do_scsi(struct vpoio_data *vpo, int host, int target, char *command,
8538061Smsmith		int clen, char *buffer, int blen, int *result, int *count,
8638061Smsmith		int *ret);
8738061Smsmith
8855939Snsouchint imm_probe(device_t dev, struct vpoio_data *vpo);
8939134Snsouch
9039134Snsouchint imm_attach(struct vpoio_data *vpo);
9139134Snsouchint imm_reset_bus(struct vpoio_data *vpo);
9239134Snsouch
9339134Snsouchint imm_do_scsi(struct vpoio_data *vpo, int host, int target, char *command,
9439134Snsouch		int clen, char *buffer, int blen, int *result, int *count,
9539134Snsouch		int *ret);
9639134Snsouch
9738061Smsmith#endif
98