<div dir="ltr"><div dir="ltr">This version of MiniComm will work without vcredist (compiled with /MT): <a href="https://drive.google.com/file/d/1v04RHUEIqlhrg2TUU_d_G4Z6lbZ1l44g/view?usp=sharing">https://drive.google.com/file/d/1v04RHUEIqlhrg2TUU_d_G4Z6lbZ1l44g/view?usp=sharing</a></div><div dir="ltr"><br></div><div>--Mario</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">În lun., 7 iun. 2021 la 11:31, Sunny Wang <<a href="mailto:Sunny.Wang@arm.com">Sunny.Wang@arm.com</a>> a scris:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="EN-US" style="overflow-wrap: break-word;">
<div class="gmail-m_-8588933396907808617WordSection1">
<p class="MsoNormal"><span style="color:rgb(32,56,100)">Thanks for all the valuable comments, Mario. I learned a lot from your comments.
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:rgb(32,56,100)">I just sent v4 for addressing your comments.
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:rgb(32,56,100)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:rgb(32,56,100)">By the way, for
</span><a href="https://github.com/ms-iot/samples/tree/develop/MinComm" target="_blank">samples/MinComm at develop · ms-iot/samples (github.com)</a><span style="color:rgb(32,56,100)"><u></u><u></u></span></p>
<ol style="margin-top:0in" start="1" type="1">
<li class="gmail-m_-8588933396907808617MsoListParagraph" style="margin-left:0in"><span style="color:rgb(32,56,100)">I successfully build it</span>.
<span style="color:rgb(32,56,100)">
However, when I ran MinComm.exe on RPi4, I saw the “vcruntime140.dll was not found” error message, and couldn’t fix it by installing the latest Microsoft Visual C++ Redistributable (<a href="https://aka.ms/vs/16/release/VC_redist.arm64.exe" target="_blank"><span style="color:rgb(32,56,100);text-decoration:none">vc_redist.arm64.exe</span></a>)
 from <a href="https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0" target="_blank">
<span style="color:rgb(0,0,127)">https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0</span></a></span><span style="color:black">.
<u></u><u></u></span></li><li class="gmail-m_-8588933396907808617MsoListParagraph" style="color:rgb(68,114,196);margin-left:0in">
<span style="color:rgb(32,56,100)"><span style="color:windowtext">Just a suggestion. I think it would be good to upload the precompiled binary somewhere.  <u></u><u></u></span></span></li></ol>
<p class="MsoNormal"><span style="color:rgb(32,56,100)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:rgb(32,56,100)"><br>
</span><span style="color:rgb(32,56,100)">Best
</span><span style="color:rgb(32,56,100)">Regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:rgb(32,56,100)">Sunny</span><span style="color:rgb(32,56,100)"> Wang<u></u><u></u></span></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class="MsoNormal"><b>From:</b> <a href="mailto:devel@edk2.groups.io" target="_blank">devel@edk2.groups.io</a> <<a href="mailto:devel@edk2.groups.io" target="_blank">devel@edk2.groups.io</a>> <b>
On Behalf Of </b>Mario Balanica via <a href="http://groups.io" target="_blank">groups.io</a><br>
<b>Sent:</b> Tuesday, June 1, 2021 12:36 AM<br>
<b>To:</b> Sunny Wang <<a href="mailto:Sunny.Wang@arm.com" target="_blank">Sunny.Wang@arm.com</a>><br>
<b>Cc:</b> <a href="mailto:devel@edk2.groups.io" target="_blank">devel@edk2.groups.io</a>; Samer El-Haj-Mahmoud <<a href="mailto:Samer.El-Haj-Mahmoud@arm.com" target="_blank">Samer.El-Haj-Mahmoud@arm.com</a>>; Sami Mujawar <<a href="mailto:Sami.Mujawar@arm.com" target="_blank">Sami.Mujawar@arm.com</a>>; Jeremy Linton <<a href="mailto:Jeremy.Linton@arm.com" target="_blank">Jeremy.Linton@arm.com</a>>; Pete Batard <<a href="mailto:pete@akeo.ie" target="_blank">pete@akeo.ie</a>>; Ard Biesheuvel <<a href="mailto:ardb%2Btianocore@kernel.org" target="_blank">ardb+tianocore@kernel.org</a>><br>
<b>Subject:</b> Re: [edk2-devel] [PATCH v3 2/2] Platform/RaspberryPi: Enable Bluetooth and UART in Windows OS<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal">edit: "GpioPinSet (31, 0);" should be "GpioPinSet (31, FALSE);" and maybe add the "fake the CTS signal as we don't support HW flow control yet" comment too.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">When this patch gets merged, I'll add my Bluetooth changes to <a href="https://github.com/raspberrypi/windows-drivers" target="_blank">raspberrypi/windows-drivers: Windows IOT drivers (github.com)</a> and submit another patch here to enable hardware flow
 control.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">--Mario<u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">În lun., 31 mai 2021 la 18:56, Mario Bălănică <<a href="mailto:mariobalanica02@gmail.com" target="_blank">mariobalanica02@gmail.com</a>> a scris:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal"><span style="color:rgb(32,56,100)">If there is no COM port for PL011 UART, how can I check PL011 UART’s functionality? How can I use a telnet tool like PuTTY to send messages from RPi4 to my laptop? </span><u></u><u></u></p>
