From owner-FreeBSD-users-jp@jp.freebsd.org  Mon Jan 24 19:42:27 2000
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id TAA28978;
	Mon, 24 Jan 2000 19:42:27 +0900 (JST)
	(envelope-from owner-FreeBSD-users-jp@jp.FreeBSD.org)
Received: from crest.csce.kyushu-u.ac.jp (crest.csce.kyushu-u.ac.jp [133.5.22.3])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id TAA27539
	for <FreeBSD-users-jp@jp.freebsd.org>; Mon, 24 Jan 2000 19:29:15 +0900 (JST)
	(envelope-from nom@csce.kyushu-u.ac.jp)
Received: from localhost (crest.csce.kyushu-u.ac.jp [133.5.22.3])
	by crest.csce.kyushu-u.ac.jp (8.9.3+3.2W/3.7W99041514) with ESMTP id TAA01651
	for <FreeBSD-users-jp@jp.freebsd.org>; Mon, 24 Jan 2000 19:28:53 +0900 (JST)
To: FreeBSD-users-jp@jp.freebsd.org
From: Yoshinari NOMURA <nom@csce.kyushu-u.ac.jp>
In-Reply-To: <200001180026.JAA05727@edge.sky.yamashina.kyoto.jp>
References: <200001161620.BAA25748@pp.iij4u.or.jp>
	<20000118020840.A317@pop16.odn.ne.jp>
	<200001180026.JAA05727@edge.sky.yamashina.kyoto.jp>
X-Mailer: Mew version 1.94 on Emacs 19.34 / Mule 2.3 (SUETSUMUHANA)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Message-Id: <20000124192851P.nom@csce.kyushu-u.ac.jp>
Date: Mon, 24 Jan 2000 19:28:51 +0900
X-Dispatcher: imput version 990905(IM130)
Lines: 83
Reply-To: FreeBSD-users-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+990727
X-Sequence: FreeBSD-users-jp 49179
Subject: [FreeBSD-users-jp 49179] Re: can't use usb mouse
Errors-To: owner-FreeBSD-users-jp@jp.freebsd.org
Sender: owner-FreeBSD-users-jp@jp.freebsd.org
X-Originator: nom@csce.kyushu-u.ac.jp

$B6eBg!&>pJs$NG5B<$G$9!#(B

# $B85%a!<%k$r$J$/$7$?$N$G!"ESCf$+$i7Q$.LZ$7$F$^$9!#(B

$B$H$"$k;v>p$+$i(B USB $B$r;H$$$?$/$J$C$F!"=5Kv(B Let'snote A44E +
FreeBSD 3.3R + PAO $B$GD)@o$7$F$_$^$7$?!#0l1~$&$^$/$$$C$F$^$9$,!"(B
$B4*$G$d$C$F$k$N$G!"4V0c$C$F$?$i$I$J$?$+;XE&$7$F$$$?$@$1$k$H4r$7$$$G$9!#(B

