From owner-svn-src-all@FreeBSD.ORG Mon Dec 6 20:54:54 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 574FF106564A; Mon, 6 Dec 2010 20:54:54 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 451618FC0A; Mon, 6 Dec 2010 20:54:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oB6Kssrc044567; Mon, 6 Dec 2010 20:54:54 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oB6Kss52044561; Mon, 6 Dec 2010 20:54:54 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201012062054.oB6Kss52044561@svn.freebsd.org> From: Bernhard Schmidt Date: Mon, 6 Dec 2010 20:54:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216242 - head/sys/compat/ndis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Dec 2010 20:54:54 -0000 Author: bschmidt Date: Mon Dec 6 20:54:53 2010 New Revision: 216242 URL: http://svn.freebsd.org/changeset/base/216242 Log: Implement NdisGetRoutineAddress and MmGetSystemRoutineAddress used in newer Ralink drivers. Submitted by: Paul B Mahol Modified: head/sys/compat/ndis/kern_ndis.c head/sys/compat/ndis/ndis_var.h head/sys/compat/ndis/ntoskrnl_var.h head/sys/compat/ndis/subr_ndis.c head/sys/compat/ndis/subr_ntoskrnl.c Modified: head/sys/compat/ndis/kern_ndis.c ============================================================================== --- head/sys/compat/ndis/kern_ndis.c Mon Dec 6 20:40:15 2010 (r216241) +++ head/sys/compat/ndis/kern_ndis.c Mon Dec 6 20:54:53 2010 (r216242) @@ -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: head/sys/compat/ndis/ndis_var.h ============================================================================== --- head/sys/compat/ndis/ndis_var.h Mon Dec 6 20:40:15 2010 (r216241) +++ head/sys/compat/ndis/ndis_var.h Mon Dec 6 20:54:53 2010 (r216242) @@ -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: head/sys/compat/ndis/ntoskrnl_var.h ============================================================================== --- head/sys/compat/ndis/ntoskrnl_var.h Mon Dec 6 20:40:15 2010 (r216241) +++ head/sys/compat/ndis/ntoskrnl_var.h Mon Dec 6 20:54:53 2010 (r216242) @@ -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: head/sys/compat/ndis/subr_ndis.c ============================================================================== --- head/sys/compat/ndis/subr_ndis.c Mon Dec 6 20:40:15 2010 (r216241) +++ head/sys/compat/ndis/subr_ndis.c Mon Dec 6 20:54:53 2010 (r216242) @@ -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: head/sys/compat/ndis/subr_ntoskrnl.c ============================================================================== --- head/sys/compat/ndis/subr_ntoskrnl.c Mon Dec 6 20:40:15 2010 (r216241) +++ head/sys/compat/ndis/subr_ntoskrnl.c Mon Dec 6 20:54:53 2010 (r216242) @@ -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),