</blockquote>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">You can use: <a href="https://github.com/ms-iot/samples/tree/develop/MinComm" target="_blank">samples/MinComm at develop · ms-iot/samples (github.com)</a> (let me know if you need a precompiled binary)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal"><span style="color:rgb(32,56,100)">As for why I mux both UARTs to the BT chip, I was trying to address your comment “This always assumes that PL011 is used for Bluetooth”. Apparently, it didn’t address your comment. No matter whether I add “</span>PinFunction
 (Exclusive, PullDown, BCM_ALT5, "<a>\\_SB.GDV0.GPI0</a>", 0, ResourceConsumer, , ) { 32, 33 }” <span style="color:rgb(32,56,100)">or not, the Bluetooth has NOT worked when I configure PL011 UART as the primary serial console. Bluetooth
 only works when I configure Mini UART as the Primary serial console. I also confirmed that this problem also exists with RPi4 Release FW 1.26 + edk2-platforms-raspberrypi-pl011-bth-noflow.diff in <a href="https://github.com/worproject/RPi-Bluetooth-Testing/" target="_blank">https://github.com/worproject/RPi-Bluetooth-Testing/</a>.
 Do you have any idea to make the Bluetooth work with configuring PL011 UART as the primary serial console?</span><u></u><u></u></p>
</blockquote>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Bluetooth doesn't really work with the mini UART driver at the moment. The chip stalls after a few transfers, as far as I remember. Haven't looked much into it.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal"><span style="color:rgb(32,56,100)">By the way, it is good to know the loading sequence. Do you know where I can quickly find this information without using WinDbg?</span><u></u><u></u></p>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I'm not aware of any way to see the driver loading order without WinDbg. Also, verbose mode must be enabled before boot: <a href="https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/view---verbose-output" target="_blank">View
 Verbose Output - Windows drivers | Microsoft Docs</a><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">You could also test if Bluetooth will break by uninstalling / re-installing the mini UART driver while the system is running, then try to scan for nearby BT devices.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal"><span style="color:rgb(32,56,100)">1.  What is the connection between GPIO 128 and Bluetooth (BT_ON)? Why did we add this line in the beginning? I just removed it by your request and according to the change in worproject/RPi-Bluetooth-Testing/,
 but I’m still worried about if we did this for some other purposes.  </span><u></u><u></u></p>
</blockquote>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">That is a leftover from the MS-IOT tables. It tries to toggle BT_ON from the GPIO expander (I2C) through RPIQ (mailbox), but the driver has no knowledge of it. And since the firmware blob turns on Bluetooth by default, the line is completely
 useless.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">We may want to have something like this in the future, for power management of the BT chip (will require some driver changes too).<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal"><span style="color:rgb(32,56,100)">2.  Why do we need to configure GPIO 32 and 33? Is the Bluetooth using GPIO 32 and 33? Or Is Windows OS checking GPIO 32 and 33 for Bluetooth? Where can I find the information?</span><u></u><u></u></p>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Yes, the Bluetooth chip is available on pins 32, 33 (TX / RX). Also 30, 31 for hardware flow control (CTS / RTS). More info can be found in the
