[ofw] [PATCH] add missing PNP event handlers to reduce debug confusion
Fab Tillier
ftillier at microsoft.com
Wed Jun 29 10:25:15 PDT 2011
Looks good to me.
-Fab
> -----Original Message-----
> From: Smith, Stan
> Sent: Wednesday, June 29, 2011 10:13 AM
>
> Hello,
>
> In the function cl_pnp_po.c::cl_pnp() there is no handler for the following
> PNP minor functions:
> IRP_MN_QUERY_LEGACY_BUS_INFORMATION
> IRP_MN_DEVICE_ENUMERATED (new for win7)
>
> Which at first discovery (DEBUG only with CL_DBG_PNP) appears to be a
> problem as they are output as 'Unknown IRP minor function 0x%x'.
> This patch does not change the behavior of how these IRP minor functions
> are handled, the difference is in actual case statements for the minor
> functions and DEBUG output.
> Case statements show someone has investigated the missing support and
> leaves a framework should IBAL need to handle these minor functions in the
> future.
>
> Also repair short lines split by pretty-print, combine back into a single line of
> code for readability.
> Split long lines inserted after pretty print was run.
>
> Signed-off-by: stan smith <stan.smith at intel.com>
>
> --- core/complib/kernel/cl_pnp_po.c Tue Jun 28 14:01:37 2011
> +++ core/complib/kernel/cl_pnp_po.c Mon Jun 27 13:22:09 2011
> @@ -194,8 +194,8 @@
> CL_TRACE_EXIT( CL_DBG_ERROR, p_ext->dbg_lvl,
> ("IoAcquireRemoveLock returned %08x.\n", status) );
> p_io_stack = IoGetCurrentIrpStackLocation( p_irp );
> - CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl,
> - ("Minor function %x for %s\n", p_io_stack-
> >MinorFunction, p_ext->vfptr_pnp_po->identity) );
> + CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("Minor function
> %x for %s\n",
> + p_io_stack->MinorFunction, p_ext-
> >vfptr_pnp_po->identity) );
> p_irp->IoStatus.Status = status;
> IoCompleteRequest( p_irp, IO_NO_INCREMENT );
> return status;
> @@ -260,8 +260,7 @@
> CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl,
> ("IRP_MN_QUERY_CAPABILITIES for %s\n",
> p_ext->vfptr_pnp_po->identity) );
> - status = p_ext->vfptr_pnp_po->pfn_query_capabilities(
> - p_dev_obj, p_irp, &action );
> + status = p_ext->vfptr_pnp_po->pfn_query_capabilities(
> p_dev_obj, p_irp, &action );
> break;
>
> case IRP_MN_QUERY_PNP_DEVICE_STATE:
> @@ -275,8 +274,7 @@
> CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl,
> ("IRP_MN_FILTER_RESOURCE_REQUIREMENTS for
> %s\n",
> p_ext->vfptr_pnp_po->identity) );
> - status = p_ext->vfptr_pnp_po->pfn_filter_res_req(
> - p_dev_obj, p_irp, &action );
> + status = p_ext->vfptr_pnp_po->pfn_filter_res_req(
> p_dev_obj, p_irp, &action );
> break;
>
> case IRP_MN_DEVICE_USAGE_NOTIFICATION:
> @@ -296,16 +294,14 @@
> case IRP_MN_QUERY_RESOURCES:
> CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl,
> ("IRP_MN_QUERY_RESOURCES for %s\n",
> p_ext->vfptr_pnp_po->identity) );
> - status = p_ext->vfptr_pnp_po->pfn_query_resources(
> - p_dev_obj, p_irp, &action );
> + status = p_ext->vfptr_pnp_po->pfn_query_resources(
> p_dev_obj, p_irp, &action );
> break;
>
> case IRP_MN_QUERY_RESOURCE_REQUIREMENTS:
> CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl,
> ("IRP_MN_QUERY_RESOURCE_REQUIREMENTS for
> %s\n",
> p_ext->vfptr_pnp_po->identity) );
> - status = p_ext->vfptr_pnp_po->pfn_query_res_req(
> - p_dev_obj, p_irp, &action );
> + status = p_ext->vfptr_pnp_po->pfn_query_res_req(
> p_dev_obj, p_irp, &action );
> break;
>
> case IRP_MN_QUERY_ID:
> @@ -346,30 +342,52 @@
> case IRP_MN_WRITE_CONFIG:
> CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl,
> ("IRP_MN_WRITE_CONFIG for %s\n", p_ext-
> >vfptr_pnp_po->identity) );
> - status = p_ext->vfptr_pnp_po->pfn_write_config(
> - p_dev_obj, p_irp, &action );
> + status = p_ext->vfptr_pnp_po->pfn_write_config(
> p_dev_obj, p_irp, &action );
> break;
>
> case IRP_MN_EJECT:
> CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl,
> ("IRP_MN_EJECT for %s\n", p_ext->vfptr_pnp_po-
> >identity) );
> - status = p_ext->vfptr_pnp_po->pfn_eject(
> - p_dev_obj, p_irp, &action );
> + status = p_ext->vfptr_pnp_po->pfn_eject( p_dev_obj,
> p_irp, &action );
> break;
>
> case IRP_MN_SET_LOCK:
> CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl,
> ("IRP_MN_SET_LOCK for %s\n", p_ext-
> >vfptr_pnp_po->identity) );
> - status = p_ext->vfptr_pnp_po->pfn_set_lock(
> - p_dev_obj, p_irp, &action );
> + status = p_ext->vfptr_pnp_po->pfn_set_lock( p_dev_obj,
> p_irp, &action );
> + break;
> +
> + case IRP_MN_QUERY_LEGACY_BUS_INFORMATION:
> + /* See WinDDK\*\inc\ddk\wdm.h */
> + CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl,
> + ("Unsupported
> IRP_MN_QUERY_LEGACY_BUS_INFORMATION for %s\n",
> + p_ext->vfptr_pnp_po->identity) );
> + status = p_ext->vfptr_pnp_po->pfn_unknown( p_dev_obj,
> p_irp, &action );
> + break;
> +
> +#if (NTDDI_VERSION >= NTDDI_WIN7)
> + case IRP_MN_DEVICE_ENUMERATED:
> + /* sent to the bus driver's pdo to tell the bus driver that the
> pdo is a
> + * real/valid pdo. In between the pdo being created and
> reported in
> + * busrelations and this minor code, the pdo is not a valid pdo
> (eg. if
> + * you passed this PDO to an Ioxxx api which requires a pdo
> you will
> + * bugcheck), so once this minor code is received, the PDO is
> 'valid'
> + * and will not bugcheck.
> + * The good news is IBAL does not use the PDO prior to this
> call so the
> + * bugcheck is not an issue [6-21-111].
> + */
> + CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl,
> + ("Unsupported IRP_MN_DEVICE_ENUMERATED for
> %s\n",
> + p_ext->vfptr_pnp_po->identity) );
> + status = p_ext->vfptr_pnp_po->pfn_unknown( p_dev_obj,
> p_irp, &action );
> break;
> +#endif
>
> default:
> CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl,
> ("Unknown IRP minor function 0x%x for %s\n",
> - p_io_stack->MinorFunction, p_ext->vfptr_pnp_po-
> >identity) );
> - status = p_ext->vfptr_pnp_po->pfn_unknown(
> - p_dev_obj, p_irp, &action );
> + p_io_stack->MinorFunction, p_ext-
> >vfptr_pnp_po->identity) );
> + status = p_ext->vfptr_pnp_po->pfn_unknown( p_dev_obj,
> p_irp, &action );
> break;
> }
>
> @@ -377,8 +395,9 @@
> {
> case IrpPassDown:
> p_irp->IoStatus.Status = status;
> - CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IrpPassDown:
> passing down to PDO %p, ext %p, status %#x\n",
> - p_ext->p_next_do, p_ext, p_irp->IoStatus.Status) );
> + CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl,
> + ("IrpPassDown: passing down to PDO %p, ext %p,
> status %#x\n",
> + p_ext->p_next_do, p_ext, p_irp-
> >IoStatus.Status) );
> IoCopyCurrentIrpStackLocationToNext( p_irp );
> status = IoCallDriver( p_ext->p_next_do, p_irp );
> break;
> @@ -387,8 +406,9 @@
> p_irp->IoStatus.Status = status;
>
> case IrpIgnore:
> - CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl,
> ("IrpSkip/IrpIgnore: skipping down to PDO %p, ext %p, status %#x\n",
> - p_ext->p_next_do, p_ext, p_irp->IoStatus.Status) );
> + CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl,
> + ("IrpSkip/IrpIgnore: skipping down to PDO %p, ext
> %p, status %#x\n",
> + p_ext->p_next_do, p_ext, p_irp-
> >IoStatus.Status) );
> IoSkipCurrentIrpStackLocation( p_irp );
> status = IoCallDriver( p_ext->p_next_do, p_irp );
> break;
> @@ -405,8 +425,9 @@
> break;
> }
>
> - CL_TRACE_EXIT( CL_DBG_PNP, p_ext->dbg_lvl, ("returned with
> status %#x, p_irp->IoStatus.Status %#x\n",
> - status, p_irp->IoStatus.Status ) );
> + CL_TRACE_EXIT( CL_DBG_PNP, p_ext->dbg_lvl,
> + ("returned with status %#x, p_irp->IoStatus.Status %#x\n",
> + status, p_irp->IoStatus.Status ) );
>
> if( action != IrpDoNothing )
> IoReleaseRemoveLock( &p_ext->remove_lock, p_irp );
>
>
> _______________________________________________
> ofw mailing list
> ofw at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw
More information about the ofw
mailing list