Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Dec 2000 15:26:35 +0100
From:      Nicolas Souchu <nsouch@alcove.fr>
To:        freebsd-stable@freebsd.org
Subject:   Parallel ZIP patch for better mode detection
Message-ID:  <20001214152635.B16808@wiliam.alcove-int>

next in thread | raw e-mail | index | archive | help

--DKU6Jbt7q3WqK7+M
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit

Hi,

Here is a patch against -stable /sys/dev/ppbus for better ZIP/ZIP+
mode detection. I've tested ZIP, but don't have any ZIP+ :(

Could some of you approve vpo and imm drivers for me?

Nicholas

PS: I'm not subscribed to the -stable list :(

-- 
Nicolas.Souchu@alcove.fr
Alcôve - Open Source Software Engineer - http://www.alcove.fr

--DKU6Jbt7q3WqK7+M
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="vpo-stable.diffs"

Index: immio.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ppbus/immio.c,v
retrieving revision 1.10.2.1
diff -r1.10.2.1 immio.c
376,377c376,377
< 	/* we already have the bus, just connect */
< 	imm_connect(vpo, PPB_DONTWAIT, &error, 0);
---
> 	vpo->vpo_mode_found = VP0_MODE_UNDEFINED;
> 	error = 1;
378a379,384
> 	/* try to enter EPP mode since vpoio failure put the bus in NIBBLE */
> 	if (ppb_set_mode(ppbus, PPB_EPP) != -1) {
> 		imm_connect(vpo, PPB_DONTWAIT, &error, 0);
> 	}
> 
> 	/* if connection failed try PS/2 then NIBBLE modes */
380,383c386,403
< 		if (bootverbose)
< 			printf("imm%d: can't connect to the drive\n",
< 				vpo->vpo_unit);
< 		goto error;
---
> 		if (ppb_set_mode(ppbus, PPB_PS2) != -1) {
> 			imm_connect(vpo, PPB_DONTWAIT, &error, 0);
> 		}
> 		if (error) {
> 			if (ppb_set_mode(ppbus, PPB_NIBBLE) != -1) {
> 				imm_connect(vpo, PPB_DONTWAIT, &error, 0);
> 				if (error)
> 					goto error;
> 				vpo->vpo_mode_found = VP0_MODE_NIBBLE;
> 			} else {
> 				printf("imm%d: NIBBLE mode unavailable!\n", vpo->vpo_unit);
> 				goto error;
> 			}
> 		} else {
> 			vpo->vpo_mode_found = VP0_MODE_PS2;
> 		}
> 	} else {
> 		vpo->vpo_mode_found = VP0_MODE_EPP;
558d577
< 	int epp;
580,589c599,606
< 	/* enter NIBBLE mode to configure submsq */
< 	if (ppb_set_mode(ppbus, PPB_NIBBLE) != -1) {
< 
< 		ppb_MS_GET_init(ppbus, vpo->vpo_dev, vpo->vpo_nibble_inbyte_msq);
< 		ppb_MS_PUT_init(ppbus, vpo->vpo_dev, spp_outbyte_submicroseq);
< 	}
< 
< 	/* enter PS2 mode to configure submsq */
< 	if (ppb_set_mode(ppbus, PPB_PS2) != -1) {
< 
---
> 	/* ppbus automatically restore the last mode entered during detection */
> 	switch (vpo->vpo_mode_found) {
> 	case VP0_MODE_EPP:
> 		ppb_MS_GET_init(ppbus, vpo->vpo_dev, epp17_instr);
> 		ppb_MS_PUT_init(ppbus, vpo->vpo_dev, epp17_outstr);
> 		printf("imm%d: EPP mode\n", vpo->vpo_unit);
> 		break;
> 	case VP0_MODE_PS2:
592,624d608
< 	}
< 
< 	epp = ppb_get_epp_protocol(ppbus);
< 
< 	/* enter EPP mode to configure submsq */
< 	if (ppb_set_mode(ppbus, PPB_EPP) != -1) {
< 
< 		switch (epp) {
< 		case EPP_1_9:
< 		case EPP_1_7:
< 			ppb_MS_GET_init(ppbus, vpo->vpo_dev, epp17_instr);
< 			ppb_MS_PUT_init(ppbus, vpo->vpo_dev, epp17_outstr);
< 			break;
< 		default:
< 			panic("%s: unknown EPP protocol (0x%x)", __FUNCTION__,
< 				epp);
< 		}
< 	}
< 
< 	/* try to enter EPP or PS/2 mode, NIBBLE otherwise */
< 	if (ppb_set_mode(ppbus, PPB_EPP) != -1) {
< 		switch (epp) {
< 		case EPP_1_9:
< 			printf("imm%d: EPP 1.9 mode\n", vpo->vpo_unit);
< 			break;
< 		case EPP_1_7:
< 			printf("imm%d: EPP 1.7 mode\n", vpo->vpo_unit);
< 			break;
< 		default:
< 			panic("%s: unknown EPP protocol (0x%x)", __FUNCTION__,
< 				epp);
< 		}
< 	} else if (ppb_set_mode(ppbus, PPB_PS2) != -1)
626,627c610,613
< 
< 	else if (ppb_set_mode(ppbus, PPB_NIBBLE) != -1)
---
> 		break;
> 	case VP0_MODE_NIBBLE:
> 		ppb_MS_GET_init(ppbus, vpo->vpo_dev, vpo->vpo_nibble_inbyte_msq);
> 		ppb_MS_PUT_init(ppbus, vpo->vpo_dev, spp_outbyte_submicroseq);
629,637c615,617
< 
< 	else {
< 		printf("imm%d: can't enter NIBBLE, PS2 or EPP mode\n",
< 			vpo->vpo_unit);
< 
< 		ppb_release_bus(ppbus, vpo->vpo_dev);
< 
< 		free(vpo->vpo_nibble_inbyte_msq, M_DEVBUF);
< 		return (ENXIO);
---
> 		break;
> 	default:
> 		panic("imm: unknown mode %d", vpo->vpo_mode_found);
Index: vpoio.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ppbus/vpoio.c,v
retrieving revision 1.10.2.1
diff -r1.10.2.1 vpoio.c
2a3
>  * Copyright (c) 2000 Alcove - Nicolas Souchu
366a368
> 	/* Force disconnection */
369c371,374
< 	if (PPB_IN_EPP_MODE(ppbus))
---
> 	/* Try to enter EPP mode, then connect to the drive in EPP mode */
> 	if (ppb_set_mode(ppbus, PPB_EPP) != -1) {
> 		/* call manually the microseq instead of using the appropriate function
> 		 * since we already requested the ppbus */
371,375c376
< 	else
< 		ppb_MS_microseq(ppbus, vpo->vpo_dev, connect_spp_microseq, &ret);
< 
< 	ppb_MS_microseq(ppbus, vpo->vpo_dev, in_disk_mode, &ret);
< 	if (!ret) {
---
> 	}
377,379c378,386
< 		/* try spp mode (maybe twice or because previous mode was PS2)
< 		 * NIBBLE mode will be restored on next transfers if detection
< 		 * succeed
---
> 	/* If EPP mode switch failed or ZIP connection in EPP mode failed,
> 	 * try to connect in NIBBLE mode */
> 	if (!vpoio_in_disk_mode(vpo)) {
> 
> 		/* The interface must be at least PS/2 or NIBBLE capable.
> 		 * There is no way to know if the ZIP will work with
> 		 * PS/2 mode since PS/2 and SPP both use the same connect
> 		 * sequence. One must supress PS/2 with boot flags if
> 		 * PS/2 mode fails (see ppc(4)).
381,382c388,395
< 		ppb_set_mode(ppbus, PPB_NIBBLE);
< 		ppb_MS_microseq(ppbus, vpo->vpo_dev, connect_spp_microseq, &ret);
---
> 		if (ppb_set_mode(ppbus, PPB_PS2) != -1) {
> 			vpo->vpo_mode_found = VP0_MODE_PS2;
> 		} else {
> 			if (ppb_set_mode(ppbus, PPB_NIBBLE) == -1)
> 				goto error;
> 
> 			vpo->vpo_mode_found = VP0_MODE_NIBBLE;
> 		}
384,385c397,400
< 		ppb_MS_microseq(ppbus, vpo->vpo_dev, in_disk_mode, &ret);
< 		if (!ret) {
---
> 		/* Can't know if the interface is capable of PS/2 yet */
> 		ppb_MS_microseq(ppbus, vpo->vpo_dev, connect_spp_microseq, &ret);
> 		if (!vpoio_in_disk_mode(vpo)) {
> 			vpo->vpo_mode_found = VP0_MODE_UNDEFINED;
394a410,411
> 	} else {
> 		vpo->vpo_mode_found = VP0_MODE_EPP;
404,406c421
< 
< 	ppb_MS_microseq(ppbus, vpo->vpo_dev, in_disk_mode, &ret);
< 	if (ret) {
---
> 	if (vpoio_in_disk_mode(vpo)) {
433,454d447
< #if 0
< 		/* XXX EPP 1.9 not implemented with microsequences */
< 		else {
< 
< 			ppb_reset_epp_timeout(ppbus);
< 			ppb_wctr(ppbus, H_AUTO | H_SELIN | H_INIT | H_STROBE);
< 
< 			if (((long) buffer | size) & 0x03)
< 				ppb_outsb_epp(ppbus,
< 						buffer, size);
< 			else
< 				ppb_outsl_epp(ppbus,
< 						buffer, size/4);
< 
< 			if ((ppb_rstr(ppbus) & TIMEOUT)) {
< 				error = VP0_EPPDATA_TIMEOUT;
< 				goto error;
< 			}
< 
< 			ppb_wctr(ppbus, H_AUTO | H_nSELIN | H_INIT | H_STROBE);
< 		}
< #endif
472,495d464
< #if 0
< 		/* XXX EPP 1.9 not implemented with microsequences */
< 		else {
< 
< 			ppb_reset_epp_timeout(ppbus);
< 			ppb_wctr(ppbus, PCD |
< 				H_AUTO | H_SELIN | H_INIT | H_STROBE);
< 
< 			if (((long) buffer | size) & 0x03)
< 				ppb_insb_epp(ppbus,
< 						buffer, size);
< 			else
< 				ppb_insl_epp(ppbus,
< 						buffer, size/4);
< 
< 			if ((ppb_rstr(ppbus) & TIMEOUT)) {
< 				error = VP0_EPPDATA_TIMEOUT;
< 				goto error;
< 			}
< 
< 			ppb_wctr(ppbus, PCD |
< 				H_AUTO | H_nSELIN | H_INIT | H_STROBE);
< 		}
< #endif
618c587
< 	int epp;
---
> 	int error = 0;
635,646c604,605
< 	ppb_request_bus(ppbus, vpo->vpo_dev, PPB_WAIT);
< 
< 	/* enter NIBBLE mode to configure submsq */
< 	if (ppb_set_mode(ppbus, PPB_NIBBLE) != -1) {
< 
< 		ppb_MS_GET_init(ppbus, vpo->vpo_dev, vpo->vpo_nibble_inbyte_msq);
< 
< 		ppb_MS_PUT_init(ppbus, vpo->vpo_dev, spp_outbyte_submicroseq);
< 	}
< 
< 	/* enter PS2 mode to configure submsq */
< 	if (ppb_set_mode(ppbus, PPB_PS2) != -1) {
---
> 	if ((error = ppb_request_bus(ppbus, vpo->vpo_dev, PPB_WAIT)))
> 		goto error;
647a607,614
> 	/* ppbus sets automatically the last mode entered during detection */
> 	switch (vpo->vpo_mode_found) {
> 	case VP0_MODE_EPP:
> 		ppb_MS_GET_init(ppbus, vpo->vpo_dev, epp17_instr_body);
> 		ppb_MS_PUT_init(ppbus, vpo->vpo_dev, epp17_outstr_body);
> 		printf("vpo%d: EPP mode\n", vpo->vpo_unit);
> 		break;
> 	case VP0_MODE_PS2:
649d615
< 
651,685d616
< 	}
< 
< 	epp = ppb_get_epp_protocol(ppbus);
< 
< 	/* enter EPP mode to configure submsq */
< 	if (ppb_set_mode(ppbus, PPB_EPP) != -1) {
< 
< 		switch (epp) {
< 		case EPP_1_9:
< 			/* XXX EPP 1.9 support should be improved */
< 		case EPP_1_7:
< 			ppb_MS_GET_init(ppbus, vpo->vpo_dev, epp17_instr_body);
< 
< 			ppb_MS_PUT_init(ppbus, vpo->vpo_dev, epp17_outstr_body);
< 			break;
< 		default:
< 			panic("%s: unknown EPP protocol (0x%x)", __FUNCTION__,
< 				epp);
< 		}
< 	}
< 
< 	/* try to enter EPP or PS/2 mode, NIBBLE otherwise */
< 	if (ppb_set_mode(ppbus, PPB_EPP) != -1) {
< 		switch (epp) {
< 		case EPP_1_9:
< 			printf("vpo%d: EPP 1.9 mode\n", vpo->vpo_unit);
< 			break;
< 		case EPP_1_7:
< 			printf("vpo%d: EPP 1.7 mode\n", vpo->vpo_unit);
< 			break;
< 		default:
< 			panic("%s: unknown EPP protocol (0x%x)", __FUNCTION__,
< 				epp);
< 		}
< 	} else if (ppb_set_mode(ppbus, PPB_PS2) != -1)
687,688c618,621
< 
< 	else if (ppb_set_mode(ppbus, PPB_NIBBLE) != -1)
---
> 		break;
> 	case VP0_MODE_NIBBLE:
> 		ppb_MS_GET_init(ppbus, vpo->vpo_dev, vpo->vpo_nibble_inbyte_msq);
> 		ppb_MS_PUT_init(ppbus, vpo->vpo_dev, spp_outbyte_submicroseq);
690,698c623,625
< 
< 	else {
< 		printf("vpo%d: can't enter NIBBLE, PS2 or EPP mode\n",
< 			vpo->vpo_unit);
< 
< 		ppb_release_bus(ppbus, vpo->vpo_dev);
< 
< 		free(vpo->vpo_nibble_inbyte_msq, M_DEVBUF);
< 		return (ENXIO);
---
> 		break;
> 	default:
> 		panic("vpo: unknown mode %d", vpo->vpo_mode_found);
703c630,631
< 	return (0);
---
> error:
> 	return (error);
Index: vpoio.h
===================================================================
RCS file: /home/ncvs/src/sys/dev/ppbus/vpoio.h,v
retrieving revision 1.4
diff -r1.4 vpoio.h
61a62,67
> /* Mode found during initialisation */
> #define VP0_MODE_UNDEFINED	0x0
> #define VP0_MODE_NIBBLE		0x1
> #define VP0_MODE_PS2		0x2
> #define VP0_MODE_EPP		0x3
> 
63a70
> 	int vpo_mode_found;		/* Mode found during init */

--DKU6Jbt7q3WqK7+M--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001214152635.B16808>