<a href="https://datasheets.raspberrypi.org/bcm2711/bcm2711-peripherals.pdf" target="_blank">
BCM2711 datasheet</a> (5.3. Alternative Function Assignments)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal"><span style="color:rgb(32,56,100)">3.  As for your comment about GPIO 31, I was confused, so I didn’t update anything for addressing this comment. My understanding was that It is intended to override the BCM_ALT2’s default setting from PullLow
 to PullNone to fack the CTS signal. If we change it to PullLow, it will be used for HW flow control, which is unwanted, isn’t it? What did you want me to change? Could you directly paste the code change you wanted here for my reference?</span><u></u><u></u></p>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">The BCM_ALT2 thing is a dirty hack. Pin 31 must be held LOW so that we can talk to the BT chip without flow control. It seems this can't be described with PinFunction, so I've relied on the default value of ALT2 for pin 31 (which turns
 out to be always LOW). <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">My proposal is to move the pin muxing stuff in ConfigDxe, like this:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">STATIC VOID<u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">ApplyVariables (<u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">  VOID<u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">  )<u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">{<u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">...<u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal"><u></u> <u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">  if (FanOnGpio) {<u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">    DEBUG ((DEBUG_INFO, "Fan enabled on GPIO %d\n", FanOnGpio));<u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">    GpioPinFuncSet (FanOnGpio, GPIO_FSEL_OUTPUT);<u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">  }<u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal"><u></u> <u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">  /*<u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">   * Bluetooth pin muxing<u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">   */   <u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">  GpioPinFuncSet (31, GPIO_FSEL_OUTPUT);<u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">  GpioPinSet (31, 0);<u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal"><u></u> <u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">  if ((PcdGet32 (PcdUartInUse) == PL011_UART_IN_USE)) {  <u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">    GpioPinFuncSet (32, GPIO_FSEL_ALT3);<u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">    GpioPinFuncSet (33, GPIO_FSEL_ALT3);<u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">  } else {<u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">    GpioPinFuncSet (32, GPIO_FSEL_ALT5);<u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">    GpioPinFuncSet (33, GPIO_FSEL_ALT5);<u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">  }<u></u><u></u></p>
</blockquote>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">}<u></u><u></u></p>
</blockquote>
</blockquote>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">--Mario<u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">În lun., 31 mai 2021 la 16:26, Sunny Wang <<a href="mailto:Sunny.Wang@arm.com" target="_blank">Sunny.Wang@arm.com</a>> a scris:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal"><span style="color:rgb(32,56,100)">Hi Mario,
</span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:rgb(32,56,100)"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:rgb(32,56,100)">Thanks for checking this.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:rgb(32,56,100)">Yeah, the problem is NO COM port for PL011 UART in Windows IOT’s device manager, so I thought it doesn’t work. If there is no COM port for PL011 UART,
 how can I check PL011 UART’s functionality? How can I use a telnet tool like PuTTY to send messages from RPi4 to my laptop? How to use SerCx2? Is there a guideline for using PL011 UART on RPi4 with Windows IoT?</span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:rgb(32,56,100)"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:rgb(32,56,100)">As for why I mux both UARTs to the BT chip, I was trying to address your comment “This always assumes that PL011 is used for Bluetooth”. Apparently,
 it didn’t address your comment. No matter whether I add “</span>PinFunction (Exclusive, PullDown, BCM_ALT5, "<a>\\_SB.GDV0.GPI0</a>", 0, ResourceConsumer, , ) { 32, 33 }”
<span style="color:rgb(32,56,100)">or not, the Bluetooth has NOT worked when I configure PL011 UART as the primary serial console. Bluetooth only works when I configure Mini UART as the Primary serial console. I also confirmed that this problem also exists with RPi4
 Release FW 1.26 + edk2-platforms-raspberrypi-pl011-bth-noflow.diff in <a href="https://github.com/worproject/RPi-Bluetooth-Testing/" target="_blank">
