Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Aug 1998 20:57:04 +0000
From:      Nicolas Souchu <Nicolas.Souchu@prism.uvsq.fr>
To:        "D. Rock" <rock@cs.uni-sb.de>
Cc:        Zach Heilig <zach@gaffaneys.com>, freebsd-current@FreeBSD.ORG
Subject:   Re: printer didn't work... a patch
Message-ID:  <19980831205704.19847@breizh.prism.uvsq.fr>
In-Reply-To: <13802.27355.871373.199447@doom>; from D. Rock on Mon, Aug 31, 1998 at 11:25:16AM %2B0200
References:  <35E13ACB.10D29949@wurzelausix.cs.uni-sb.de> <19980830172105.51414@breizh.prism.uvsq.fr> <19980831024552.A912@znh.org.> <13802.27355.871373.199447@doom>

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

--k+w/mQv8wyuph6w0
Content-Type: text/plain; charset=us-ascii

On Mon, Aug 31, 1998 at 11:25:16AM +0200, D. Rock wrote:
>Zach Heilig writes:
> > On Sun, Aug 30, 1998 at 05:21:05PM +0000, Nicolas Souchu wrote:
> > > Ok. When do you see the leds coming up again? I propose you to remove the
> > > pnp_detect() call from /sys/dev/ppbus/ppbconf.c and tell me.
> > 
> > I've seen this as well, but I thought it was just my configuration (tweeking
> > the bios a bit fixed it).
> > 
> > EPP only works (detected as):
> > ppc0: Generic chipset (EPP/NIBBLE) in COMPATIBLE mode
> > 
> > EPP/ECP doesn't work (similar to, but with ECP/PS2 added).
> > ppc0: Generic chipset (ECP/EPP/PS2/NIBBLE) in COMPATIBLE mode
>Exactly the same for my configuration. I installed the system from a
>"make release" at Aug, 21. The printer only works if ECP is
>disabled. I have a parallel port ZIP drive attached (ick).
>
>There is an interesting phenomen: If I enable ECP, the printer port
>gets detected (Winbond W83877F on a VIA Apollo Master board), but the
>ZIP drive doesn't. After a reboot, even the BIOS doesn't find the
>parallel port any more. I have to do a power cycle to revive it again.

Strange... the BIOS is responsible I think.

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

Actually SPP under ECP mode configuration was completly broken :)

Please try the patch with -v boot(8) option set. And tell me all!

Thanks.

-- 
Nicolas.Souchu@prism.uvsq.fr
FreeBSD - Turning PCs into workstations - http://www.FreeBSD.org

--k+w/mQv8wyuph6w0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="ppc.diffs"

Index: ppc.c
===================================================================
RCS file: /CVSROOT/src/sys/i386/isa/ppc.c,v
retrieving revision 1.1.1.1.2.10
retrieving revision 1.1.1.1.2.17
diff -c -r1.1.1.1.2.10 -r1.1.1.1.2.17
*** ppc.c	1998/08/29 11:52:49	1.1.1.1.2.10
--- ppc.c	1998/08/31 20:50:56	1.1.1.1.2.17
***************
*** 127,134 ****
  
  static int ppc_exec_microseq(int, struct ppb_microseq *, int *);
  static int ppc_generic_setmode(int, int);
  
