On 2013-03-07 16:22, Jean-Pierre wrote:
Hi all

I have finally been able to activate a 64-bit WiFi driver for a Broadcom
BCM4312 wireless hardware on OpenIndiana (oi151a5).

Hello, many of the details you've posted in the report (thanks BTW!)
seem like vague pointers for those who know what to google for -
perhaps by the words you've mentioned :)

If there are particular blogs/articles to read and learn in order to
repeat your recipe for the reader's (i.e. my) hardware, could you
please post the URLs?

For example, how did you locate and patch the multimedia registers,
or change linking of the driver, etc. to solve the issues you list?

Or are all these fixes part of your NDIS changes and will be revised,
refined and posted as the updated source code "ready to use" with an
original Windows driver to wrap?

Now, I hope this would also work with my BCM4313... at least, after
reading your detected issues I get a faint idea why my wrap panicked
the kernel when attaching ;)

Thanks again,
//Jim


pci bus 0x0004 cardnum 0x00 function 0x00: vendor 0x14e4 device 0x4315
  Broadcom Corporation BCM4312 802.11b/g LP-PHY
  CardVendor 0x103c card 0x137d (Hewlett-Packard Company, BCM4312
802.11b/g Wire$

I used an old Windows driver (bcmwl564.sys) which I knew compatible
with my hardware, because I used it a few years ago on Linux with
ndiswrapper (this driver is still available on the Internet as part of a
file named R174291.exe), and I used the NDIS emulator ndis-1.2.2 by Bill
Paul. (the most recent one I found on the Internet).

I did not have to make fundamental changes, but below are the main
issues I had to face :

- issue 1 : the Windows driver is linked at run-time
    The ndis emulator is linked at build-time with a binary image of the
    Windows driver. In order to create the links, the driver image was
    copied at run time to a zalloc'ed memory. As a consequence the copy
    needed to be executable, which AFAIK is sometimes not possible (at
    least for functions triggered by timers.)

    Work around : dissociate the driver code from its variables and only
    dynamically allocate the variables and the indirect pointers to
    external code (ie the ndis emulator). By dissociating code and
    variables, linking at build time became possible (along with type
    type checking at compile time.)

- issue 2 : the Windows driver makes use of multimedia registers (xmm)
    The multimedia instructions "movaps" and "movdqu" were used to
    optimize memcpy().

    Work around : patch the 71 multimedia instructions at build time.

- issue 3 : a few emulation functions were called directly with a
    Windows ABI. This mostly happened for indirect calls, when a
    pointer to a function was set in a structure within the Windows
    driver.

    Work around : make a strict typing of emulation functions, detect
    the wrong ABIs at compile time, and fix them.

- issue 4 : a few generic Windows wrapper functions did not reserve 32
bytes on the stack.
    When these 32 bytes are not needed to save arguments passed in
registers,
    they can be used in the Windows driver for local variables. When the
    space is not reserved, the return pointer is overwritten with obvious
    consequences.

- issue 5 : the layout of a few structures did not match the Windows
driver ones.
    This was somewhat expected because the alignment rules are compiler
    specific. More surprisingly, in at least one case, the Windows driver
    wanted a structure different from what is described on msdn. Maybe the
    structure has been shortened since it was used to compile the driver.


March  7, 2013 03:18:43 PM CET
#ifconfig bcmndis0 plumb
March  7, 2013 03:19:03 PM CET
#wificonfig -i bcmndis0 setparam essid=(not shown)
March  7, 2013 03:19:23 PM CET
#wificonfig -i bcmndis0 setparam encryption=wep
March  7, 2013 03:19:43 PM CET
#wificonfig -i bcmndis0 setparam wepkey1=(not shown)
March  7, 2013 03:20:03 PM CET
#wificonfig -i bcmndis0 setparam authmode=shared_key
March  7, 2013 03:20:23 PM CET
#wificonfig -i bcmndis0 connect (not shown)
wificonfig: connecting to essid '(not shown)'
March  7, 2013 03:20:46 PM CET
#wificonfig -i bcmndis0 showstatus
     linkstatus: connected
     active profile: none
     essid: (not shown)
     bssid: 00:90:4b:18:93:ea
     encryption: wep
     signal strength: medium(11)
March  7, 2013 03:21:07 PM CET
#wificonfig -i bcmndis0 getparam
     bssid: 00:90:4b:18:93:ea
     essid: DW-B-200-2827b
     bsstype: bss(ap, infrastructure)
     createibss: no
     channel: 3
     powermode: fast
     authmode: shared_key
     encryption: wep
     wepkeyindex: 1
     signal: 11
     radio: on
March  7, 2013 03:21:27 PM CET
# ifconfig bcmndis0 dhcp

# netstat -rn

Routing Table: IPv4
   Destination           Gateway           Flags  Ref     Use     Interface
-------------------- -------------------- ----- ----- ---------- ---------
default              10.0.0.1             UG        1          0 bcmndis0
10.0.0.0             10.130.123.16        U         2          0 bcmndis0
127.0.0.1            127.0.0.1            UH        4        160 lo0

Routing Table: IPv6
   Destination/Mask            Gateway                   Flags Ref   Use
    If
--------------------------- --------------------------- ----- ---
------- -----
::1                         ::1                         UH      2 16 lo0
fe80::/10                   fe80::21e:ecff:fee5:b68a    U       2 0 rge0
# ping 10.0.0.1
10.0.0.1 is alive

I can access the configuration page of the router, but for some reason
I cannot get the name service.

I will make the modified NDIS emulator source code available
when I have done the necessary cleaning.

Regards

Jean-Pierre

_______________________________________________
oi-dev mailing list
oi-dev@openindiana.org
http://openindiana.org/mailman/listinfo/oi-dev

Reply via email to