https://github.com/worproject/RPi-Bluetooth-Testing/</a>. Do you have any idea to make the Bluetooth work with configuring PL011 UART as the primary serial console? By the way, it is good to know the loading sequence. Do you know where I can quickly find this
 information without using WinDbg?</span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:rgb(32,56,100)"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:rgb(32,56,100)"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:rgb(32,56,100)">Actually, the original code change (Patch 2/2) is the patch (edk2-platforms-raspberrypi-pl011-bth-noflow.diff) on  <a href="https://github.com/worproject/RPi-Bluetooth-Testing/" target="_blank">https://github.com/worproject/RPi-Bluetooth-Testing/</a>.
 I’m not familiar with Windows drivers’ behavior, so I had no idea about why we need to change them and couldn’t find more information about the changes’ background either. It looks like you know the details. Could you share with me more information about the
 background of these changes? At least, I have some questions below: </span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:rgb(32,56,100)">1.  What is the connection between GPIO 128 and Bluetooth (BT_ON)? Why did we add this line in the beginning? I just removed it by your request and according
 to the change in worproject/RPi-Bluetooth-Testing/, but I’m still worried about if we did this for some other purposes.  </span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:rgb(32,56,100)">2.  Why do we need to configure GPIO 32 and 33? Is the Bluetooth using GPIO 32 and 33? Or Is Windows OS checking GPIO 32 and 33 for Bluetooth? Where
 can I find the information? </span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:rgb(32,56,100)">3.  As for your comment about GPIO 31, I was confused, so I didn’t update anything for addressing this comment. My understanding was that It is intended
 to override the BCM_ALT2’s default setting from PullLow to PullNone to fack the CTS signal. If we change it to PullLow, it will be used for HW flow control, which is unwanted, isn’t it? What did you want me to change? Could you directly paste the code change
 you wanted here for my reference? </span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:rgb(32,56,100)"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:rgb(32,56,100)">Moreover, for the changes you want, could you also paste the code change?
</span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:rgb(32,56,100)"><br>
Best Regards,</span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:rgb(32,56,100)">Sunny Wang</span><u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class="MsoNormal"><b>From:</b>
<a href="mailto:devel@edk2.groups.io" target="_blank">devel@edk2.groups.io</a> <<a href="mailto:devel@edk2.groups.io" target="_blank">devel@edk2.groups.io</a>>
<b>On Behalf Of </b>Mario Balanica via <a href="http://groups.io" target="_blank">
groups.io</a><br>
<b>Sent:</b> Monday, May 31, 2021 8:41 PM<br>
<b>To:</b> Sunny Wang <<a href="mailto:Sunny.Wang@arm.com" target="_blank">Sunny.Wang@arm.com</a>><br>
<b>Cc:</b> <a href="mailto:devel@edk2.groups.io" target="_blank">devel@edk2.groups.io</a>; Samer El-Haj-Mahmoud <<a href="mailto:Samer.El-Haj-Mahmoud@arm.com" target="_blank">Samer.El-Haj-Mahmoud@arm.com</a>>; Sami Mujawar <<a href="mailto:Sami.Mujawar@arm.com" target="_blank">Sami.Mujawar@arm.com</a>>;
 Jeremy Linton <<a href="mailto:Jeremy.Linton@arm.com" target="_blank">Jeremy.Linton@arm.com</a>>; Pete Batard <<a href="mailto:pete@akeo.ie" target="_blank">pete@akeo.ie</a>>; Ard Biesheuvel <<a href="mailto:ardb%2Btianocore@kernel.org" target="_blank">ardb+tianocore@kernel.org</a>><br>
<b>Subject:</b> Re: [edk2-devel] [PATCH v3 2/2] Platform/RaspberryPi: Enable Bluetooth and UART in Windows OS<u></u><u></u></p>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<div>
<p class="MsoNormal">Hi Sunny,<u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">What issues are you seeing with the PL011 UART in Windows? Last time I checked, it worked fine, and the fact that Bluetooth works also confirms this.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">It won't show up as a COM port (like mini UART does) as it's built using SerCx2.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt">
<p class="MsoNormal">@@ -30,6 +30,12 @@ Device (URT0)<br>
   {<br>
     MEMORY32FIXED (ReadWrite, 0, BCM2836_PL011_UART_LENGTH, RMEM)<br>
     Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_PL011_UART_INTERRUPT }<br>