! static struct ppb_adapter ppc_adapter = {
  
  	0,	/* no intr handler, filled by chipset dependent code */
  
--- 127,135 ----
  
  static int ppc_exec_microseq(int, struct ppb_microseq *, int *);
  static int ppc_generic_setmode(int, int);
+ static int ppc_smclike_setmode(int, int);
  
! static struct ppb_adapter ppc_smclike_adapter = {
  
  	0,	/* no intr handler, filled by chipset dependent code */
  
***************
*** 136,141 ****
--- 137,159 ----
  
  	ppc_exec_microseq,
  
+ 	ppc_smclike_setmode,
+ 
+ 	ppc_outsb_epp, ppc_outsw_epp, ppc_outsl_epp,
+ 	ppc_insb_epp, ppc_insw_epp, ppc_insl_epp,
+ 
+ 	ppc_rdtr, ppc_rstr, ppc_rctr, ppc_repp, ppc_recr, ppc_rfifo,
+ 	ppc_wdtr, ppc_wstr, ppc_wctr, ppc_wepp, ppc_wecr, ppc_wfifo
+ };
+ 
+ static struct ppb_adapter ppc_generic_adapter = {
+ 
+ 	0,	/* no intr handler, filled by chipset dependent code */
+ 
+ 	ppc_reset_epp_timeout, ppc_ecp_sync,
+ 
+ 	ppc_exec_microseq,
+ 
  	ppc_generic_setmode,
  
  	ppc_outsb_epp, ppc_outsw_epp, ppc_outsl_epp,
***************
*** 180,202 ****
  	return;
  }
  
- static void
- ppc_ecp_config(struct ppc_data *ppc, int chipset_mode)
- {
- 	/* XXX disable DMA, enable interrupts */
- 	if (chipset_mode & PPB_EPP)
- 		/* select EPP mode */
- 		w_ecr(ppc, 0x80);
- 	else if (chipset_mode & PPB_PS2)
- 			/* select PS2 mode with ECP */
- 			w_ecr(ppc, 0x20);
- 		else
- 			/* keep ECP mode alone, default for NIBBLE */
- 			w_ecr(ppc, 0x70);
- 
- 	return;
- }
- 
  static int
  ppc_detect_port(struct ppc_data *ppc)
  {
--- 198,203 ----
***************
*** 466,471 ****
--- 467,475 ----
  		/* 666GT is ~certainly~ hardwired to an extended ECP+EPP mode */
  		if (type == SMC_37C666GT) {
  			ppc->ppc_avm |= PPB_ECP | PPB_EPP | PPB_SPP;
+ 			if (bootverbose)
+ 				printf(" configuration hardwired, supposing " \
+ 					"ECP+EPP SPP");
  
  		} else
  		   if ((inb(cio) & SMC_CR1_MODE) == 0) {
***************
*** 476,498 ****
--- 480,512 ----
  			switch (r) {
  			case SMC_SPP:
  				ppc->ppc_avm |= PPB_SPP;
+ 				if (bootverbose)
+ 					printf(" SPP");
  				break;
  
  			case SMC_EPPSPP:
  				ppc->ppc_avm |= PPB_EPP | PPB_SPP;
+ 				if (bootverbose)
+ 					printf(" EPP SPP");
  				break;
  
  			case SMC_ECP:
  				ppc->ppc_avm |= PPB_ECP | PPB_SPP;
+ 				if (bootverbose)
+ 					printf(" ECP SPP");
  				break;
  
  			case SMC_ECPEPP:
  				ppc->ppc_avm |= PPB_ECP | PPB_EPP | PPB_SPP;
+ 				if (bootverbose)
+ 					printf(" ECP+EPP SPP");
  				break;
  			}
  		   } else {
  			/* not an extended port mode */
  			ppc->ppc_avm |= PPB_SPP;
+ 			if (bootverbose)
+ 				printf(" SPP");
  		   }
  
  	} else {
***************
*** 507,512 ****
--- 521,528 ----
  		if ((chipset_mode & (PPB_ECP | PPB_EPP)) == 0) {
  			/* do not use ECP when the mode is not forced to */
  			outb(cio, r | SMC_CR1_MODE);
+ 			if (bootverbose)
+ 				printf(" SPP");
  		} else {
  			/* an extended mode is selected */
  			outb(cio, r & ~SMC_CR1_MODE);
***************
*** 518,529 ****
--- 534,551 ----
  			if (chipset_mode & PPB_ECP) {
  				if (chipset_mode & PPB_EPP) {
  					outb(cio, r | SMC_ECPEPP);
+ 					if (bootverbose)
+ 						printf(" ECP+EPP");
  				} else {
  					outb(cio, r | SMC_ECP);
+ 					if (bootverbose)
+ 						printf(" ECP");
  				}
  			} else {
  				/* PPB_EPP is set */
  				outb(cio, r | SMC_EPPSPP);
+ 				if (bootverbose)
+ 					printf(" EPP SPP");
  			}
  		}
  		ppc->ppc_avm = chipset_mode;
***************
*** 552,559 ****
  	/* end config mode */
  	outb(csr, 0xaa);
  
! 	if (ppc->ppc_avm & PPB_ECP)
! 		ppc_ecp_config(ppc, chipset_mode);
  
  	return (chipset_mode);
  }
--- 574,581 ----
  	/* end config mode */
  	outb(csr, 0xaa);
  
! 	ppc->ppc_link.adapter = &ppc_smclike_adapter;
! 	ppc_smclike_setmode(ppc->ppc_unit, chipset_mode);
  
  	return (chipset_mode);
  }