$B$d$C$?$3$H(B:

   1. $B%+!<%M%k$N(B config $B$G(B options FORCE_IRQ_ROUTING $B$rM-8z$K$9$k!#(B
   2. /sys/dev/usb/uhci.c $B$N(B uhci_reset $B$r0O$&(B #if 0 $B$r30$9!#(B
   3. $BE:IU$N%Q%C%A$r!"(B
      /sys/dev/pci/uhci_pci.c $B$KEv$F$k!#(B
   4. $BIaDL$K(B USB $B$N@_Dj$r$7$F!"%+!<%M%k$r:n$k!#(B
   5. $BIaDL$K(B usbd $BEy$N@_Dj$r$9$k!#(B
   6. $BI,MW$,$"$l$P(B /etc/pccard.conf $B$N(B ignirq $B$K(B 10 $B$rDI2C!#(B

$BE:IU$N%Q%C%A$O!"$/$j$d$^$5$s$N(B VAIO $BMQ$N%Q%C%A(B
  http://home.jp.FreeBSD.ORG/cgi-bin/showmail/tech-jp/1935
$B$r(B 3.3R $B$K9g$&$h$&$K$A$g$C$H$@$1JQ$($F!"(B
IRQ $B$@$1$G$O$J$/(B iobase $B$b@_Dj$9$k$h$&$K$7$?$b$N$G$9!#(B

iobase $B$rL5M}LpM}(B 0xff60 $B$K$7$F$$$k$N$G!"$3$N%Q%C%A$rEv$F$k$H!"(B
$BB>$N%^%7%s$G$OF0$+$J$/$J$k$+$b$7$l$^$;$s!#(B0xff60 $B$H$$$&$N$O!"(B
Windows $B$N$*9p$2$G$9!#(B

6. $B$G$9$,!"(BUSB $B$,(B IRQ 9 $B$r;H$&$h$&$K$J$C$?$*$+$2$G!"(B
pccardd $B$,3dEv$F$k(B IRQ $B$,(B 9 -> 10 $B$K$J$j$^$7$?!#(B
$B$3$l$,$I$&$b$&$^$/$J$$$i$7$/!"(B(Neomagic $B$HEv$?$C$F$k(B?)
pccard.conf $B$G(B ignirq 10 $B$7$F$d$kI,MW$,$"$j$^$7$?!#(B
($B:#Kx!"6vA3Hr$1$i$l$F$$$?$i$7$$!#(B)
--
nom

p.s.  PCI $B$r$$$8$k$N$O$O$8$a$F$@$C$?$N$G!"(B
      $B!V%$%s%?!<%U%'!<%9A}4)(B Vol.3 PCI $B%G%P%$%9@_7WF~Lg!W(B
      $B$H$$$&K\$,;29M$K$J$j$^$7$?!#IUB0$N(B CD-ROM pcitool/ $B$KF~$C(B
      $B$F$$$k(B DOS $BMQ%3%^%s%I$,$J$+$J$+JXMx!#(BWin $B$N$*9p$2$,J9$1$^$9!#(B


--- uhci_pci.c.orig	Mon Aug 30 01:23:42 1999
+++ uhci_pci.c	Mon Jan 24 17:30:55 2000
@@ -143,6 +143,8 @@
 	char *typestr;
 	usbd_status r;
 	uhci_softc_t *sc = NULL;
+	u_int16_t reg;
+	int sc_int;
 
 	sc = malloc(sizeof(uhci_softc_t), M_DEVBUF, M_NOWAIT);
 	/* Do not free it below, intr might use the sc */
@@ -154,6 +156,30 @@
 
 	sc->sc_iobase = pci_conf_read(config_id,PCI_UHCI_BASE_REG) & 0xffe0;
 	sc->unit      = unit;
+
+        /* kuriyama - Enable I/O address space if disabled. */
+	reg = (u_int16_t)pci_cfgread(config_id, PCIR_COMMAND, 2);
+	if (!(reg & PCIM_CMD_PORTEN)) {
+		pci_conf_write(config_id, PCI_UHCI_BASE_REG, 0xff60); /* nom - set iobase for A44E */
+		sc->sc_iobase = pci_conf_read(config_id,PCI_UHCI_BASE_REG) & 0xffe0; /* nom - set iobase for A44E */
+		pci_cfgwrite(config_id, PCIR_COMMAND, reg | PCIM_CMD_PORTEN, 2);
+		printf("usb%d: enable I/O base address.\n", unit);
+	}
+
+	/* kuriyama - Force IRQ routing when IRQ is not assigned. */
+	sc_int = pci_conf_read(config_id, PCI_INTERRUPT_REG) & 0xff;
+	if (sc_int == 0xff) {
+		printf("usb%d: force IRQ routing to 9."
+			"(iobase=0x%04x)(command=0x%04x)(status=0x%04x)\n",
+			unit, sc->sc_iobase,
+			(u_int16_t)(pci_cfgread(config_id, PCIR_COMMAND, 2) & 0xffff),
+			(u_int16_t)(pci_cfgread(config_id, PCIR_STATUS, 2) & 0xffff));
+		pci_conf_write(config_id, PCI_INTERRUPT_REG, 0x00000409ul);
+		sc_int = pci_conf_read(config_id, PCI_INTERRUPT_REG) & 0xff;
+		printf("      (result %d) and reset USB Host Controller.\n", sc_int);
+		config_id->intline = sc_int;
+		uhci_reset(sc);
+	}
 
 	if ( !pci_map_int(config_id, (pci_inthand_t *)uhci_intr,
 			  (void *) sc, &bio_imask)) {
