Author: bschmidt
Date: Fri Dec 31 12:59:17 2010
New Revision: 216839
URL: http://svn.freebsd.org/changeset/base/216839

Log:
  MFC r216242:
  Implement NdisGetRoutineAddress and MmGetSystemRoutineAddress used in
  newer Ralink drivers.
  
  Submitted by: Paul B Mahol <onemda at gmail.com>

Modified:
  stable/8/sys/compat/ndis/kern_ndis.c
  stable/8/sys/compat/ndis/ndis_var.h
  stable/8/sys/compat/ndis/ntoskrnl_var.h
  stable/8/sys/compat/ndis/subr_ndis.c
  stable/8/sys/compat/ndis/subr_ntoskrnl.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/compat/ndis/kern_ndis.c
==============================================================================
--- stable/8/sys/compat/ndis/kern_ndis.c        Fri Dec 31 12:53:07 2010        
(r216838)
+++ stable/8/sys/compat/ndis/kern_ndis.c        Fri Dec 31 12:59:17 2010        
(r216839)
@@ -433,6 +433,19 @@ ndis_flush_sysctls(arg)
        return (0);
 }
 
+void *
+ndis_get_routine_address(functbl, name)
+       struct image_patch_table *functbl;
+       char                    *name;
+{
+       int                     i;
+
+       for (i = 0; functbl[i].ipt_name != NULL; i++)
+               if (strcmp(name, functbl[i].ipt_name) == 0)
+                       return (functbl[i].ipt_wrap);
+       return (NULL);
+}
+
 static void
 ndis_return(dobj, arg)
        device_object           *dobj;

Modified: stable/8/sys/compat/ndis/ndis_var.h
==============================================================================
--- stable/8/sys/compat/ndis/ndis_var.h Fri Dec 31 12:53:07 2010        
(r216838)
+++ stable/8/sys/compat/ndis/ndis_var.h Fri Dec 31 12:59:17 2010        
(r216839)
@@ -1729,6 +1729,7 @@ extern int ndis_mtop(struct mbuf *, ndis
 extern int ndis_ptom(struct mbuf **, ndis_packet *);
 extern int ndis_get_info(void *, ndis_oid, void *, int *);
 extern int ndis_set_info(void *, ndis_oid, void *, int *);
+extern void *ndis_get_routine_address(struct image_patch_table *, char *);
 extern int ndis_get_supported_oids(void *, ndis_oid **, int *);
 extern int ndis_send_packets(void *, ndis_packet **, int);
 extern int ndis_send_packet(void *, ndis_packet *);

Modified: stable/8/sys/compat/ndis/ntoskrnl_var.h
==============================================================================
--- stable/8/sys/compat/ndis/ntoskrnl_var.h     Fri Dec 31 12:53:07 2010        
(r216838)
+++ stable/8/sys/compat/ndis/ntoskrnl_var.h     Fri Dec 31 12:59:17 2010        
(r216839)
@@ -1466,6 +1466,7 @@ extern uint32_t IoConnectInterrupt(kinte
        kspin_lock *, uint32_t, uint8_t, uint8_t, uint8_t, uint8_t,
        uint32_t, uint8_t);
 extern uint8_t MmIsAddressValid(void *);
+extern void *MmGetSystemRoutineAddress(unicode_string *);
 extern void *MmMapIoSpace(uint64_t, uint32_t, uint32_t);
 extern void MmUnmapIoSpace(void *, size_t);
 extern void MmBuildMdlForNonPagedPool(mdl *);

Modified: stable/8/sys/compat/ndis/subr_ndis.c
==============================================================================
--- stable/8/sys/compat/ndis/subr_ndis.c        Fri Dec 31 12:53:07 2010        
(r216838)
+++ stable/8/sys/compat/ndis/subr_ndis.c        Fri Dec 31 12:59:17 2010        
(r216839)
@@ -197,6 +197,7 @@ static ndis_status NdisMMapIoSpace(void 
        ndis_physaddr, uint32_t);
 static void NdisMUnmapIoSpace(ndis_handle, void *, uint32_t);
 static uint32_t NdisGetCacheFillSize(void);
+static void *NdisGetRoutineAddress(unicode_string *);
 static uint32_t NdisMGetDmaAlignment(ndis_handle);
 static ndis_status NdisMInitializeScatterGatherDma(ndis_handle,
        uint8_t, uint32_t);
@@ -1642,6 +1643,17 @@ NdisGetCacheFillSize(void)
        return (128);
 }
 
+static void *
+NdisGetRoutineAddress(ustr)
+       unicode_string          *ustr;
+{
+       ansi_string             astr;
+
+       if (RtlUnicodeStringToAnsiString(&astr, ustr, TRUE))
+               return (NULL);
+       return (ndis_get_routine_address(ndis_functbl, astr.as_buf));
+}
+
 static uint32_t
 NdisMGetDmaAlignment(handle)
        ndis_handle             handle;
@@ -3246,6 +3258,7 @@ image_patch_table ndis_functbl[] = {
        IMPORT_SFUNC(NdisInitializeString, 2),
        IMPORT_SFUNC(NdisFreeString, 1),
        IMPORT_SFUNC(NdisGetCurrentSystemTime, 1),
+       IMPORT_SFUNC(NdisGetRoutineAddress, 1),
        IMPORT_SFUNC(NdisGetSystemUpTime, 1),
        IMPORT_SFUNC(NdisGetVersion, 0),
        IMPORT_SFUNC(NdisMSynchronizeWithInterrupt, 3),

Modified: stable/8/sys/compat/ndis/subr_ntoskrnl.c
==============================================================================
--- stable/8/sys/compat/ndis/subr_ntoskrnl.c    Fri Dec 31 12:53:07 2010        
(r216838)
+++ stable/8/sys/compat/ndis/subr_ntoskrnl.c    Fri Dec 31 12:59:17 2010        
(r216839)
@@ -2589,6 +2589,17 @@ MmGetPhysicalAddress(void *base)
        return (pmap_extract(kernel_map->pmap, (vm_offset_t)base));
 }
 
+void *
+MmGetSystemRoutineAddress(ustr)
+       unicode_string          *ustr;
+{
+       ansi_string             astr;
+
+       if (RtlUnicodeStringToAnsiString(&astr, ustr, TRUE))
+               return (NULL);
+       return (ndis_get_routine_address(ntoskrnl_functbl, astr.as_buf));
+}
+
 uint8_t
 MmIsAddressValid(vaddr)
        void                    *vaddr;
@@ -4382,6 +4393,7 @@ image_patch_table ntoskrnl_functbl[] = {
        IMPORT_SFUNC(MmUnmapLockedPages, 2),
        IMPORT_SFUNC(MmBuildMdlForNonPagedPool, 1),
        IMPORT_SFUNC(MmGetPhysicalAddress, 1),
+       IMPORT_SFUNC(MmGetSystemRoutineAddress, 1),
        IMPORT_SFUNC(MmIsAddressValid, 1),
        IMPORT_SFUNC(MmMapIoSpace, 3 + 1),
        IMPORT_SFUNC(MmUnmapIoSpace, 2),
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to