***************
*** 647,654 ****
--- 669,679 ----
  			printf("0x%x ", inb(efdr));
  		}
  		printf("\n");
+ 		printf("ppc%d:", ppc->ppc_unit);
  	}
  
+ 	ppc->ppc_link.adapter = &ppc_generic_adapter;
+ 
  	if (!chipset_mode) {
  		/* autodetect mode */
  
***************
*** 672,691 ****
  		case WINB_EXT2FDD:
  		case WINB_JOYSTICK:
  			if (bootverbose)
! 				printf("ppc%d: not in parallel port mode\n",
! 					ppc->ppc_unit);
  			return (-1);
  
  		case (WINB_PARALLEL | WINB_EPP_SPP):
  			ppc->ppc_avm |= PPB_EPP | PPB_SPP;
  			break;
  
  		case (WINB_PARALLEL | WINB_ECP):
  			ppc->ppc_avm |= PPB_ECP | PPB_SPP;
  			break;
  
  		case (WINB_PARALLEL | WINB_ECP_EPP):
  			ppc->ppc_avm |= PPB_ECP | PPB_EPP | PPB_SPP;
  			break;
  		default:
  			printf("%s: unknown case (0x%x)!\n", __FUNCTION__, r);
--- 697,723 ----
  		case WINB_EXT2FDD:
  		case WINB_JOYSTICK:
  			if (bootverbose)
! 				printf(" not in parallel port mode\n");
  			return (-1);
  
  		case (WINB_PARALLEL | WINB_EPP_SPP):
  			ppc->ppc_avm |= PPB_EPP | PPB_SPP;
+ 			if (bootverbose)
+ 				printf(" EPP SPP");
  			break;
  
  		case (WINB_PARALLEL | WINB_ECP):
  			ppc->ppc_avm |= PPB_ECP | PPB_SPP;
+ 			if (bootverbose)
+ 				printf(" ECP SPP");
  			break;
  
  		case (WINB_PARALLEL | WINB_ECP_EPP):
  			ppc->ppc_avm |= PPB_ECP | PPB_EPP | PPB_SPP;
+ 			ppc->ppc_link.adapter = &ppc_smclike_adapter;
+ 
+ 			if (bootverbose)
+ 				printf(" ECP+EPP SPP");
  			break;
  		default:
  			printf("%s: unknown case (0x%x)!\n", __FUNCTION__, r);
***************
*** 703,724 ****
  		outb(efdr, inb(efdr) & ~(WINB_PRTMODS0 | WINB_PRTMODS1));
  
  		if (chipset_mode & PPB_ECP) {
! 			if (chipset_mode & PPB_EPP)
  				outb(efdr, inb(efdr) | WINB_ECP_EPP);
! 			else
  				outb(efdr, inb(efdr) | WINB_ECP);
  		} else {
  			/* select EPP_SPP otherwise */
  			outb(efdr, inb(efdr) | WINB_EPP_SPP);
  		}
  		ppc->ppc_avm = chipset_mode;
  	}
  	
  	/* exit configuration mode */
  	outb(efer, 0xaa);
  
! 	if (ppc->ppc_avm & PPB_ECP)
! 		ppc_ecp_config(ppc, chipset_mode);
  
  	return (chipset_mode);
  }