+<br>
+    PinFunction (Exclusive, PullDown, BCM_ALT3, "<a>\\_SB.GDV0.GPI0</a>", 0, ResourceConsumer, , ) { 32, 33 }<br>
+<u></u><u></u></p>
</blockquote>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt">
<p class="MsoNormal">@@ -79,6 +85,11 @@ Device (URTM)<br>
     // from muxing the pins away.<br>
<br>
     // PinFunction (Exclusive, PullDown, BCM_ALT5, "<a>\\_SB.GPI0</a>", 0, ResourceConsumer, , ) { 14, 15 }<br>
+    PinFunction (Exclusive, PullDown, BCM_ALT5, "<a>\\_SB.GDV0.GPI0</a>", 0, ResourceConsumer, , ) { 32, 33 }<br>
+<u></u><u></u></p>
</blockquote>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">What is the reason for trying to mux both UARTs to the BT chip? If PL011 is used for Bluetooth and the mini UART driver loads
<i>after</i> it, wouldn't it mux away the pins and break Bluetooth?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
</div>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">În lun., 31 mai 2021 la 11:23, Sunny Wang <<a href="mailto:Sunny.Wang@arm.com" target="_blank">Sunny.Wang@arm.com</a>> a scris:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt">
<p class="MsoNormal" style="margin-bottom:12pt">This change is based on edk2-platforms-raspberrypi-pl011-bth-noflow.diff<br>
in <a href="https://github.com/worproject/RPi-Bluetooth-Testing/" target="_blank">
https://github.com/worproject/RPi-Bluetooth-Testing/</a> for enabling<br>
Bluetooth and serial port (Mini UART) in Windows IOT.<br>
<br>
Note that PL011 UART still doesn't work with Windows 10 IOT with this<br>
change, but PL011 UART works fine with VMware ESXi-Arm Fling v1.3.<br>
Therefore, there should be no issue with PL011 UART related changes,<br>
and we will still need a Windows expert to take a further look in the<br>
future. Making PL011 UART work properly with Windows 10 IOT may require<br>
additional changes to Windows driver or firmware's ACPI table.<br>
<br>
Testing Done:<br>
  - Successfully booted Windows Windows 10 IOT (20279.1) on SD (made by WOR) with<br>
    the RPi-Windows-Drivers release ver 0.5 downloaded from<br>
    <a href="https://github.com/worproject/RPi-Windows-Drivers/releases" target="_blank">
https://github.com/worproject/RPi-Windows-Drivers/releases</a><br>
    and checked that both Bluetooth and serial port (Mini UART) can<br>
    work fine.<br>
  - Successfully booted VMware ESXi-Arm Fling v1.3 with only serial<br>
    console connection (PL011 UART).<br>
<br>
Cc: Samer El-Haj-Mahmoud <<a href="mailto:samer.el-haj-mahmoud@arm.com" target="_blank">samer.el-haj-mahmoud@arm.com</a>><br>
Cc: Sami Mujawar <<a href="mailto:sami.mujawar@arm.com" target="_blank">sami.mujawar@arm.com</a>><br>
Cc: Jeremy Linton <<a href="mailto:jeremy.linton@arm.com" target="_blank">jeremy.linton@arm.com</a>><br>
Cc: Pete Batard <<a href="mailto:pete@akeo.ie" target="_blank">pete@akeo.ie</a>><br>
Cc: Ard Biesheuvel <<a href="mailto:ardb%2Btianocore@kernel.org" target="_blank">ardb+tianocore@kernel.org</a>><br>
Cc: Mario Bălănică <<a href="mailto:mariobalanica02@gmail.com" target="_blank">mariobalanica02@gmail.com</a>><br>
Signed-off-by: Sunny Wang <<a href="mailto:sunny.wang@arm.com" target="_blank">sunny.wang@arm.com</a>><br>
---<br>
 Platform/RaspberryPi/AcpiTables/Uart.asl | 19 +++++++++++--------<br>
 1 file changed, 11 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/Platform/RaspberryPi/AcpiTables/Uart.asl b/Platform/RaspberryPi/AcpiTables/Uart.asl<br>
