From owner-freebsd-ppc@FreeBSD.ORG Sun Sep 25 00:59:03 2011 Return-Path: Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8048B106566C; Sun, 25 Sep 2011 00:59:03 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id 2D3F68FC08; Sun, 25 Sep 2011 00:59:02 +0000 (UTC) Received: by ywp17 with SMTP id 17so4483453ywp.13 for ; Sat, 24 Sep 2011 17:59:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=adBXbPf4YBo3TmbTd5fDrk4HZb+xQNwUlJ1oNw8q+Ag=; b=JNuDRjPLfa9m3tkI1wJf8bJ/8xjLGJNHm8ManZVR7Vh/nXbPwcPwWpSBqKB+Z6aEGH SxnW+xel2gDVxFwDiAPxAmTFFWrkQ/RAKbFfWzisDbdnlnngRvtD6cHB2/AlfWyPcoO0 8jSxgAcfCMSt+5dSOCW+h25xR2ftPSGFUakfM= MIME-Version: 1.0 Received: by 10.236.124.97 with SMTP id w61mr30593486yhh.106.1316912342295; Sat, 24 Sep 2011 17:59:02 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.236.111.42 with HTTP; Sat, 24 Sep 2011 17:59:02 -0700 (PDT) In-Reply-To: <9CA9DCD5-2B81-443D-BAC9-1B5D9E703B15@alumni.cwru.edu> References: <9CA9DCD5-2B81-443D-BAC9-1B5D9E703B15@alumni.cwru.edu> Date: Sun, 25 Sep 2011 08:59:02 +0800 X-Google-Sender-Auth: Qk7WPGGUHCRbXgHLJS1zjPfS4mQ Message-ID: From: Adrian Chadd To: Justin Hibbits Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-wireless@freebsd.org, FreeBSD PowerPC ML Subject: Re: if_wi attachment for mac-io X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2011 00:59:03 -0000 On 24 September 2011 23:14, Justin Hibbits wrote: > pci2:0:14:0: reprobing on driver added > wi0: mem 0x30000-0x300ff,0x1a000-0x1a0ff,0-0xff irq 57 on > macio0 > wi0: record read mismatch, rid=fd0b, got=bfd > wi0: using Unknown Lucent chip > wi0: record read mismatch, rid=fd20, got=20fd > wi0: Hermes Firmware: Station (0.0.0) > wi0: Sorry, this card is not supported (type 1, firmware ver 0) > device_attach: wi0 attach returned 45 > > > Is there a way to add a shim underneath the driver, or something else so as > not to be too intrusive to the if_wi driver? Hm, it looks like there's explicit casts to/from little endian in wi_read_rid() and wi_write_rid(). The bus read/write value swapping are already handled for you by the bus glue. What's left are the contents of buffers. I guess read/write_rid are using struct wi_lt_hdr implicitly without actually using the struct. * One form of communication with the Hermes is with what Lucent calls * LTV records, where LTV stands for Length, Type and Value. The length * and type are 16 bits and are in native byte order. The value is in * multiples of 16 bits and is in little endian byte order. If you look at wi_read_bap() and wi_write_bap(), they treat the buffer as a set of 16 bit words being read from WI_DATA0. I'd expect the CSR_READ_2() define to correctly swap the data from device to host order. I wonder about the correct endian-ness of the buffer read - ie, the bus space macro is turning it into a 16 bit host-endian data read. Ie, your PPC is in Big-endian mode, so the le16toh() macro isn't a NULL. I don't know why Bill used le16toh() here, if the length/value fields from the NIC are supposed to be host-order. I suggest just removing the le16toh() and htole16() calls in wi_read_rid() and wi_write_rid() as again these may be host-endian data. Code which calls wi_read_rid() and wi_read_bap() seem to do some explicit endian conversions of data fields but I bet there may be missing ones lurking here and there. So fixing up wi_read_rid() and wi_write_rid() may make probe/attach function, but you may find weird crap occuring. :-) Give that a shot, then look at the openbsd/netbsd wi driver to see if they've investigated and fixed endian issues. :) Adrian From owner-freebsd-ppc@FreeBSD.ORG Sun Sep 25 12:54:48 2011 Return-Path: Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40C95106564A; Sun, 25 Sep 2011 12:54:48 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id DB0A98FC08; Sun, 25 Sep 2011 12:54:47 +0000 (UTC) Received: by gxk26 with SMTP id 26so3665978gxk.13 for ; Sun, 25 Sep 2011 05:54:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:from:to:content-type:mime-version:subject:date:cc :x-mailer; bh=c0+7TD7mBtUy0soq0fv6XlZD9SdaxRbTTZA0Dd5W51w=; b=nhTgIzG247dNBWrN3Z66mFBMNVZ072FLTgbyy04DSLhMde1VKtOkcqZ5dUF59jt1lG CsiEiy7qL0WDFL2WEdruqnqQTI+sgkr5KSxYHKedbXegvjeUFR4tIdn+uu96itvbIsEK U+lAWyoxNlj2qJlxHTdN80WB1xl2tbArVVJ4s= Received: by 10.150.2.20 with SMTP id 20mr3604535ybb.31.1316955287042; Sun, 25 Sep 2011 05:54:47 -0700 (PDT) Received: from triad.knownspace (216-15-41-8.c3-0.gth-ubr1.lnh-gth.md.cable.rcn.com. [216.15.41.8]) by mx.google.com with ESMTPS id o4sm4009197ybc.15.2011.09.25.05.54.45 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 25 Sep 2011 05:54:45 -0700 (PDT) Message-Id: <54FFB452-534A-46C6-950B-880EB36F61C1@gmail.com> From: Justin Hibbits To: FreeBSD PowerPC ML Content-Type: multipart/mixed; boundary=Apple-Mail-15--654334916 Mime-Version: 1.0 (Apple Message framework v936) Date: Sun, 25 Sep 2011 08:54:41 -0400 X-Mailer: Apple Mail (2.936) Cc: freebsd-wireless@freebsd.org Subject: CFT: macio attachment for if_wi X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2011 12:54:48 -0000 --Apple-Mail-15--654334916 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Attached is a patch adding the macio attachment for the if_wi driver, to support the airport card in PowerPC macs. To do this I needed to modify the wi_read_bap and wi_write_bap functions to use the bus space stream functions instead of regular functions, like NetBSD and OpenBSD do. I currently get a 'no carrier' status from ifconfig, so I can't fully test connections, only the attachment. Testing wanted and needed to make sure I didn't break anything. - Justin --Apple-Mail-15--654334916 Content-Disposition: attachment; filename=airport_attach.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="airport_attach.diff" Content-Transfer-Encoding: 7bit Index: modules/wi/Makefile =================================================================== --- modules/wi/Makefile (revision 225715) +++ modules/wi/Makefile (working copy) @@ -6,4 +6,9 @@ SRCS= if_wi.c if_wi_pccard.c if_wi_pci.c \ card_if.h device_if.h bus_if.h pci_if.h pccarddevs.h +.if ${MACHINE_CPUARCH} == "powerpc" +SRCS+= if_wi_macio.c +SRCS+= ofw_bus_if.h +.endif + .include Index: dev/wi/if_wi_macio.c =================================================================== --- dev/wi/if_wi_macio.c (revision 0) +++ dev/wi/if_wi_macio.c (revision 0) @@ -0,0 +1,138 @@ +/*- + * Copyright (c) 1997, 1998, 1999 + * Bill Paul . All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Bill Paul. + * 4. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Lucent WaveLAN/IEEE 802.11 PCMCIA driver for FreeBSD. + * + * Written by Bill Paul + * Electrical Engineering Department + * Columbia University, New York City + */ + +#include +__FBSDID("$FreeBSD: head/sys/dev/wi/if_wi_macio.c 182250 2008-08-27 05:39:44Z imp $"); + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +static int wi_macio_probe(device_t); +static int wi_macio_attach(device_t); + +static device_method_t wi_macio_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, wi_macio_probe), + DEVMETHOD(device_attach, wi_macio_attach), + DEVMETHOD(device_detach, wi_detach), + DEVMETHOD(device_shutdown, wi_shutdown), + + { 0, 0 } +}; + +static driver_t wi_macio_driver = { + "wi", + wi_macio_methods, + sizeof(struct wi_softc) +}; + +DRIVER_MODULE(wi, macio, wi_macio_driver, wi_devclass, 0, 0); +MODULE_DEPEND(wi, wlan, 1, 1, 1); + +static int +wi_macio_probe(device_t dev) +{ + const char *name, *compat; + + /* Make sure we're a network driver */ + name = ofw_bus_get_name(dev); + if (name == NULL) + return (ENXIO); + + if (strcmp(name, "radio") != 0) { + return ENXIO; + } + compat = ofw_bus_get_compat(dev); + if (strcmp(compat, "wireless") != 0) { + return ENXIO; + } + + device_set_desc(dev, "Apple Airport"); + return 0; +} + +static int +wi_macio_attach(device_t dev) +{ + struct wi_softc *sc; + int error; + + sc = device_get_softc(dev); + sc->wi_gone = 0; + sc->wi_bus_type = 0; + + error = wi_alloc(dev, 0); + if (error == 0) { + /* Make sure interrupts are disabled. */ + CSR_WRITE_2(sc, WI_INT_EN, 0); + CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF); + + error = wi_attach(dev); + if (error != 0) + wi_free(dev); + } + return error; +} Index: dev/wi/if_wi.c =================================================================== --- dev/wi/if_wi.c (revision 225715) +++ dev/wi/if_wi.c (working copy) @@ -1897,8 +1897,7 @@ static int wi_read_bap(struct wi_softc *sc, int id, int off, void *buf, int buflen) { - u_int16_t *ptr; - int i, error, cnt; + int error, cnt; if (buflen == 0) return 0; @@ -1907,9 +1906,7 @@ return error; } cnt = (buflen + 1) / 2; - ptr = (u_int16_t *)buf; - for (i = 0; i < cnt; i++) - *ptr++ = CSR_READ_2(sc, WI_DATA0); + CSR_READ_MULTI_STREAM_2(sc, WI_DATA0, (u_int16_t *)buf, cnt); sc->sc_bap_off += cnt * 2; return 0; } @@ -1917,8 +1914,7 @@ static int wi_write_bap(struct wi_softc *sc, int id, int off, void *buf, int buflen) { - u_int16_t *ptr; - int i, error, cnt; + int error, cnt; if (buflen == 0) return 0; @@ -1928,9 +1924,7 @@ return error; } cnt = (buflen + 1) / 2; - ptr = (u_int16_t *)buf; - for (i = 0; i < cnt; i++) - CSR_WRITE_2(sc, WI_DATA0, ptr[i]); + CSR_WRITE_MULTI_STREAM_2(sc, WI_DATA0, (u_int16_t *)buf, cnt); sc->sc_bap_off += cnt * 2; return 0; --Apple-Mail-15--654334916 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit --Apple-Mail-15--654334916-- From owner-freebsd-ppc@FreeBSD.ORG Sun Sep 25 13:38:58 2011 Return-Path: Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 967FC106566B; Sun, 25 Sep 2011 13:38:58 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id 458B48FC0C; Sun, 25 Sep 2011 13:38:57 +0000 (UTC) Received: by ywp17 with SMTP id 17so4712511ywp.13 for ; Sun, 25 Sep 2011 06:38:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=N5vBYpkLdrqTfvsflZaaa3mh+peHtU2cgQOe/gWMV2I=; b=juzbnQjeUd3iF5z5bI+HvfLG1QX/L/+ogiGNuxyIDjS3fsqrYzlsoMf3q6CLhDdotr E9/NUEzIn7rcPLp+RccnuV1017D3/OgcTBd8SXStgyxGtHKNj83iFVdkNGppdrM9n+4x vlTfqGPIWbZyo6WXhQpBXxcdmUUGcbR7AGyjk= MIME-Version: 1.0 Received: by 10.236.79.72 with SMTP id h48mr34320369yhe.4.1316957937587; Sun, 25 Sep 2011 06:38:57 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.236.111.42 with HTTP; Sun, 25 Sep 2011 06:38:57 -0700 (PDT) In-Reply-To: <54FFB452-534A-46C6-950B-880EB36F61C1@gmail.com> References: <54FFB452-534A-46C6-950B-880EB36F61C1@gmail.com> Date: Sun, 25 Sep 2011 21:38:57 +0800 X-Google-Sender-Auth: HexAjqGwz86cNfMbzgvYj8xXNEo Message-ID: From: Adrian Chadd To: Justin Hibbits Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-wireless@freebsd.org, FreeBSD PowerPC ML Subject: Re: CFT: macio attachment for if_wi X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2011 13:38:58 -0000 On 25 September 2011 20:54, Justin Hibbits wrote: > Attached is a patch adding the macio attachment for the if_wi driver, to > support the airport card in PowerPC macs. =A0To do this I needed to modif= y the > wi_read_bap and wi_write_bap functions to use the bus space stream functi= ons > instead of regular functions, like NetBSD and OpenBSD do. =A0I currently = get a > 'no carrier' status from ifconfig, so I can't fully test connections, onl= y > the attachment. =A0Testing wanted and needed to make sure I didn't break > anything. I think it's worth digging into exactly why this works. Can we find out whether the card firmware does magically speak host endian? Since you haven't seen it associate to anything yet, I can't help but wonder if there are lots of other random endianness issues creeping throughout the driver. Adrian From owner-freebsd-ppc@FreeBSD.ORG Mon Sep 26 01:34:10 2011 Return-Path: Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4093106564A; Mon, 26 Sep 2011 01:34:10 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id 5294F8FC0C; Mon, 26 Sep 2011 01:34:10 +0000 (UTC) Received: by gxk26 with SMTP id 26so3981035gxk.13 for ; Sun, 25 Sep 2011 18:34:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=cc:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; bh=ceEAXL5g0pmrQQ6MpHuYK/RXEu3vnMw4Gfn1R7RppdM=; b=bIe79AbNHQiRO0UXAr2gQeBNPwA28PIv4wbg63lzQlurPaEnAi6olnTnZoMiCDzTqa ZdxtonK1wT/SUm6Axi83zrs64K/t+ETggQy3Vty+cA5jFahCedaXxxj3EwU4U8xcl46m cbUZA2l8wHrr9Wr/7d8xL7reY+Oz5Hmz0miNw= Received: by 10.236.177.66 with SMTP id c42mr35889661yhm.14.1317000849589; Sun, 25 Sep 2011 18:34:09 -0700 (PDT) Received: from triad.knownspace (216-15-41-8.c3-0.gth-ubr1.lnh-gth.md.cable.rcn.com. [216.15.41.8]) by mx.google.com with ESMTPS id f24sm26330905yhk.5.2011.09.25.18.34.08 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 25 Sep 2011 18:34:08 -0700 (PDT) Message-Id: <28BBDF20-2B20-4D0F-ADBD-84F0595352AA@gmail.com> From: Justin Hibbits To: Adrian Chadd In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Date: Sun, 25 Sep 2011 21:34:05 -0400 References: <4D05F135-FAD8-4C15-A942-D99F4F552FF6@gmail.com> <4E7ADA31.10307@freebsd.org> X-Mailer: Apple Mail (2.936) Cc: freebsd-wireless@freebsd.org, FreeBSD PowerPC ML Subject: Re: if_bwi on PowerBook G4 X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2011 01:34:10 -0000 On Sep 22, 2011, at 3:06 AM, Adrian Chadd wrote: > Can someone please go over this with a fine tooth endian comb? > > This smells to me like endian issues. > > > > Adrian I haven't looked at the driver, but I can report success using it now. I'm able to associate and link, but it won't scan. I still see the 'invalid antenna gain' message, too. - Justin From owner-freebsd-ppc@FreeBSD.ORG Mon Sep 26 01:50:13 2011 Return-Path: Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99CBD106566B; Mon, 26 Sep 2011 01:50:13 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id 322BB8FC0A; Mon, 26 Sep 2011 01:50:12 +0000 (UTC) Received: by yxk36 with SMTP id 36so5006573yxk.13 for ; Sun, 25 Sep 2011 18:50:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=IaillGbmdsoBeWfS6K+tWeCN1WEvV6wzQXYUwMCQx4s=; b=ozvCmTgOmHtHyKPwJswwqQCMOfDbB94Sp0yNPAKZN/0fVezXpnspuKNskVZBi4Ol9o wmAevWoIcBK/WURj1vnxE3E79MPn/aDD0+tvJ1ewYAmQwmDyMifanXSqPnQ7GYpQKyPN BHlSzU2Nc3d+TgcdI4fgv2HDVNvvf4hCS9erw= MIME-Version: 1.0 Received: by 10.236.129.242 with SMTP id h78mr35727720yhi.89.1317001812359; Sun, 25 Sep 2011 18:50:12 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.236.111.42 with HTTP; Sun, 25 Sep 2011 18:50:12 -0700 (PDT) In-Reply-To: <28BBDF20-2B20-4D0F-ADBD-84F0595352AA@gmail.com> References: <4D05F135-FAD8-4C15-A942-D99F4F552FF6@gmail.com> <4E7ADA31.10307@freebsd.org> <28BBDF20-2B20-4D0F-ADBD-84F0595352AA@gmail.com> Date: Mon, 26 Sep 2011 09:50:12 +0800 X-Google-Sender-Auth: 8NgbdOI0r5zwFqfd9MiFoYSa7Lc Message-ID: From: Adrian Chadd To: Justin Hibbits Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-wireless@freebsd.org, FreeBSD PowerPC ML Subject: Re: if_bwi on PowerBook G4 X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2011 01:50:13 -0000 On 26 September 2011 09:34, Justin Hibbits wrote: > I haven't looked at the driver, but I can report success using it now. = =A0I'm > able to associate and link, but it won't scan. =A0I still see the 'invali= d > antenna gain' message, too. Is someone able to grab a bwi and throw it in a PC and PPC device, and add appropriate debug code to dump the contents of the EEPROM? I'd like to compare what values its reading. Thanks, Adrian From owner-freebsd-ppc@FreeBSD.ORG Mon Sep 26 02:17:56 2011 Return-Path: Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC5ED1065673; Mon, 26 Sep 2011 02:17:56 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 29A468FC0C; Mon, 26 Sep 2011 02:17:55 +0000 (UTC) Received: by fxg9 with SMTP id 9so7029924fxg.13 for ; Sun, 25 Sep 2011 19:17:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=1aGEz2Ym9PO8+umRYWFCVPV3JqfygNcg1S8rTvnJsKA=; b=OSQkP3EVd9XvpE9qwdOkrTnvMtn2p1oR5obfaSOwanCCfcB33VJnp9Wp7MtP6xYnOA sC7x5/2AZk6J/fS3Wt/At1jits2q4bMHwhQZjqvDCZFDCanVU6mxKP5PnZz8rvu39mjM gLMzUKYJ5q1k7MsXGODKx4Nt0NbXmplvTGWIQ= Received: by 10.223.23.142 with SMTP id r14mr9691203fab.60.1317002062166; Sun, 25 Sep 2011 18:54:22 -0700 (PDT) Received: from pyunyh@gmail.com ([174.35.1.224]) by mx.google.com with ESMTPS id u6sm18460100faf.3.2011.09.25.18.54.18 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 25 Sep 2011 18:54:20 -0700 (PDT) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Sun, 25 Sep 2011 18:52:15 -0700 From: YongHyeon PYUN Date: Sun, 25 Sep 2011 18:52:15 -0700 To: Justin Hibbits Message-ID: <20110926015215.GB1702@michelle.cdnetworks.com> References: <54FFB452-534A-46C6-950B-880EB36F61C1@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54FFB452-534A-46C6-950B-880EB36F61C1@gmail.com> User-Agent: Mutt/1.4.2.3i Cc: freebsd-wireless@freebsd.org, FreeBSD PowerPC ML Subject: Re: CFT: macio attachment for if_wi X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2011 02:17:56 -0000 On Sun, Sep 25, 2011 at 08:54:41AM -0400, Justin Hibbits wrote: > Attached is a patch adding the macio attachment for the if_wi driver, > to support the airport card in PowerPC macs. To do this I needed to > modify the wi_read_bap and wi_write_bap functions to use the bus space > stream functions instead of regular functions, like NetBSD and OpenBSD > do. I currently get a 'no carrier' status from ifconfig, so I can't > fully test connections, only the attachment. Testing wanted and > needed to make sure I didn't break anything. > It seems the WI_DATA0/WI_DATA1 registers provide access to data with FIFO style. This indicates driver have to read raw data and subsequent access would have to use htoleXX() macro to compare it with the raw data instead of converting it from little-endian to host byte order. So your patch looks like the first step that goes to right direction. As Adrian said, there could be multiple places that used wrong data from endianess view. BTW, you may have to implement suspend/resume method to properly stop driver before entering into suspend. > - Justin From owner-freebsd-ppc@FreeBSD.ORG Mon Sep 26 02:20:05 2011 Return-Path: Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B7961065673; Mon, 26 Sep 2011 02:20:05 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id C3CC98FC0A; Mon, 26 Sep 2011 02:20:04 +0000 (UTC) Received: by gxk26 with SMTP id 26so4004526gxk.13 for ; Sun, 25 Sep 2011 19:20:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=lL+CRDRj+wRvUJwjT7mn3OtcKGeh3FzuN2+bPqw/6eI=; b=XFDxjfy4FKw1MGAYmcqfRoC0vRm8vm4WKlXbZamY68N30KpJ53n+b8QsDizkiqXp+e 8fA5GbxazBlWa/heZXQoq59lqKD3dIGnwfsGbXiKZ+rqez5X9yib086kKtSmjJA9zhSJ 9B1LCXXz/p/Q4UzzzX2CZkVuoS/4QPxAZr7eA= MIME-Version: 1.0 Received: by 10.236.129.165 with SMTP id h25mr35841431yhi.38.1317003603959; Sun, 25 Sep 2011 19:20:03 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.236.111.42 with HTTP; Sun, 25 Sep 2011 19:20:03 -0700 (PDT) In-Reply-To: <20110926015215.GB1702@michelle.cdnetworks.com> References: <54FFB452-534A-46C6-950B-880EB36F61C1@gmail.com> <20110926015215.GB1702@michelle.cdnetworks.com> Date: Mon, 26 Sep 2011 10:20:03 +0800 X-Google-Sender-Auth: HF3z2s-DfKvhwCFy6OzEiE7UEyg Message-ID: From: Adrian Chadd To: pyunyh@gmail.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-wireless@freebsd.org, Justin Hibbits , FreeBSD PowerPC ML Subject: Re: CFT: macio attachment for if_wi X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2011 02:20:05 -0000 On 26 September 2011 09:52, YongHyeon PYUN wrote: > It seems the WI_DATA0/WI_DATA1 registers provide access to data > with FIFO style. =A0This indicates driver have to read raw data and > subsequent access would have to use htoleXX() macro to compare it > with the raw data instead of converting it from little-endian to > host byte order. > So your patch looks like the first step that goes to right > direction. =A0As Adrian said, there could be multiple places that > used wrong data from endianess view. Cool; I'll try to remember to get this committed to -HEAD once it's unlocked for bug fixes. Adrian From owner-freebsd-ppc@FreeBSD.ORG Mon Sep 26 11:07:08 2011 Return-Path: Delivered-To: freebsd-ppc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CE6A10656B9 for ; Mon, 26 Sep 2011 11:07:08 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 8BA7F8FC16 for ; Mon, 26 Sep 2011 11:07:08 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p8QB78Ki088236 for ; Mon, 26 Sep 2011 11:07:08 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p8QB77Dv088234 for freebsd-ppc@FreeBSD.org; Mon, 26 Sep 2011 11:07:07 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 26 Sep 2011 11:07:07 GMT Message-Id: <201109261107.p8QB77Dv088234@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-ppc@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-ppc@FreeBSD.org X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2011 11:07:08 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o power/149009 ppc sysinstall(8) on powerpc fails to install manpages, so o power/140241 ppc [kernel] [patch] Linker set problems on PowerPC EABI o power/135576 ppc gdb cannot debug threaded programs on ppc o power/133503 ppc [sound] Sound stutter after switching ttys o power/133382 ppc [install] Installer gets signal 11 o power/131548 ppc ofw_syscons no longer supports 32-bit framebuffer 6 problems total. From owner-freebsd-ppc@FreeBSD.ORG Mon Sep 26 23:20:09 2011 Return-Path: Delivered-To: freebsd-ppc@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC2141065675 for ; Mon, 26 Sep 2011 23:20:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B038D8FC0C for ; Mon, 26 Sep 2011 23:20:09 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p8QNK96V062573 for ; Mon, 26 Sep 2011 23:20:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p8QNK9MG062572; Mon, 26 Sep 2011 23:20:09 GMT (envelope-from gnats) Resent-Date: Mon, 26 Sep 2011 23:20:09 GMT Resent-Message-Id: <201109262320.p8QNK9MG062572@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ppc@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Justin Hibbits Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62C031065675 for ; Mon, 26 Sep 2011 23:13:42 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 52E8E8FC23 for ; Mon, 26 Sep 2011 23:13:42 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p8QNDg8p049689 for ; Mon, 26 Sep 2011 23:13:42 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p8QNDgD4049677; Mon, 26 Sep 2011 23:13:42 GMT (envelope-from nobody) Message-Id: <201109262313.p8QNDgD4049677@red.freebsd.org> Date: Mon, 26 Sep 2011 23:13:42 GMT From: Justin Hibbits To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: powerpc/161045: X doesn't detect ADB mouse up event until another event is made X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2011 23:20:10 -0000 >Number: 161045 >Category: powerpc >Synopsis: X doesn't detect ADB mouse up event until another event is made >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ppc >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Sep 26 23:20:09 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Justin Hibbits >Release: 9-CURRENT >Organization: >Environment: FreeBSD minbar 9.0-BETA2 FreeBSD 9.0-BETA2 #9 r225702M: Sun Sep 25 21:42:00 EDT 2011 root@minbar:/usr/obj/usr/src/sys/MINBAR powerpc >Description: When in X on a Titanium PowerBook G4, probably any other ADB-based mac, a mouse up event isn't registered (button isn't registered as clicked) until I move the mouse. I don't know if this is a property of the ADB bus, or if it's a bug in the driver. >How-To-Repeat: Run FreeBSD+Xorg on an ADB mac. In this case I ran wmaker. >Fix: >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-ppc@FreeBSD.ORG Wed Sep 28 00:55:38 2011 Return-Path: Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7581106566C; Wed, 28 Sep 2011 00:55:38 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id 2CF948FC14; Wed, 28 Sep 2011 00:55:38 +0000 (UTC) Received: by yxk36 with SMTP id 36so7450767yxk.13 for ; Tue, 27 Sep 2011 17:55:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=cc:message-id:from:to:in-reply-to:content-type:mime-version:subject :date:references:x-mailer; bh=4hVYUNkyqeA8pJYn4VoLFzzaIMMZ9RMQufYxgHfXBvw=; b=s8xBybaozBTD+H1Cc989mV8I8AoRV7Htz255bjpBy0L8ZYPmyIEAZDnwEmL6O0zqB5 nU2e5AdtCIQcD5rHMcBQphHYYT0/NvWuhHPKeQO3Ecx7UYkq3ZXF3UlXpeiyDzzCEIs4 Uy5nvGPoMY/bvIqVnAi3g98O2ZVMxCq8h0Sw8= Received: by 10.236.170.3 with SMTP id o3mr51391616yhl.108.1317171337584; Tue, 27 Sep 2011 17:55:37 -0700 (PDT) Received: from triad.knownspace (216-15-41-8.c3-0.gth-ubr1.lnh-gth.md.cable.rcn.com. [216.15.41.8]) by mx.google.com with ESMTPS id s19sm83588183anm.20.2011.09.27.17.55.35 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 27 Sep 2011 17:55:36 -0700 (PDT) Message-Id: From: Justin Hibbits To: Adrian Chadd In-Reply-To: Content-Type: multipart/mixed; boundary=Apple-Mail-18--438282869 Mime-Version: 1.0 (Apple Message framework v936) Date: Tue, 27 Sep 2011 20:55:33 -0400 References: <4D05F135-FAD8-4C15-A942-D99F4F552FF6@gmail.com> <4E7ADA31.10307@freebsd.org> <28BBDF20-2B20-4D0F-ADBD-84F0595352AA@gmail.com> X-Mailer: Apple Mail (2.936) Cc: freebsd-wireless@freebsd.org, FreeBSD PowerPC ML Subject: Re: if_bwi on PowerBook G4 X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2011 00:55:38 -0000 --Apple-Mail-18--438282869 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit On Sep 25, 2011, at 9:50 PM, Adrian Chadd wrote: > On 26 September 2011 09:34, Justin Hibbits > wrote: > >> I haven't looked at the driver, but I can report success using it >> now. I'm >> able to associate and link, but it won't scan. I still see the >> 'invalid >> antenna gain' message, too. > > Is someone able to grab a bwi and throw it in a PC and PPC device, and > add appropriate debug code to dump the contents of the EEPROM? > I'd like to compare what values its reading. > > Thanks, > > > Adrian Hi Adrian, As you requested, here's a dump of the first 128 bytes of the SPROM, of my Linksys WPC54G, attached. I only have it from my TiBook, but I dumped raw and cooked words. The log includes everything from module load with verbose boot. - Justin --Apple-Mail-18--438282869 Content-Disposition: attachment; filename=dmesg.log Content-Type: application/octet-stream; x-unix-mode=0644; name="dmesg.log" Content-Transfer-Encoding: 7bit pci0: driver added pci1: driver added pci2: driver added found-> vendor=0x11c1, dev=0x5811, revid=0x00 domain=2, bus=0, slot=14, func=0 class=0c-00-10, hdrtype=0x00, mfdev=0 cmdreg=0x0006, statreg=0x0290, cachelnsz=8 (dwords) lattimer=0x10 (480 ns), mingnt=0x0c (3000 ns), maxlat=0x18 (6000 ns) intpin=a, irq=40 powerspec 2 supports D0 D1 D2 D3 current D0 pci2:0:14:0: reprobing on driver added found-> vendor=0x14e4, dev=0x4318, revid=0x02 domain=1, bus=1, slot=0, func=0 class=02-80-00, hdrtype=0x00, mfdev=0 cmdreg=0x0002, statreg=0x0000, cachelnsz=0 (dwords) lattimer=0xa8 (5040 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns) intpin=a, irq=58 pci1:1:0:0: reprobing on driver added bwi0: mem 0x88000000-0x88001fff irq 58 at device 0.0 on cardbus0 uninorth mapdev: start 88000000, len 8192 cbb0: Opening memory: cbb0: Normal: 0x88000000-0x88001fff 0: 2001 0000 0048 1737 8: 4318 8000 0002 0000 10: 1000 1800 0000 0000 18: ffff ffff ffff ffff 20: ffff ffff ffff ffff 28: ffff ffff ffff ffff 30: ffff ffff ffff ffff 38: 0000 ffff ffff ffff 40: ffff ffff ffff ffff 48: 0018 f8ff 9fae ffff 50: ffff ffff ffff ffff 58: ffff ffff 3031 1612 60: faba fe98 ffff ffff 68: 004c ffff ffff ffff 70: 003e 248 ff02 5553 78: ff10 ffff ffff 6002 Raw 0: 0120 0000 4800 3717 8: 1843 0080 0200 0000 10: 0010 0018 0000 0000 18: ffff ffff ffff ffff 20: ffff ffff ffff ffff 28: ffff ffff ffff ffff 30: ffff ffff ffff ffff 38: 0000 ffff ffff ffff 40: ffff ffff ffff ffff 48: 1800 fff8 ae9f ffff 50: ffff ffff ffff ffff 58: ffff ffff 3130 1216 60: bafa 98fe ffff ffff 68: 4c00 ffff ffff ffff 70: 3e00 4802 02ff 5355 78: 10ff ffff ffff 0260 bwi0: BBP: id 0x4318, rev 0x2, pkg 2 bwi0: MAC: rev 9 bwi0: PHY: type 2, rev 7, ver 3 bwi0: RF: manu 0x17f, type 0x2050, rev 8 bwi0: invalid antenna gain in sprom bwi0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps bwi0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps --Apple-Mail-18--438282869 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit --Apple-Mail-18--438282869-- From owner-freebsd-ppc@FreeBSD.ORG Wed Sep 28 01:54:28 2011 Return-Path: Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 980D8106566C; Wed, 28 Sep 2011 01:54:28 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id 463328FC08; Wed, 28 Sep 2011 01:54:27 +0000 (UTC) Received: by ywp17 with SMTP id 17so7508104ywp.13 for ; Tue, 27 Sep 2011 18:54:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=WLw3OagjnYEFax4JpJ6bPVpxPiz57Bj4CGUb+jOCp80=; b=Vp6/Ma2Vgt4GuGx+eOMvsn9j9ZQUyGgsKPn0sLG6j0FbbgYUC6cXbqRaT5XHz9V+zM v/qSZj66ca26vouDdFcWurqA6h5wEKwtAwwteKEFHD5XlzQ4NAZKh5aQjJpGd5xOhV2h deeSfHxZ0UIVJ/y8dxqITDF2MhfxdV53tOCaY= MIME-Version: 1.0 Received: by 10.236.129.242 with SMTP id h78mr51945823yhi.89.1317174867457; Tue, 27 Sep 2011 18:54:27 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.236.111.42 with HTTP; Tue, 27 Sep 2011 18:54:27 -0700 (PDT) In-Reply-To: References: <54FFB452-534A-46C6-950B-880EB36F61C1@gmail.com> <20110926015215.GB1702@michelle.cdnetworks.com> Date: Wed, 28 Sep 2011 09:54:27 +0800 X-Google-Sender-Auth: WCjiYwm7pf4NxxgexRGtE7JWEQ0 Message-ID: From: Adrian Chadd To: pyunyh@gmail.com Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-wireless@freebsd.org, Justin Hibbits , FreeBSD PowerPC ML Subject: Re: CFT: macio attachment for if_wi X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2011 01:54:28 -0000 .. hm, I can't really commit this to -HEAD without first testing the i386 wavelan support wouldn't be further broken. I'll see if I can dig up some wavelan hardware and a pccard -> pci interface. Adrian From owner-freebsd-ppc@FreeBSD.ORG Sat Oct 1 01:18:24 2011 Return-Path: Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E55C106564A for ; Sat, 1 Oct 2011 01:18:24 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id BE4A18FC0A for ; Sat, 1 Oct 2011 01:18:23 +0000 (UTC) Received: by ywp17 with SMTP id 17so2524197ywp.13 for ; Fri, 30 Sep 2011 18:18:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:from:to:content-type:mime-version:subject:date:x-mailer; bh=ZSY0UAVoh/z0hWuX9mcGffSPtugHgMBvo5SHo5IB+s4=; b=mDHAeRWQB5X3mPqW7OtiHkCjdcmldjHYoHKU0Ro6AH7V+FcGNG5HolnBnVZcxT9m80 VH3Gz/505yuaxoM0vv9v+rA1OLIB/XVqBzXPNkcOfyuWYdLy6S4m4WossMhUc/nPJGQb tNlHaxb7n7avGQbVibhhpqu6kn+V/oQCwlXqk= Received: by 10.236.144.136 with SMTP id n8mr15316056yhj.12.1317431903045; Fri, 30 Sep 2011 18:18:23 -0700 (PDT) Received: from triad.knownspace (216-15-41-8.c3-0.gth-ubr1.lnh-gth.md.cable.rcn.com. [216.15.41.8]) by mx.google.com with ESMTPS id p14sm18403145anh.25.2011.09.30.18.18.21 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 30 Sep 2011 18:18:21 -0700 (PDT) Message-Id: From: Justin Hibbits To: FreeBSD PowerPC ML Content-Type: multipart/mixed; boundary=Apple-Mail-19--177719763 Mime-Version: 1.0 (Apple Message framework v936) Date: Fri, 30 Sep 2011 21:18:16 -0400 X-Mailer: Apple Mail (2.936) Subject: Call for testing/comments: ADB 'extra' keys driver X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Oct 2011 01:18:24 -0000 --Apple-Mail-19--177719763 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit The attached patch adds support for the 'default' Fn keys on the PowerBook keyboards. It presents the keypresses as devd notifications, and includes a sysctl to set default or function key behavior as primary. Really want tests and comments. It works on my TiBook, but I'd like comments on the devd/devctl notifications, they could be improved. - Justin --Apple-Mail-19--177719763 Content-Disposition: attachment; filename=adb_buttons.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="adb_buttons.diff" Content-Transfer-Encoding: 7bit Index: sys/dev/adb/adb_buttons.c =================================================================== --- sys/dev/adb/adb_buttons.c (revision 0) +++ sys/dev/adb/adb_buttons.c (revision 0) @@ -0,0 +1,160 @@ +/* $OpenBSD: abtn.c,v 1.12 2009/01/10 18:00:59 robert Exp $ */ +/* $NetBSD: abtn.c,v 1.1 1999/07/12 17:48:26 tsubai Exp $ */ + +/*- + * Copyright (c) 2002, Miodrag Vallat. + * Copyright (C) 1999 Tsubai Masanari. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include + +#define ABTN_HANDLER_ID 31 + +struct abtn_softc { + device_t sc_dev; + + int handler_id; +}; + +static int abtn_probe(device_t dev); +static int abtn_attach(device_t dev); +static u_int abtn_receive_packet(device_t dev, u_char status, + u_char command, u_char reg, int len, u_char *data); + +static device_method_t abtn_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, abtn_probe), + DEVMETHOD(device_attach, abtn_attach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + + /* ADB interface */ + DEVMETHOD(adb_receive_packet, abtn_receive_packet), + + { 0, 0 } +}; + +static driver_t abtn_driver = { + "abtn", + abtn_methods, + sizeof(struct abtn_softc), +}; + +static devclass_t abtn_devclass; + +DRIVER_MODULE(abtn, adb, abtn_driver, abtn_devclass, 0, 0); + +static int +abtn_probe(device_t dev) +{ + uint8_t type; + + type = adb_get_device_type(dev); + + if (type != ADB_DEVICE_MISC) + return (ENXIO); + + device_set_desc(dev,"ADB Brightness/volume/eject buttons"); + return (0); +} + +static int +abtn_attach(device_t dev) +{ + struct abtn_softc *sc; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + + sc->handler_id = adb_get_device_handler(dev); + + return 0; +} + +static u_int +abtn_receive_packet(device_t dev, u_char status, + u_char command, u_char reg, int len, u_char *data) +{ + u_int cmd; + + cmd = data[0]; + + switch (cmd) { + case 0x0a: /* decrease brightness */ + if (devctl_process_running()) + devctl_notify("PMU", "keys", "brightness", "notify=down"); + break; + + case 0x09: /* increase brightness */ + if (devctl_process_running()) + devctl_notify("PMU", "keys", "brightness", "notify=up"); + break; + + case 0x08: /* mute */ + case 0x01: /* mute, AV hardware */ + if (devctl_process_running()) + devctl_notify("PMU", "keys", "mute", NULL); + break; + case 0x07: /* decrease volume */ + case 0x02: /* decrease volume, AV hardware */ + if (devctl_process_running()) + devctl_notify("PMU", "keys", "volume", "notify=down"); + break; + case 0x06: /* increase volume */ + case 0x03: /* increase volume, AV hardware */ + if (devctl_process_running()) + devctl_notify("PMU", "keys", "volume", "notify=up"); + break; + case 0x0c: /* mirror display key */ + /* Need callback to do something with this */ + break; + case 0x0b: /* eject tray */ + if (devctl_process_running()) + devctl_notify("PMU", "keys", "eject", NULL); + case 0x7f: /* numlock */ + /* Need callback to do something with this */ + break; + + default: +#ifdef DEBUG + if ((cmd & ~0x7f) == 0) + device_printf(dev, "unknown ADB button 0x%x\n", cmd); +#endif + break; + } + return 0; +} Index: sys/dev/adb/adb_kbd.c =================================================================== --- sys/dev/adb/adb_kbd.c (revision 225817) +++ sys/dev/adb/adb_kbd.c (working copy) @@ -35,12 +35,15 @@ #include #include #include +#include #include #include "opt_kbd.h" #include #include +#include +#include #include #include @@ -55,6 +58,7 @@ static int adb_kbd_attach(device_t dev); static int adb_kbd_detach(device_t dev); static void akbd_repeat(void *xsc); +static int adb_fn_keys(SYSCTL_HANDLER_ARGS); static u_int adb_kbd_receive_packet(device_t dev, u_char status, u_char command, u_char reg, int len, u_char *data); @@ -282,6 +286,8 @@ { struct adb_kbd_softc *sc; keyboard_switch_t *sw; + uint32_t fkeys; + phandle_t handle; sw = kbd_get_switch(KBD_DRIVER_NAME); if (sw == NULL) { @@ -333,6 +339,38 @@ adb_set_autopoll(dev,1); + handle = OF_finddevice("mac-io/via-pmu/adb/keyboard"); + device_printf(dev, "phandle: %x\n", handle); + if (OF_getprop(handle, "AAPL,has-embedded-fn-keys", &fkeys, sizeof(fkeys)) != -1) + { + static const char *key_names[] = { + "F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"}; + int i = 0; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree; + + device_printf(dev, "Keyboard has embedded Fn keys\n"); + for (; i < 12; i++) + { + uint32_t keyval; + char buf[3]; + if (OF_getprop(handle, key_names[i], &keyval, sizeof(keyval)) < 0) + continue; + buf[0] = 1; + buf[1] = i+1; + buf[2] = keyval; + adb_write_register(dev, 0, 3, buf); + } + adb_write_register(dev, 1, 2, &(uint16_t){0}); + + ctx = device_get_sysctl_ctx(dev); + tree = device_get_sysctl_tree(dev); + + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "fn_keys_fn_primary", CTLTYPE_INT | CTLFLAG_RW, sc, 0, + adb_fn_keys, "I", "Set the Fn keys to be their F-key type as default"); + } + return (0); } @@ -390,7 +428,6 @@ } else { sc->buffer[sc->buffers++] = data[0]; } - if (sc->buffer[sc->buffers-1] < 0xff) sc->last_press = sc->buffer[sc->buffers-1]; @@ -814,5 +851,29 @@ return (0); } +static int +adb_fn_keys(SYSCTL_HANDLER_ARGS) +{ + struct adb_kbd_softc *sc = arg1; + int error; + uint16_t is_fn_enabled; + unsigned int is_fn_enabled_sysctl; + + adb_read_register(sc->sc_dev, 1, &is_fn_enabled); + is_fn_enabled &= 1; + is_fn_enabled_sysctl = is_fn_enabled; + error = sysctl_handle_int(oidp, &is_fn_enabled_sysctl, 0, req); + + if (error || !req->newptr) + return (error); + + is_fn_enabled = is_fn_enabled_sysctl; + if (is_fn_enabled != 1 && is_fn_enabled != 0) + return (EINVAL); + + adb_write_register(sc->sc_dev, 1, 2, &is_fn_enabled); + return (0); +} + DEV_MODULE(akbd, akbd_modevent, NULL); Index: sys/conf/files.powerpc =================================================================== --- sys/conf/files.powerpc (revision 225817) +++ sys/conf/files.powerpc (working copy) @@ -22,6 +22,7 @@ dev/adb/adb_mouse.c optional adb dev/adb/adb_hb_if.m optional adb dev/adb/adb_if.m optional adb +dev/adb/adb_buttons.c optional adb dev/agp/agp_apple.c optional agp powermac dev/cfi/cfi_bus_fdt.c optional cfi fdt dev/fb/fb.c optional sc --Apple-Mail-19--177719763 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit --Apple-Mail-19--177719763--