--- 735,768 ----
  		outb(efdr, inb(efdr) & ~(WINB_PRTMODS0 | WINB_PRTMODS1));
  
  		if (chipset_mode & PPB_ECP) {
! 			if (chipset_mode & PPB_EPP) {
  				outb(efdr, inb(efdr) | WINB_ECP_EPP);
! 				if (bootverbose)
! 					printf(" ECP+EPP");
! 
! 				ppc->ppc_link.adapter = &ppc_smclike_adapter;
! 
! 			} else {
  				outb(efdr, inb(efdr) | WINB_ECP);
+ 				if (bootverbose)
+ 					printf(" ECP");
+ 			}
  		} else {
  			/* select EPP_SPP otherwise */
  			outb(efdr, inb(efdr) | WINB_EPP_SPP);
+ 			if (bootverbose)
+ 				printf(" EPP SPP");
  		}
  		ppc->ppc_avm = chipset_mode;
  	}
+ 
+ 	if (bootverbose)
+ 		printf("\n");
  	
  	/* exit configuration mode */
  	outb(efer, 0xaa);
  
! 	ppc->ppc_link.adapter->setmode(ppc->ppc_unit, chipset_mode);
  
  	return (chipset_mode);
  }
***************
*** 731,741 ****
--- 775,793 ----
  {
  	char save_control;
  
+ 	/* default to generic */
+ 	ppc->ppc_link.adapter = &ppc_generic_adapter;
+ 
+ 	if (bootverbose)
+ 		printf("ppc%d:", ppc->ppc_unit);
+ 
  	if (!chipset_mode) {
  		/* first, check for ECP */
  		w_ecr(ppc, 0x20);
  		if ((r_ecr(ppc) & 0xe0) == 0x20) {
  			ppc->ppc_avm |= PPB_ECP | PPB_SPP;
+ 			if (bootverbose)
+ 				printf(" ECP SPP");
  
  			/* search for SMC style ECP+EPP mode */
  			w_ecr(ppc, 0x80);
***************
*** 745,763 ****
  		if (ppc_check_epp_timeout(ppc)) {
  			ppc->ppc_avm |= PPB_EPP;
  
! 			if (ppc->ppc_avm & PPB_ECP)
  				/* SMC like chipset found */
  				ppc->ppc_type = SMC_LIKE;
  		}
  
! 		/* XXX try to detect NIBBLE mode */
  		ppc->ppc_avm |= PPB_NIBBLE;
  
! 	} else
  		ppc->ppc_avm = chipset_mode;
  
! 	if (ppc->ppc_avm & PPB_ECP)
! 		ppc_ecp_config(ppc, chipset_mode);
  
  	return (chipset_mode);
  }
--- 797,832 ----
  		if (ppc_check_epp_timeout(ppc)) {
  			ppc->ppc_avm |= PPB_EPP;
  
! 			if (ppc->ppc_avm & PPB_ECP) {
  				/* SMC like chipset found */
  				ppc->ppc_type = SMC_LIKE;
+ 				ppc->ppc_link.adapter = &ppc_smclike_adapter;
+ 
+ 				if (bootverbose)
+ 					printf(" ECP+EPP");
+ 			} else {
+ 				if (bootverbose)
+ 					printf(" EPP");
+ 			}
+ 		} else {
+ 			/* restore to standard mode */
+ 			w_ecr(ppc, 0x0);
  		}
  
! 		/* XXX try to detect NIBBLE and PS2 modes */
  		ppc->ppc_avm |= PPB_NIBBLE;
  
! 		if (bootverbose)
! 			printf(" SPP");
! 
! 	} else {
  		ppc->ppc_avm = chipset_mode;
+ 	}
+ 
+ 	if (bootverbose)
+ 		printf("\n");
  
! 	ppc->ppc_link.adapter->setmode(ppc->ppc_unit, chipset_mode);
  
  	return (chipset_mode);
  }
***************
*** 1028,1041 ****
  		return (EOPNOTSUPP);
  
  	/* if ECP mode, configure ecr register */
! 	if (ppc->ppc_avm & PPB_ECP)
! 		ppc_ecp_config(ppc, mode);
  
  	ppc->ppc_mode = mode;
  
  	return (0);
  }
  
  /*
   * EPP timeout, according to the PC87332 manual
   * Semantics of clearing EPP timeout bit.
--- 1097,1162 ----
  		return (EOPNOTSUPP);
  
  	/* if ECP mode, configure ecr register */
