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.
This commit is contained in:
parent
646c6dd2c0
commit
f454f98c31
@ -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;
|
||||
|
@ -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[];
|
||||
|
||||
|
@ -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;
|
||||
|
@ -208,7 +208,7 @@ ndis_attach_pci(dev)
|
||||
error = ENXIO;
|
||||
goto fail;
|
||||
}
|
||||
if (rle->rid == PCIR_BAR(2)) {
|
||||
if (sc->ndis_res_mem) {
|
||||
sc->ndis_altmem_rid = rle->rid;
|
||||
sc->ndis_res_altmem =
|
||||
bus_alloc_resource(dev,
|
||||
|
Loading…
Reference in New Issue
Block a user