<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Great insight, thanks for this!!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Robles, Raymond C
<br>
<b>Sent:</b> Tuesday, May 15, 2012 9:03 PM<br>
<b>To:</b> Freyensee, James P; nvmewin@lists.openfabrics.org<br>
<b>Subject:</b> Re: [nvmewin] good spot to write to registry?<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">StorPortRegistryWrite must be called at PASSIVE IRQL. HwStorInitialize is called at DIRQL, which is why you are seeing a failure. HwStorFindAdapter is called at PASSIVE IRQL which is why we placed the registry access there. If you need
 to do additional registry reads/writes after HwStorFindAdapter you could put the call inside NVMePassiveInitialize since its called at PASSIVE IRQL. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Ray<br>
<br>
On May 15, 2012, at 6:49 PM, "Freyensee, James P" <<a href="mailto:james.p.freyensee@intel.com">james.p.freyensee@intel.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">Is there a good spot in the NVMe driver to write to the registry via NVMeWriteRegistry() when all the initialization and internal variables are set?<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">It seems like all initialization can end in NVMeInitialize() at the code:<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">   
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">if</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"> (pAE->ntldrDump == FALSE) {</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">       
</span><span style="font-size:9.5pt;font-family:Consolas;color:green;background:white;mso-highlight:white">/* Enumerate granted MSI/MSI-X messages if there is any */</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">       
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">if</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"> (NVMeEnumMsiMessages(pAE) == FALSE) {</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">            NVMeFreeBuffers(pAE);</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">           
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">return</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"> (FALSE);</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">        }</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"> </span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">       
</span><span style="font-size:9.5pt;font-family:Consolas;color:green;background:white;mso-highlight:white">/* Call StorPortPassiveInitialization to enable passive init */</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">        StorPortEnablePassiveInitialization(pAE, NVMePassiveInitialize);</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">             
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white">return</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"> (TRUE);</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black">and all the internal variables and tables are set in the driver at this point.  However, if you wanted to write a value out to the registry before the return(), it will fail
 here in NVMeInitialize().</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black"> </span><o:p></o:p></p>
<p class="MsoNormal"><b><span style="font-size:9.5pt;font-family:Consolas;color:black">BUT,
</span></b><span style="font-size:9.5pt;font-family:Consolas;color:black">NVMeWriteRegistry() will succeed if called within NVMeFindAdapter().  However, not all the important, internal variables are set yet in this function.  For example,
</span><span style="font-size:9.5pt;font-family:Consolas;color:green;background:white;mso-highlight:white">pAE->ResMapTbl.NumMsiMsgGranted</span><span style="font-size:9.5pt;font-family:Consolas;color:green">
</span><span style="font-size:9.5pt;font-family:Consolas">is not set by the system at this point, which is something I care about.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas">NVMeWriteRegistry() is using StorPortWriteRegistry(), and it seems to be finicky when you can actually successfully use it.  Unfortunately it only returns TRUE or FALSE and gives no further
 info what really failed and why, so I am not sure what is going on.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas">Maybe someone might know?  Thanks!</span><o:p></o:p></p>
</div>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"">_______________________________________________<br>
nvmewin mailing list<br>
<a href="mailto:nvmewin@lists.openfabrics.org">nvmewin@lists.openfabrics.org</a><br>
<a href="http://lists.openfabrics.org/cgi-bin/mailman/listinfo/nvmewin">http://lists.openfabrics.org/cgi-bin/mailman/listinfo/nvmewin</a><o:p></o:p></span></p>
</div>
</blockquote>
</div>
</body>
</html>