! 	if (ppc->ppc_avm & PPB_ECP) {
  
+ 		/* XXX disable DMA, enable interrupts */
+ 		if (mode & PPB_EPP)
+ 			return (EOPNOTSUPP);
+ 		else if (mode & PPB_PS2)
+ 			/* select PS2 mode with ECP */
+ 			w_ecr(ppc, 0x20);
+ 		else if (mode & PPB_ECP)
+ 			/* select ECP mode */
+ 			w_ecr(ppc, 0x60);
+ 		else
+ 			/* select standard parallel port mode */
+ 			w_ecr(ppc, 0x00);
+ 	}
+ 
  	ppc->ppc_mode = mode;
  
  	return (0);
  }
  
+ int
+ ppc_smclike_setmode(int unit, int mode)
+ {
+ 	struct ppc_data *ppc = ppcdata[unit];
+ 
+ 	/* back to compatible mode, XXX don't know yet what to do here */
+ 	if (mode == 0) {
+ 		ppc->ppc_mode = PPB_COMPATIBLE;
+ 		return (0);
+ 	}
+ 
+ 	/* check if mode is available */
+ 	if (!(ppc->ppc_avm & mode))
+ 		return (EOPNOTSUPP);
+ 
+ 	/* if ECP mode, configure ecr register */
+ 	if (ppc->ppc_avm & PPB_ECP) {
+ 
+ 		/* XXX disable DMA, enable interrupts */
+ 		if (mode & PPB_EPP)
+ 			/* select EPP mode */
+ 			w_ecr(ppc, 0x80);
+ 		else if (mode & PPB_PS2)
+ 			/* select PS2 mode with ECP */
+ 			w_ecr(ppc, 0x20);
+ 		else if (mode & PPB_ECP)
+ 			/* select ECP mode */
+ 			w_ecr(ppc, 0x60);
+ 		else
+ 			/* select standard parallel port mode */
+ 			w_ecr(ppc, 0x00);
+ 	}
+ 
+ 	ppc->ppc_mode = mode;
+ 
+ 
+ 	return (0);
+ }
+ 
  /*
   * EPP timeout, according to the PC87332 manual
   * Semantics of clearing EPP timeout bit.
***************
*** 1099,1106 ****
  	ppc->ppc_epp = (dvp->id_flags & 0x10) >> 4;
  
  	/*
! 	 * XXX
! 	 * Try and detect if interrupts are working.
  	 */
  	if (!(dvp->id_flags & 0x20))
  		ppc->ppc_irq = (dvp->id_irq);
--- 1220,1226 ----
  	ppc->ppc_epp = (dvp->id_flags & 0x10) >> 4;
  
  	/*
! 	 * XXX Try and detect if interrupts are working
  	 */
  	if (!(dvp->id_flags & 0x20))
  		ppc->ppc_irq = (dvp->id_irq);
***************
*** 1109,1114 ****
--- 1229,1241 ----
  	nppc ++;
  
  	/*
+ 	 * Link the Parallel Port Chipset (adapter) to
+ 	 * the future ppbus. Default to a generic chipset
+ 	 */
+ 	ppc->ppc_link.adapter_unit = ppc->ppc_unit;
+ 	ppc->ppc_link.adapter = &ppc_generic_adapter;
+ 
+ 	/*
  	 * Try to detect the chipset and its mode.
  	 */
  	if (ppc_detect(ppc, dvp->id_flags & 0xf))
***************
*** 1128,1140 ****
  	struct ppc_data *ppc = ppcdata[isdp->id_unit];
  	struct ppb_data *ppbus;
  	char * mode;
- 
- 	/*
- 	 * Link the Parallel Port Chipset (adapter) to
- 	 * the future ppbus.
- 	 */
- 	ppc->ppc_link.adapter_unit = ppc->ppc_unit;
- 	ppc->ppc_link.adapter = &ppc_adapter;
  
  	printf("ppc%d: %s chipset (%s) in %s mode%s\n", ppc->ppc_unit,
  		ppc_types[ppc->ppc_type], ppc_avms[ppc->ppc_avm],
--- 1255,1260 ----

--k+w/mQv8wyuph6w0--

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



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