Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Nov 2006 12:51:28 -0600
From:      "Scot Hetzel" <swhetzel@gmail.com>
To:        FreeBSD-CURRENT <freebsd-current@freebsd.org>,  "Bill Paul" <wpaul@windriver.com>
Subject:   Latest Broadcom NDIS driver requires 4 additional functions
Message-ID:  <790a9fff0611251051md2ef50cja84440ba3cc7942f@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
------=_Part_99721_1078503.1164480688231
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I'm trying to upgrade my ndis driver from version 3.100.64.0 to
4.40.19.0, but when I try to load the driver I get a Fatal trap 12
error.

#fetch ftp://ftp.hp.com/pub/softpaq/sp33001-33500/sp33008.exe
#cabextract -q -L -F 'bcmwl5*' sp33008.exe
#ndisgen bcmwl5.inf bcmwl564.sys
#kldloadd ./bcmwl564_sys.ko
no match for strrchr
no match for MmFreeContiguousMemorySpecifyCache
no match for MmAllocateContiguousMemorySpecifyCache
no match for MmGetPhysicalAddress
ichsmb0: <SMBus Controller> port 0x8400-0x840f mem
0xc0003000-0xc0003fff at device 20.0 on pci0
device_attach: ichsmb0 attach returned 6
ndis0: <Broadcom 802.11b/g WLAN> mem 0xc0204000-0xc0205fff irq 21 at
device 20.0 on pci6
ndis0: NDIS API Version: 5.1
fpudna in kernel mode!
ntoskrnl dummy called...

Fatal trap 12: page fault while in kernel mode
cpuid = 0; apic id = 00
fault virtual address = 0x1a
fault code                = supervisor read, page not present
instruction pointer   = 0x8:0xffffffffa2b1b1eb
stack pointer           = 0x10:0xffffffffa2a6f100
frame pointer          = 0x10:0xffffffffa2b82140
code segment         = base 0x0, limit 0xfffff, type 0x1b
                              = DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags      = intrrupt enabled, resume, IOPL=0
current process      = 1503 (kldload)
[thread pid 1503 tid 100099]
stopped at 0xffffffffa2b1b1eb:   cmpb (%rax, %rdx, 1), %cl
db>bt
tracing pid 1503 tid 100099 td 0xffffff002f569810
bcmwl564_sys_drv_data_start() at 0xffffffffa2b1b1eb
(null)() at 0x11600000000

NOTE: This fatal trap 12 was caused by the missing strrchr function,
after implementing only that function, and recompiling the ndis.ko
module  the driver nolonger crashed the kernel.

I was able to create the first 3 functions for the NDIS compatibility
layer, but I'm not sure how to find the Physical address from the
Virtual Address for the MmGetPhysicalAddress function.

Implemented Functions:
      stricmp
      strrchr
      MmAllocateContiguousMemory
      MmAllocateContiguousMemorySpecifyCache
      MmFreeContiguousMemory
      MmFreeContiguousMemorySpecifyCache

Unimplemented Functions:
      memchr - implemented but causes "cast discards qualifiers from
pointer target type" (copied from lib/libc/string/memchr.c)
      MmGetPhysicalAddress - needs to be implemented

Any ideas as to how to fix memchr, and implement MmGetPhysicalAddress?

Scot
-- 
DISCLAIMER:
No electrons were mamed while sending this message. Only slightly bruised.

------=_Part_99721_1078503.1164480688231
Content-Type: text/x-diff; name="ndis.patch"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="ndis.patch"
X-Attachment-Id: f_euydk0bh

SW5kZXg6IHN5cy9jb21wYXQvbmRpcy9zdWJyX250b3Nrcm5sLmMKPT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQpSQ1MgZmls
ZTogL2hvbWUvbmN2cy9zcmMvc3lzL2NvbXBhdC9uZGlzL3N1YnJfbnRvc2tybmwuYyx2CnJldHJp
ZXZpbmcgcmV2aXNpb24gMS44NwpkaWZmIC11IC1yMS44NyBzdWJyX250b3Nrcm5sLmMKLS0tIHN5
cy9jb21wYXQvbmRpcy9zdWJyX250b3Nrcm5sLmMJMTYgTWF5IDIwMDYgMTQ6Mzc6NTcgLTAwMDAJ
MS44NworKysgc3lzL2NvbXBhdC9uZGlzL3N1YnJfbnRvc2tybmwuYwkyNSBOb3YgMjAwNiAwNzoy
ODo1MSAtMDAwMApAQCAtMTk3LDYgKzE5NywxNiBAQAogc3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QsIDApLApAQCAtNDIzOSw2ICs0MzQzLDEzIEBACiAJSU1QT1JUX0ZG
VU5DKEV4SW50ZXJsb2NrZWRBZGRMYXJnZVN0YXRpc3RpYywgMiksCiAJSU1QT1JUX1NGVU5DKElv
QWxsb2NhdGVNZGwsIDUpLAogCUlNUE9SVF9TRlVOQyhJb0ZyZWVNZGwsIDEpLAorCUlNUE9SVF9T
RlVOQyhNbUFsbG9jYXRlQ29udGlndW91c01lbW9yeSwgMiksCisJSU1QT1JUX1NGVU5DKE1tQWxs
b2NhdGVDb250aWd1b3VzTWVtb3J5U3BlY2lmeUNhY2hlLCA1KSwKKwlJTVBPUlRfU0ZVTkMoTW1G
cmVlQ29udGlndW91c01lbW9yeSwgMSksCisJSU1QT1JUX1NGVU5DKE1tRnJlZUNvbnRpZ3VvdXNN
ZW1vcnlTcGVjaWZ5Q2FjaGUsIDMpLAorI2lmZGVmIE1NR0VUUEhZU0lDQUxBRERSRVNTCisJSU1Q
T1JUX1NGVU5DKE1tR2V0UGh5c2ljYWxBZGRyZXNzLCAxKSwKKyNlbmRpZgogCUlNUE9SVF9TRlVO
QyhNbVNpemVPZk1kbCwgMSksCiAJSU1QT1JUX1NGVU5DKE1tTWFwTG9ja2VkUGFnZXMsIDIpLAog
CUlNUE9SVF9TRlVOQyhNbU1hcExvY2tlZFBhZ2VzU3BlY2lmeUNhY2hlLCA2KSwK
------=_Part_99721_1078503.1164480688231--



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