Date: Fri, 27 Jan 2012 06:39:57 -0500 From: Justin Hibbits <chmeeedalf@gmail.com> To: Alexey Dokuchaev <danfe@freebsd.org> Cc: FreeBSD PowerPC ML <freebsd-ppc@freebsd.org> Subject: Re: Has source been updated with Hibbits' recent patches? Message-ID: <CAHSQbTBhG=EKUqc4S9OknadrL_t3nZbro6gyL=o7joJ3y59MkA@mail.gmail.com> In-Reply-To: <20120127061139.GA20497@FreeBSD.org> References: <CA%2BWntOuBdgcXow13BtfgVLfD3Bj0gT-WJ55X5HfUHoXxx7GD9Q@mail.gmail.com> <6B0E21DA-728B-43ED-8194-76D48A65B885@gmail.com> <CA%2BWntOt-MgYmuYjCgnbkUpyPmpWXgRM1UababbR8VabaYrP-Zw@mail.gmail.com> <CA%2BWntOvfJyXq2Ev%2BEAHS2GoiOX7qgpvfNb0uDW8WJ9TFvY9jNA@mail.gmail.com> <CAHSQbTC7amxv_4E8yj0LfTSXYGgdiyZ2hxv-hw3Fy3P_h5PNFA@mail.gmail.com> <CA%2BWntOvbyPUv58uC-Ycc6KjiBpo8_mzGz6inZdXi-SgsCq5mcA@mail.gmail.com> <CA%2BWntOsdQpTiAgFor4FVjYw4KjNVvyiatXPo8wg5bNs9%2BLZ6=g@mail.gmail.com> <B5EADFE9-4B4D-4338-B05A-A13560DA0226@gmail.com> <20120127061139.GA20497@FreeBSD.org>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
2012/1/27 Alexey Dokuchaev <danfe@freebsd.org>
> On Thu, Jan 26, 2012 at 09:10:40PM -0500, Justin Hibbits wrote:
> > Oh, I forgot, you need to manually build the if_wi module (go into /
> > usr/src/sys/modules/wi and make), because it's not included in the
> > modules Makefile for powerpc.
>
> If it works fine, why is it not enabled by default on ppc?
>
> ./danfe
>
I don't know if it works fine :) Plus, I forgot to enable it in my patch.
Here's another patch that does enable it.
Super, you can try the attached patch.
- Justin
[-- Attachment #2 --]
Index: sys/modules/Makefile
===================================================================
--- sys/modules/Makefile (revision 230585)
+++ sys/modules/Makefile (working copy)
@@ -704,11 +704,15 @@
_agp= agp
_an= an
_bm= bm
+_cardbus= cardbus
+_cbb= cbb
_cfi= cfi
_cpufreq= cpufreq
_nvram= powermac_nvram
+_pccard= pccard
_smbfs= smbfs
_sound= sound
+_wi= wi
.endif
.if ${MACHINE_ARCH} == "powerpc64"
Index: sys/dev/wi/if_wi_macio.c
===================================================================
--- sys/dev/wi/if_wi_macio.c (revision 0)
+++ sys/dev/wi/if_wi_macio.c (revision 0)
@@ -0,0 +1,172 @@
+/*-
+ * Copyright (c) 1997, 1998, 1999
+ * Bill Paul <wpaul@ctr.columbia.edu>. 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.
+ */
+
+/*
+ * Apple Airport (MacIO) connection for Lucent/Prism driver.
+ *
+ * Written by Justin Hibbits
+ *
+ * Based on PCMCIA driver following:
+ * Written by Bill Paul <wpaul@ctr.columbia.edu>
+ * Electrical Engineering Department
+ * Columbia University, New York City
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: head/sys/dev/wi/if_wi_macio.c 182250 2008-08-27 05:39:44Z imp $");
+
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/socket.h>
+#include <sys/systm.h>
+#include <sys/module.h>
+#include <sys/bus.h>
+
+#include <machine/bus.h>
+#include <machine/resource.h>
+#include <sys/rman.h>
+
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/openfirm.h>
+#include <machine/ofw_machdep.h>
+
+#include <net/if.h>
+#include <net/if_arp.h>
+#include <net/ethernet.h>
+#include <net/if_dl.h>
+#include <net/if_media.h>
+#include <net/if_types.h>
+
+#include <net80211/ieee80211_var.h>
+#include <net80211/ieee80211_radiotap.h>
+
+#include <dev/wi/if_wavelan_ieee.h>
+#include <dev/wi/if_wireg.h>
+#include <dev/wi/if_wivar.h>
+
+static int wi_macio_probe(device_t);
+static int wi_macio_attach(device_t);
+static int wi_macio_resume(device_t dev);
+static int wi_macio_suspend(device_t dev);
+
+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),
+ DEVMETHOD(device_suspend, wi_macio_suspend),
+ DEVMETHOD(device_resume, wi_macio_resume),
+
+ { 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_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;
+}
+
+static int
+wi_macio_suspend(device_t dev)
+{
+ struct wi_softc *sc = device_get_softc(dev);
+
+ wi_stop(sc, 1);
+
+ return (0);
+}
+
+static int
+wi_macio_resume(device_t dev)
+{
+ struct wi_softc *sc = device_get_softc(dev);
+ struct ifnet *ifp = sc->sc_ifp;
+
+ if (sc->wi_bus_type != WI_BUS_PCI_NATIVE)
+ return (0);
+
+ if (ifp->if_flags & IFF_UP) {
+ ifp->if_init(ifp->if_softc);
+ if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+ ifp->if_start(ifp);
+ }
+
+ return (0);
+}
Property changes on: sys/dev/wi/if_wi_macio.c
___________________________________________________________________
Added: svn:keywords
+ Id
Index: sys/dev/wi/if_wi.c
===================================================================
--- sys/dev/wi/if_wi.c (revision 230585)
+++ sys/dev/wi/if_wi.c (working copy)
@@ -1900,8 +1900,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;
@@ -1910,9 +1909,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;
}
@@ -1920,8 +1917,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;
@@ -1931,9 +1927,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;
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHSQbTBhG=EKUqc4S9OknadrL_t3nZbro6gyL=o7joJ3y59MkA>