index bac9d791eb..cb99086d39 100644<br>
--- a/Platform/RaspberryPi/AcpiTables/Uart.asl<br>
+++ b/Platform/RaspberryPi/AcpiTables/Uart.asl<br>
@@ -30,6 +30,12 @@ Device (URT0)<br>
   {<br>
     MEMORY32FIXED (ReadWrite, 0, BCM2836_PL011_UART_LENGTH, RMEM)<br>
     Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_PL011_UART_INTERRUPT }<br>
+<br>
+    PinFunction (Exclusive, PullDown, BCM_ALT3, "<a>\\_SB.GDV0.GPI0</a>", 0, ResourceConsumer, , ) { 32, 33 }<br>
+<br>
+    // fake the CTS signal as we don't support HW flow control yet<br>
+    // BCM_ALT2 is set as output (low) by default<br>
+    PinFunction (Exclusive, PullNone, BCM_ALT2, "<a>\\_SB.GDV0.GPI0</a>", 0, ResourceConsumer, , ) { 31 }<br>
   })<br>
   Method (_CRS, 0x0, Serialized)<br>
   {<br>
@@ -79,6 +85,11 @@ Device (URTM)<br>
     // from muxing the pins away.<br>
<br>
     // PinFunction (Exclusive, PullDown, BCM_ALT5, "<a>\\_SB.GPI0</a>", 0, ResourceConsumer, , ) { 14, 15 }<br>
+    PinFunction (Exclusive, PullDown, BCM_ALT5, "<a>\\_SB.GDV0.GPI0</a>", 0, ResourceConsumer, , ) { 32, 33 }<br>
+<br>
+    // fake the CTS signal as we don't support HW flow control yet<br>
+    // BCM_ALT2 is set as output (low) by default<br>
+    PinFunction (Exclusive, PullNone, BCM_ALT2, "<a>\\_SB.GDV0.GPI0</a>", 0, ResourceConsumer, , ) { 31 }<br>
   })<br>
   Method (_CRS, 0x0, Serialized)<br>
   {<br>
@@ -143,10 +154,6 @@ Device(BTH0)<br>
       UAR0,          // DescriptorName: creates name<br>
                     //   for offset of resource descriptor<br>
     )                // Vendor data<br>
-    //<br>
-    // RPIQ connection for BT_ON/OFF<br>
-    //<br>
-    GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "<a>\\_SB.GDV0.RPIQ</a>", 0, ResourceConsumer, , ) { 128 }<br>
   })<br>
<br>
   //<br>
@@ -190,10 +197,6 @@ Device(BTH0)<br>
       UARM,          // DescriptorName: creates name<br>
                     //   for offset of resource descriptor<br>
     )                // Vendor data<br>
-    //<br>
-    // RPIQ connection for BT_ON/OFF<br>
-    //<br>
-    GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "<a>\\_SB.GDV0.RPIQ</a>", 0, ResourceConsumer, , ) { 128 }<br>
   })<br>
<br>
   Method (_CRS, 0x0, Serialized)<br>
-- <br>
2.31.0.windows.1<u></u><u></u></p>
</blockquote>
</div>
</div>
<p class="MsoNormal">IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person,
 use it for any purpose, or store or copy the information in any medium. Thank you.
<u></u><u></u></p>
</div>
</blockquote>
</div>
</blockquote>
</div>
<div>
<p class="MsoNormal"></u><u></u></span></p>
</div>
</div>
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose,
 or store or copy the information in any medium. Thank you.
</div>

</blockquote></div>


 <div width="1" style="color:white;clear:both">_._,_._,_</div> <hr>   Groups.io Links:<p>   You receive all messages sent to this group.    <p> <a target="_blank" href="https://edk2.groups.io/g/devel/message/76134">View/Reply Online (#76134)</a> |    |  <a target="_blank" href="https://groups.io/mt/83205747/1813853">Mute This Topic</a>  | <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>    <a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> | <a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |  <a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>  [edk2-devel-archive@redhat.com]<br> <div width="1" style="color:white;clear:both">_._,_._,_</div>