diff options
author | wpaul <wpaul@FreeBSD.org> | 2004-08-16 18:50:20 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 2004-08-16 18:50:20 +0000 |
commit | 9f377407f3e16830c475cedb638583a1e99504a5 (patch) | |
tree | 87e7ccfbd013f8c08343648bed44321f0ecafaca /sys/compat | |
parent | 6dddbdd9af23673e6ad71f844497cc199c80f194 (diff) | |
download | FreeBSD-src-9f377407f3e16830c475cedb638583a1e99504a5.zip FreeBSD-src-9f377407f3e16830c475cedb638583a1e99504a5.tar.gz |
Make the Texas Instruments 802.11g chipset work with the NDISulator.
This was tested with a Netgear WG311v2 802.11b/g PCI card. Things
that were fixed:
- This chip has two memory mapped regions, one at PCIR_BAR(0) and the
other at PCIR_BAR(1). This is a little different from the other
chips I've seen with two PCI shared memory regions, since they tend
to have the second BAR ad PCIR_BAR(2). if_ndis_pci.c tests explicitly
for PCIR_BAR(2). This has been changed to simply fill in ndis_res_mem
first and ndis_res_altmem second, if a second shared memory range
exists. Given that NDIS drivers seem to scan for BARs in ascending
order, I think this should be ok.
- Fixed the code that tries to process firmware images that have been
loaded as .ko files. To save a step, I was setting up the address
mapping in ndis_open_file(), but ndis_map_file() flags pre-existing
mappings as an error (to avoid duplicate mappings). Changed this so
that the mapping is now donw in ndis_map_file() as expected.
- Made the typedef for 'driver_entry' explicitly include __stdcall
to silence gcc warning in ndis_load_driver().
NOTE: the Texas Instruments ACX111 driver needs firmware. With my
card, there were 3 .bin files shipped with the driver. You must
either put these files in /compat/ndis or convert them with
ndiscvt -f and kldload them so the driver can use them. Without
the firmware image, the NIC won't work.
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/ndis/kern_ndis.c | 2 | ||||
-rw-r--r-- | sys/compat/ndis/ndis_var.h | 2 | ||||
-rw-r--r-- | sys/compat/ndis/subr_ndis.c | 19 |
3 files changed, 19 insertions, 4 deletions
diff --git a/sys/compat/ndis/kern_ndis.c b/sys/compat/ndis/kern_ndis.c index 138f6b9..364f771 100644 --- a/sys/compat/ndis/kern_ndis.c +++ b/sys/compat/ndis/kern_ndis.c @@ -1613,7 +1613,7 @@ ndis_load_driver(img, arg) vm_offset_t img; void *arg; { - __stdcall driver_entry entry; + driver_entry entry; image_optional_header opt_hdr; image_import_descriptor imp_desc; ndis_unicode_string dummystr; diff --git a/sys/compat/ndis/ndis_var.h b/sys/compat/ndis/ndis_var.h index 0ddcc26..aa9d014 100644 --- a/sys/compat/ndis/ndis_var.h +++ b/sys/compat/ndis/ndis_var.h @@ -1478,7 +1478,7 @@ typedef void (*ndis_allocdone_handler)(ndis_handle, void *, ndis_physaddr *, uint32_t, void *); typedef uint8_t (*ndis_checkforhang_handler)(ndis_handle); -typedef ndis_status (*driver_entry)(void *, ndis_unicode_string *); +typedef __stdcall ndis_status (*driver_entry)(void *, ndis_unicode_string *); extern image_patch_table ndis_functbl[]; diff --git a/sys/compat/ndis/subr_ndis.c b/sys/compat/ndis/subr_ndis.c index 00ac948..a978551 100644 --- a/sys/compat/ndis/subr_ndis.c +++ b/sys/compat/ndis/subr_ndis.c @@ -2564,10 +2564,19 @@ ndis_find_sym(lf, filename, suffix, sym) caddr_t *sym; { char fullsym[MAXPATHLEN]; + char *suf; int i; bzero(fullsym, sizeof(fullsym)); strcpy(fullsym, filename); + if (strlen(filename) < 4) + return(EINVAL); + + /* If the filename has a .ko suffix, strip if off. */ + suf = fullsym + (strlen(filename) - 3); + if (strcmp(suf, ".ko") == 0) + *suf = '\0'; + for (i = 0; i < strlen(fullsym); i++) { if (fullsym[i] == '.') fullsym[i] = '_'; @@ -2645,7 +2654,6 @@ ndis_open_file(status, filehandle, filelength, filename, highestaddr) continue; fh->nf_vp = lf; fh->nf_type = NDIS_FH_TYPE_MODULE; - fh->nf_map = kldstart; *filelength = fh->nf_maplen = (kldend - kldstart) & 0xFFFFFFFF; *filehandle = fh; free(afilename, M_DEVBUF); @@ -2713,6 +2721,8 @@ ndis_map_file(status, mappedbuffer, filehandle) { ndis_fh *fh; struct thread *td = curthread; + linker_file_t lf; + caddr_t kldstart; int error, resid; if (filehandle == NULL) { @@ -2733,7 +2743,12 @@ ndis_map_file(status, mappedbuffer, filehandle) } if (fh->nf_type == NDIS_FH_TYPE_MODULE) { - /* Already found the mapping address during the open. */ + lf = fh->nf_vp; + if (ndis_find_sym(lf, lf->filename, "_start", &kldstart)) { + *status = NDIS_STATUS_FAILURE; + return; + } + fh->nf_map = kldstart; *status = NDIS_STATUS_SUCCESS; *mappedbuffer = fh->nf_map; return; |