[edk2] Accessing memory above 0xFFFFFFFF limit.
Hi. I am trying to allocate a mem buffer above 4Gb address but the allocation since i am unable to locate EdkiiIoMmuProtocol. Status = gBS->LocateProtocol (, NULL, (VOID **)); Status = mIoMmuProtocol->AllocateBuffer ( mIoMmuProtocol, MaxAllocateType, EfiBootServicesData, 1, HostAddress, EDKII_IOMMU_ATTRIBUTE_DUAL_ADDRESS_CYCLE ); Best Regards Amit Kumar ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] Unable to Loacte EdkiiIoMmuProtocol.
Hi. I am trying to allocate a mem buffer above 4Gb address but the allocation since i am unable to locate EdkiiIoMmuProtocol. Status = gBS->LocateProtocol (, NULL, (VOID **)); Status = mIoMmuProtocol->AllocateBuffer ( mIoMmuProtocol, MaxAllocateType, EfiBootServicesData, 1, HostAddress, EDKII_IOMMU_ATTRIBUTE_DUAL_ADDRESS_CYCLE ); can somebody tell me the right way to do it. ? Best Regards Amit Kumar ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] SCT forum help
HI Can somebody tell me the mail chain where i can discuss sct spec and test cases related issue ? Best Regards Amit Kumar ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [NVMe SCT] Mistakes in nvmepassthru sct test case.
Forgot to mention. UEFI SCT II Case Spec 2.5 page 910 and UEFI SCT II Case Spec 2.6 A page 855. > On Nov 23, 2017, at 9:36 PM, Amit kumar <akami...@hotmail.com> wrote: > > Hi , > I think there is something wrong with SCT nvmepassthru test case mentioned on > page 910 UEFI SCT II Case Spec. for which i have attached the screen shot. > The assertion and test description looks contradictory. > Also it fails if passthru doesnt support NON-BLOCKING mode. > > Best Regards > Amit Kumar > > ___ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [NVMe SCT] Mistakes in nvmepassthru sct test case.
Hi , I think there is something wrong with SCT nvmepassthru test case mentioned on page 910 UEFI SCT II Case Spec. for which i have attached the screen shot. The assertion and test description looks contradictory. Also it fails if passthru doesnt support NON-BLOCKING mode. Best Regards Amit Kumar ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] How do i generate a SHA256 hash in UEFI
Hi , I am trying to write a uefi standalone application ( not a uefi shell app), which generates a sh256 hash, can some body tell me the right way to do it. Do i really need to use hash protocol. Is there any other way to do it without using this protocol ? Best Regards Amit Kumar ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] How to add images to HiiDatabase.
i refered edk2/MdeModulePkg/Logo but the problem is how to pass logo.bmp to hiidatabase ? Amit On Aug 8, 2017, at 7:20 PM, Zhu, Yonghong <yonghong@intel.com<mailto:yonghong@intel.com>> wrote: The IMAGE_TOKEN should be used in the source file. You can refer edk2/MdeModulePkg/Logo Best Regards, Zhu Yonghong -Original Message- From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Amit kumar Sent: Tuesday, August 08, 2017 8:31 PM To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Subject: [edk2] How to add images to HiiDatabase. Hi , Can somebody tell me how to add images to hiidatabase . I have image.png file and a image.idf file. Is there something than has to be done during compilation ? like Vfr ? can i use HiiAddPackages ? Thanks And Regards Amit Kumar ___ edk2-devel mailing list edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] writing EDK compatible application.
Laszlo, Andrew, Marvin Thank you very much for your suggestions and for sharing information. It really did help a lot. Thanks and Regards Amit From: Laszlo Ersek <ler...@redhat.com> Sent: Wednesday, July 5, 2017 1:40:49 AM To: Amit kumar; edk2-devel@lists.01.org Subject: Re: [edk2] writing EDK compatible application. On 07/04/17 19:20, Amit kumar wrote: > > HI, > > I have written a code (say helloworld program ) using edk2 framework, named > the output efi file as BOOTx64.efi and placed it on a removable media in > EFI/BOOT/ directory so that the application is listed in one time boot menu. > When selected from boot menu it prints "Hello World". > Which works as expected when tested on UEFI 2.3 and above platforms. > But the same code fails to execute on EFI 1.10 platforms. Which i suppose is > the problem with application entry point. > Can somebody suggest me a way so that the application entry function can be > compatible to both the platform. Even when written according to UEFI 2.5+ > Spec ? I don't think you can develop for EFI 1 using edk2 -- unless you use EdkCompatibilityPkg I guess. But, I don't know how much EdkCompatibilityPkg is maintained. Here's some links: https://github.com/tianocore/tianocore.github.io/wiki/EdkCompatibilityPkg https://github.com/tianocore/tianocore.github.io/wiki/EDK The entry point is likely the least of your problems. The library instances pulled in from under MdePkg, MdeModulePkg etc are full of UEFI 2.* dependencies, I'm pretty sure. I would suggest ignoring EFI 1... Thanks Laszlo ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] writing EDK compatible application.
Hey, I just can find any spec on ConsoleControl protocol, can you tell what/where to refer ? Amit On Jul 4, 2017, at 11:25 PM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>> wrote: Thanks for the suggestion Marvin, I will try switching to text mode. Amit On Jul 4, 2017, at 11:21 PM, Marvin Häuser <marvin.haeu...@outlook.com<mailto:marvin.haeu...@outlook.com>> wrote: Well, if EFI Shell 1.0 works, why not use it? Mac EFI exposes the ConsoleControl protocol, which lets you switch between text and graphics mode. That might be the reason your text outputs don't show, because graphics is the default mode on Mac EFI, though I could never test this myself as I lack the hardware. Regards, Marvin. -Original Message- From: Amit kumar [mailto:akami...@hotmail.com] Sent: Tuesday, July 4, 2017 7:46 PM To: Marvin H?user <marvin.haeu...@outlook.com<mailto:marvin.haeu...@outlook.com>> Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Subject: Re: [edk2] writing EDK compatible application. Hi, Yes intact it’s MacBook, but is there another way to do it without UEFI shell. In edk2/shellpkgbin are 2.2+, even shell fails to execute on Mac. Although efi shell 1.0 works. Is there a to do it without shell ? Thanks Amit On Jul 4, 2017, at 11:05 PM, Marvin H?user <marvin.haeu...@outlook.com<mailto:marvin.haeu...@outlook.com>> wrote: Hey, The entry point declarations and the calling conventions have not changed since EFI 1.10, though X64 was not a supported platform for 1.10 if I remember correctly. To be honest, I never saw an x64 EFI 1.10 implementation other than Apple's, though even if it still signals that version, it's actually more UEFI by now. I don't own a Mac, so if it's the platform you tested your app on, I can't tell you why it didn't work, but I would suggest you to run the app from an EFI Shell. Regards, Marvin. -Original Message- From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Amit kumar Sent: Tuesday, July 4, 2017 7:21 PM To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Subject: [edk2] writing EDK compatible application. HI, I have written a code (say helloworld program ) using edk2 framework, named the output efi file as BOOTx64.efi and placed it on a removable media in EFI/BOOT/ directory so that the application is listed in one time boot menu. When selected from boot menu it prints "Hello World". Which works as expected when tested on UEFI 2.3 and above platforms. But the same code fails to execute on EFI 1.10 platforms. Which i suppose is the problem with application entry point. Can somebody suggest me a way so that the application entry function can be compatible to both the platform. Even when written according to UEFI 2.5+ Spec ? Thanks Amit ___ edk2-devel mailing list edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] writing EDK compatible application.
Thanks for the suggestion Marvin, I will try switching to text mode. Amit > On Jul 4, 2017, at 11:21 PM, Marvin Häuser <marvin.haeu...@outlook.com> wrote: > > Well, if EFI Shell 1.0 works, why not use it? > Mac EFI exposes the ConsoleControl protocol, which lets you switch between > text and graphics mode. > That might be the reason your text outputs don't show, because graphics is > the default mode on Mac EFI, > though I could never test this myself as I lack the hardware. > > Regards, > Marvin. > >> -Original Message- >> From: Amit kumar [mailto:akami...@hotmail.com] >> Sent: Tuesday, July 4, 2017 7:46 PM >> To: Marvin H?user <marvin.haeu...@outlook.com> >> Cc: edk2-devel@lists.01.org >> Subject: Re: [edk2] writing EDK compatible application. >> >> Hi, >> Yes intact it’s MacBook, but is there another way to do it without UEFI >> shell. >> In edk2/shellpkgbin are 2.2+, even shell fails to execute on Mac. >> Although efi shell 1.0 works. Is there a to do it without shell ? >> Thanks >> Amit >>> On Jul 4, 2017, at 11:05 PM, Marvin H?user >> <marvin.haeu...@outlook.com> wrote: >>> >>> Hey, >>> >>> The entry point declarations and the calling conventions have not changed >> since EFI 1.10, though X64 was not a supported platform for 1.10 if I >> remember correctly. >>> To be honest, I never saw an x64 EFI 1.10 implementation other than >> Apple's, though even if it still signals that version, it's actually more >> UEFI by >> now. >>> I don't own a Mac, so if it's the platform you tested your app on, I can't >>> tell >> you why it didn't work, but I would suggest you to run the app from an EFI >> Shell. >>> >>> Regards, >>> Marvin. >>> >>>> -Original Message- >>>> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf >>>> Of Amit kumar >>>> Sent: Tuesday, July 4, 2017 7:21 PM >>>> To: edk2-devel@lists.01.org >>>> Subject: [edk2] writing EDK compatible application. >>>> >>>> >>>> HI, >>>> >>>> I have written a code (say helloworld program ) using edk2 framework, >>>> named the output efi file as BOOTx64.efi and placed it on a removable >>>> media in EFI/BOOT/ directory so that the application is listed in one time >> boot menu. >>>> When selected from boot menu it prints "Hello World". >>>> Which works as expected when tested on UEFI 2.3 and above platforms. >>>> But the same code fails to execute on EFI 1.10 platforms. Which i >>>> suppose is the problem with application entry point. >>>> Can somebody suggest me a way so that the application entry function >>>> can be compatible to both the platform. Even when written according >>>> to UEFI 2.5+ Spec ? >>>> >>>> Thanks >>>> Amit >>>> ___ >>>> edk2-devel mailing list >>>> edk2-devel@lists.01.org >>>> https://lists.01.org/mailman/listinfo/edk2-devel > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] writing EDK compatible application.
Hi, Yes intact it’s MacBook, but is there another way to do it without UEFI shell. In edk2/shellpkgbin are 2.2+, even shell fails to execute on Mac. Although efi shell 1.0 works. Is there a to do it without shell ? Thanks Amit > On Jul 4, 2017, at 11:05 PM, Marvin H?user <marvin.haeu...@outlook.com> wrote: > > Hey, > > The entry point declarations and the calling conventions have not changed > since EFI 1.10, though X64 was not a supported platform for 1.10 if I > remember correctly. > To be honest, I never saw an x64 EFI 1.10 implementation other than Apple's, > though even if it still signals that version, it's actually more UEFI by now. > I don't own a Mac, so if it's the platform you tested your app on, I can't > tell you why it didn't work, but I would suggest you to run the app from an > EFI Shell. > > Regards, > Marvin. > >> -Original Message- >> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of >> Amit kumar >> Sent: Tuesday, July 4, 2017 7:21 PM >> To: edk2-devel@lists.01.org >> Subject: [edk2] writing EDK compatible application. >> >> >> HI, >> >> I have written a code (say helloworld program ) using edk2 framework, >> named the output efi file as BOOTx64.efi and placed it on a removable media >> in EFI/BOOT/ directory so that the application is listed in one time boot >> menu. >> When selected from boot menu it prints "Hello World". >> Which works as expected when tested on UEFI 2.3 and above platforms. >> But the same code fails to execute on EFI 1.10 platforms. Which i suppose is >> the problem with application entry point. >> Can somebody suggest me a way so that the application entry function can >> be compatible to both the platform. Even when written according to UEFI >> 2.5+ Spec ? >> >> Thanks >> Amit >> ___ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] writing EDK compatible application.
HI, I have written a code (say helloworld program ) using edk2 framework, named the output efi file as BOOTx64.efi and placed it on a removable media in EFI/BOOT/ directory so that the application is listed in one time boot menu. When selected from boot menu it prints "Hello World". Which works as expected when tested on UEFI 2.3 and above platforms. But the same code fails to execute on EFI 1.10 platforms. Which i suppose is the problem with application entry point. Can somebody suggest me a way so that the application entry function can be compatible to both the platform. Even when written according to UEFI 2.5+ Spec ? Thanks Amit ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] DisconnectController API not working.
Just a final check, You used this gBS->DisconnectController ( ConvertHandleIndexToHandle (0x175), ConvertHandleIndexToHandle (0x176), NULL); not this gBS->DisconnectController ( ConvertHandleIndexToHandle (175), ConvertHandleIndexToHandle (176), NULL); right ? Amit On Jun 29, 2017, at 1:04 AM, Andrew Fish <af...@apple.com<mailto:af...@apple.com>> wrote: On Jun 28, 2017, at 12:27 PM, TVKR <tres...@gmail.com<mailto:tres...@gmail.com>> wrote: Tried it, still no luck :( There is something in the Shell that makes the in-built disconnect without any issues but when the same DisconnectController is called from an application is fails. It is more likely you are doing something wrong. Using HandleIndex is risky as it is more about User Interface than reality. Have you tried printing out the EFI_HANDLE values you are passing into gBS->DisconnectController()? The should match the values you get when you dump a specific handle in the shell. The EFI_HANDLE value is not going to change, it is only going to get removed if all protocols on that handle are uninstalled. So for example. 176: 7219E798 If you used 178 at the Shell you would expect to see 7219E798 printed out as the handle value. Thanks, Andrew Fish Thanks On Wed, Jun 28, 2017 at 1:23 PM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>> wrote: EFI_STATUS EFIAPI UefiMain ( IN EFI_HANDLEImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; gBS->DisconnectController ( ConvertHandleIndexToHandle (0x175), ConvertHandleIndexToHandle (0x176), NULL); return (Status); } -- *From:* edk2-devel <edk2-devel-boun...@lists.01.org<mailto:edk2-devel-boun...@lists.01.org>> on behalf of Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>> *Sent:* Wednesday, June 28, 2017 11:41:53 PM *To:* TVKR *Cc:* edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> *Subject:* Re: [edk2] DisconnectController API not working. Try this; just a quick thing EFI_STATUS EFIAPI UefiMain ( IN EFI_HANDLEImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; gBS->DisconnectController ( ConvertHandleIndexToHandle (175), ConvertHandleIndexToHandle (176), NULL); return (Status); } From: TVKR <tres...@gmail.com<mailto:tres...@gmail.com>> Sent: Wednesday, June 28, 2017 11:31:46 PM To: Amit kumar Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Subject: Re: [edk2] DisconnectController API not working. Yes, the shell's in-built command disconnect (disconnect 175 176) worked but DisconnectController call from the application still did not work. On Wed, Jun 28, 2017 at 12:56 PM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>mailto:akami...@hotmail.com>>> wrote: okay, os tell me , did you try "disconnect 175 176" in UEFI shell ? From: TVKR <tres...@gmail.com<mailto:tres...@gmail.com><mailto:tres...@gmail.com>> Sent: Wednesday, June 28, 2017 11:21:34 PM To: Amit kumar Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org><mailto:edk2-devel@lists.01.org> Subject: Re: [edk2] DisconnectController API not working. Sorry, I wasn't clear in my last email. No it did not hang. The 'reconnect -r' command completed successfully (no errors reported on screen). On Wed, Jun 28, 2017 at 12:50 PM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>mailto:akami...@hotmail.com>>> wrote: Did it hang ? From: TVKR <tres...@gmail.com<mailto:tres...@gmail.com><mailto:tres...@gmail.com>> Sent: Wednesday, June 28, 2017 10:45:13 PM To: Amit kumar Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org><mailto:edk2-devel@lists.01.org> Subject: Re: [edk2] DisconnectController API not working. Thanks for the suggestion Amit. I tried the reconnect -r but it doesn't seem to help. On Wed, Jun 28, 2017 at 10:29 AM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>mailto:akami...@hotmail.com>>> wrote: Hi Tresko, I looks like there is no problem with your implementation, as was the case with me. I can suggest you a quick trick here, if it won’t work I will help you further which might take a while. Follow the steps below. 1. Go to refi shell 2. Reconnect -r 3. If the sysytem hangs. 4. Try to update your BIOS/UEFI to latest (as I had noticed the eariler BIOS/UEFI had some some problem which normally gets fixed with updates). 5. After update once again try Reconnect -r. 6. If theres a no hang restart the system and now you can try your app or just give disconnect in uefi shell. 7. If still I doesn’t work you can ping me I migh
Re: [edk2] DisconnectController API not working.
EFI_STATUS EFIAPI UefiMain ( IN EFI_HANDLEImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; gBS->DisconnectController ( ConvertHandleIndexToHandle (0x175), ConvertHandleIndexToHandle (0x176), NULL); return (Status); } From: edk2-devel <edk2-devel-boun...@lists.01.org> on behalf of Amit kumar <akami...@hotmail.com> Sent: Wednesday, June 28, 2017 11:41:53 PM To: TVKR Cc: edk2-devel@lists.01.org Subject: Re: [edk2] DisconnectController API not working. Try this; just a quick thing EFI_STATUS EFIAPI UefiMain ( IN EFI_HANDLEImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; gBS->DisconnectController ( ConvertHandleIndexToHandle (175), ConvertHandleIndexToHandle (176), NULL); return (Status); } From: TVKR <tres...@gmail.com> Sent: Wednesday, June 28, 2017 11:31:46 PM To: Amit kumar Cc: edk2-devel@lists.01.org Subject: Re: [edk2] DisconnectController API not working. Yes, the shell's in-built command disconnect (disconnect 175 176) worked but DisconnectController call from the application still did not work. On Wed, Jun 28, 2017 at 12:56 PM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>> wrote: okay, os tell me , did you try "disconnect 175 176" in UEFI shell ? From: TVKR <tres...@gmail.com<mailto:tres...@gmail.com>> Sent: Wednesday, June 28, 2017 11:21:34 PM To: Amit kumar Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Subject: Re: [edk2] DisconnectController API not working. Sorry, I wasn't clear in my last email. No it did not hang. The 'reconnect -r' command completed successfully (no errors reported on screen). On Wed, Jun 28, 2017 at 12:50 PM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>> wrote: Did it hang ? From: TVKR <tres...@gmail.com<mailto:tres...@gmail.com>> Sent: Wednesday, June 28, 2017 10:45:13 PM To: Amit kumar Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Subject: Re: [edk2] DisconnectController API not working. Thanks for the suggestion Amit. I tried the reconnect -r but it doesn't seem to help. On Wed, Jun 28, 2017 at 10:29 AM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>> wrote: Hi Tresko, I looks like there is no problem with your implementation, as was the case with me. I can suggest you a quick trick here, if it won’t work I will help you further which might take a while. Follow the steps below. 1. Go to refi shell 2. Reconnect -r 3. If the sysytem hangs. 4. Try to update your BIOS/UEFI to latest (as I had noticed the eariler BIOS/UEFI had some some problem which normally gets fixed with updates). 5. After update once again try Reconnect -r. 6. If theres a no hang restart the system and now you can try your app or just give disconnect in uefi shell. 7. If still I doesn’t work you can ping me I might suggest the other way around. Amit On Jun 28, 2017, at 8:05 PM, TVKR <tres...@gmail.com<mailto:tres...@gmail.com>> wrote: Hi Amit, Here is the output. It is the call 'gBS->DisconnectController (ControllerHandle, NULL, NULL)' (where ControllerHandle=7219EA98) that doesn't seem to correctly work. FS0:\> drivers Output Truncated.. 176 07042200 B Y Y 1 1 Intel(R) PRO/1000 7.3.18 PCI-E PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0)/Offset(0x1D200,0x3E9FF) 178 07042200 B Y Y 1 1 Intel(R) PRO/1000 7.3.18 PCI-E PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x1)/Offset(0x1D200,0x3E9FF) FS0:\> dh 176 -d -v 176: 7219E798 DriverVersion 0x00020028 EfiDriverHealthProtocolGuid DriverConfiguration DriverDiagnostics2 ComponentName2 DriverDiagnostics ComponentName DriverBinding ImageDevicePath LoadedImage Revision..: 0x1000 ParentHandle..: 72B70A18 SystemTable...: 788FEF18 DeviceHandle..: 7219EA98 FilePath..: 7219E998 OptionsSize...: 0 LoadOptions...: ImageBase.: 776A ImageSize.: 555E0 CodeType..: EfiBootServicesCode DataType..: EfiBootServicesData Unload: 776A0708 Child[176]: Intel(R) PRO/1000 7.3.18 PCI-E Driver Image Name : Offset(0x1D200,0x3E9FF) Driver Version : 07031800 Driver Type: Bus Configuration : YES Diagnostics: YES Child Controllers : Ctrl[175] : PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) Child[219]: Intel Ethernet Server Adapter I350-T2 FS0:\> dh 175 -d -v 175: 7219EA98 UnknownDevice UnknownDevice BusSpecificDriverOverride LoadFile2 PCIIO DevicePath PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) Controller Name: PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) Device Path: PciRoot(0x0)/Pci(0x2,0x
Re: [edk2] DisconnectController API not working.
Try this; just a quick thing EFI_STATUS EFIAPI UefiMain ( IN EFI_HANDLEImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; gBS->DisconnectController ( ConvertHandleIndexToHandle (175), ConvertHandleIndexToHandle (176), NULL); return (Status); } From: TVKR <tres...@gmail.com> Sent: Wednesday, June 28, 2017 11:31:46 PM To: Amit kumar Cc: edk2-devel@lists.01.org Subject: Re: [edk2] DisconnectController API not working. Yes, the shell's in-built command disconnect (disconnect 175 176) worked but DisconnectController call from the application still did not work. On Wed, Jun 28, 2017 at 12:56 PM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>> wrote: okay, os tell me , did you try "disconnect 175 176" in UEFI shell ? From: TVKR <tres...@gmail.com<mailto:tres...@gmail.com>> Sent: Wednesday, June 28, 2017 11:21:34 PM To: Amit kumar Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Subject: Re: [edk2] DisconnectController API not working. Sorry, I wasn't clear in my last email. No it did not hang. The 'reconnect -r' command completed successfully (no errors reported on screen). On Wed, Jun 28, 2017 at 12:50 PM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>> wrote: Did it hang ? From: TVKR <tres...@gmail.com<mailto:tres...@gmail.com>> Sent: Wednesday, June 28, 2017 10:45:13 PM To: Amit kumar Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Subject: Re: [edk2] DisconnectController API not working. Thanks for the suggestion Amit. I tried the reconnect -r but it doesn't seem to help. On Wed, Jun 28, 2017 at 10:29 AM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>> wrote: Hi Tresko, I looks like there is no problem with your implementation, as was the case with me. I can suggest you a quick trick here, if it won’t work I will help you further which might take a while. Follow the steps below. 1. Go to refi shell 2. Reconnect -r 3. If the sysytem hangs. 4. Try to update your BIOS/UEFI to latest (as I had noticed the eariler BIOS/UEFI had some some problem which normally gets fixed with updates). 5. After update once again try Reconnect -r. 6. If theres a no hang restart the system and now you can try your app or just give disconnect in uefi shell. 7. If still I doesn’t work you can ping me I might suggest the other way around. Amit On Jun 28, 2017, at 8:05 PM, TVKR <tres...@gmail.com<mailto:tres...@gmail.com>> wrote: Hi Amit, Here is the output. It is the call 'gBS->DisconnectController (ControllerHandle, NULL, NULL)' (where ControllerHandle=7219EA98) that doesn't seem to correctly work. FS0:\> drivers Output Truncated.. 176 07042200 B Y Y 1 1 Intel(R) PRO/1000 7.3.18 PCI-E PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0)/Offset(0x1D200,0x3E9FF) 178 07042200 B Y Y 1 1 Intel(R) PRO/1000 7.3.18 PCI-E PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x1)/Offset(0x1D200,0x3E9FF) FS0:\> dh 176 -d -v 176: 7219E798 DriverVersion 0x00020028 EfiDriverHealthProtocolGuid DriverConfiguration DriverDiagnostics2 ComponentName2 DriverDiagnostics ComponentName DriverBinding ImageDevicePath LoadedImage Revision..: 0x1000 ParentHandle..: 72B70A18 SystemTable...: 788FEF18 DeviceHandle..: 7219EA98 FilePath..: 7219E998 OptionsSize...: 0 LoadOptions...: ImageBase.: 776A ImageSize.: 555E0 CodeType..: EfiBootServicesCode DataType..: EfiBootServicesData Unload: 776A0708 Child[176]: Intel(R) PRO/1000 7.3.18 PCI-E Driver Image Name : Offset(0x1D200,0x3E9FF) Driver Version : 07031800 Driver Type: Bus Configuration : YES Diagnostics: YES Child Controllers : Ctrl[175] : PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) Child[219]: Intel Ethernet Server Adapter I350-T2 FS0:\> dh 175 -d -v 175: 7219EA98 UnknownDevice UnknownDevice BusSpecificDriverOverride LoadFile2 PCIIO DevicePath PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) Controller Name: PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) Device Path: PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) Controller Type: BUS Configuration : NO Diagnostics: NO Managed by : Drv[176] : Intel(R) PRO/1000 7.3.18 PCI-E Parent Controllers : Parent[75] : PciRoot(0x0) Child Controllers : Child[219]: Intel Ethernet Server Adapter I350-T2 Thanks On Wed, Jun 28, 2017 at 9:07 AM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>> wrote: Hi Tresko, >Hi Amit, >I am seeing the exact same issue on my system with DisconnectController. The >shell command '
Re: [edk2] [PATCH V5] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol
sorry, wrong thread From: edk2-devel <edk2-devel-boun...@lists.01.org> on behalf of Star Zeng <star.z...@intel.com> Sent: Wednesday, June 28, 2017 6:52:50 PM To: edk2-devel@lists.01.org Cc: Liming Gao; Gabriel Somlo; Michael D Kinney; Laszlo Ersek; Star Zeng Subject: [edk2] [PATCH V5] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol From: Amit Kumar <amit...@samsung.com> Change since v4: Revise the patch based on V4 sent by Amit Kumar 1) Only return the corresponding protocol interface in *Interface if the return status is EFI_SUCCESS or EFI_ALREADY_STARTED. 2) Interface is returned unmodified for all error conditions except EFI_UNSUPPORTED and EFI_ALREADY_STARTED, NULL will be returned in *Interface when EFI_UNSUPPORTED and Attributes is not EFI_OPEN_PROTOCOL_TEST_PROTOCOL, the protocol interface will be returned in *Interface when EFI_ALREADY_STARTED. Change since v3: 1) Fixed issue when Attributes = EFI_OPEN_PROTOCOL_TEST_PROTOCOL and Inteface = NULL case. [Reported by:star.zeng at intel.com] Change Since v2: 1) Modified to use EFI_ERROR to get status code Change since v1: 1) Fixed typo protocal to protocol 2) Fixed coding style Cc: Laszlo Ersek <ler...@redhat.com> Cc: Amit Kumar <amit...@samsung.com> Cc: Michael D Kinney <michael.d.kin...@intel.com> Cc: Liming Gao <liming@intel.com> Cc: Gabriel Somlo <gso...@gmail.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Amit Kumar <amit...@samsung.com> Signed-off-by: Star Zeng <star.z...@intel.com> --- MdeModulePkg/Core/Dxe/Hand/Handle.c | 36 +++- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/Hand/Handle.c index 59b89148c8f0..3862a3876f4a 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c @@ -1006,12 +1006,8 @@ CoreOpenProtocol ( // // Check for invalid Interface // - if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { -if (Interface == NULL) { - return EFI_INVALID_PARAMETER; -} else { - *Interface = NULL; -} + if ((Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) && (Interface == NULL)) { +return EFI_INVALID_PARAMETER; } // @@ -1078,12 +1074,6 @@ CoreOpenProtocol ( goto Done; } - // - // This is the protocol interface entry for this protocol - // - if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { -*Interface = Prot->Interface; - } Status = EFI_SUCCESS; ByDriver= FALSE; @@ -1177,8 +1167,28 @@ CoreOpenProtocol ( } Done: + + if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { +// +// Keep Interface unmodified in case of any Error +// except EFI_ALREADY_STARTED and EFI_UNSUPPORTED. +// +if (!EFI_ERROR (Status) || Status == EFI_ALREADY_STARTED) { + // + // EFI_ALREADY_STARTED is not an error for bus driver. + // Return the corresponding protocol interface. + // + *Interface = Prot->Interface; +} else if (Status == EFI_UNSUPPORTED) { + // + // Return NULL Interface if Unsupported Protocol. + // + *Interface = NULL; +} + } + // - // Done. Release the database lock are return + // Done. Release the database lock and return // CoreReleaseProtocolLock (); return Status; -- 2.7.0.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH V5] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol
Try this; just a quick thing EFI_STATUS EFIAPI UefiMain ( IN EFI_HANDLEImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; ConvertHandleIndexToHandle((UINTN)Intermediate); gBS->DisconnectController ( ConvertHandleIndexToHandle (175), ConvertHandleIndexToHandle (176), NULL); return (Status); } From: edk2-devel <edk2-devel-boun...@lists.01.org> on behalf of Laszlo Ersek <ler...@redhat.com> Sent: Wednesday, June 28, 2017 7:43:45 PM To: Star Zeng; edk2-devel@lists.01.org Cc: Michael D Kinney; Gabriel Somlo; Liming Gao Subject: Re: [edk2] [PATCH V5] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol On 06/28/17 15:22, Star Zeng wrote: > From: Amit Kumar <amit...@samsung.com> > > Change since v4: Revise the patch based on V4 sent by Amit Kumar > 1) Only return the corresponding protocol interface in *Interface > if the return status is EFI_SUCCESS or EFI_ALREADY_STARTED. > 2) Interface is returned unmodified for all error conditions except > EFI_UNSUPPORTED and EFI_ALREADY_STARTED, NULL will be returned in > *Interface when EFI_UNSUPPORTED and Attributes is not > EFI_OPEN_PROTOCOL_TEST_PROTOCOL, the protocol interface will be > returned in *Interface when EFI_ALREADY_STARTED. > > Change since v3: > 1) Fixed issue when Attributes = EFI_OPEN_PROTOCOL_TEST_PROTOCOL > and Inteface = NULL case. [Reported by:star.zeng at intel.com] > > Change Since v2: > 1) Modified to use EFI_ERROR to get status code > > Change since v1: > 1) Fixed typo protocal to protocol > 2) Fixed coding style > > Cc: Laszlo Ersek <ler...@redhat.com> > Cc: Amit Kumar <amit...@samsung.com> > Cc: Michael D Kinney <michael.d.kin...@intel.com> > Cc: Liming Gao <liming@intel.com> > Cc: Gabriel Somlo <gso...@gmail.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Amit Kumar <amit...@samsung.com> > Signed-off-by: Star Zeng <star.z...@intel.com> > --- > MdeModulePkg/Core/Dxe/Hand/Handle.c | 36 +++- > 1 file changed, 23 insertions(+), 13 deletions(-) Reviewed-by: Laszlo Ersek <ler...@redhat.com> Tested-by: Laszlo Ersek <ler...@redhat.com> Thanks! Laszlo > diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c > b/MdeModulePkg/Core/Dxe/Hand/Handle.c > index 59b89148c8f0..3862a3876f4a 100644 > --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c > +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c > @@ -1006,12 +1006,8 @@ CoreOpenProtocol ( >// >// Check for invalid Interface >// > - if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { > -if (Interface == NULL) { > - return EFI_INVALID_PARAMETER; > -} else { > - *Interface = NULL; > -} > + if ((Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) && (Interface == > NULL)) { > +return EFI_INVALID_PARAMETER; >} > >// > @@ -1078,12 +1074,6 @@ CoreOpenProtocol ( > goto Done; >} > > - // > - // This is the protocol interface entry for this protocol > - // > - if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { > -*Interface = Prot->Interface; > - } >Status = EFI_SUCCESS; > >ByDriver= FALSE; > @@ -1177,8 +1167,28 @@ CoreOpenProtocol ( >} > > Done: > + > + if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { > +// > +// Keep Interface unmodified in case of any Error > +// except EFI_ALREADY_STARTED and EFI_UNSUPPORTED. > +// > +if (!EFI_ERROR (Status) || Status == EFI_ALREADY_STARTED) { > + // > + // EFI_ALREADY_STARTED is not an error for bus driver. > + // Return the corresponding protocol interface. > + // > + *Interface = Prot->Interface; > +} else if (Status == EFI_UNSUPPORTED) { > + // > + // Return NULL Interface if Unsupported Protocol. > + // > + *Interface = NULL; > +} > + } > + >// > - // Done. Release the database lock are return > + // Done. Release the database lock and return >// >CoreReleaseProtocolLock (); >return Status; > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] DisconnectController API not working.
okay, os tell me , did you try "disconnect 175 176" in UEFI shell ? From: TVKR <tres...@gmail.com> Sent: Wednesday, June 28, 2017 11:21:34 PM To: Amit kumar Cc: edk2-devel@lists.01.org Subject: Re: [edk2] DisconnectController API not working. Sorry, I wasn't clear in my last email. No it did not hang. The 'reconnect -r' command completed successfully (no errors reported on screen). On Wed, Jun 28, 2017 at 12:50 PM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>> wrote: Did it hang ? From: TVKR <tres...@gmail.com<mailto:tres...@gmail.com>> Sent: Wednesday, June 28, 2017 10:45:13 PM To: Amit kumar Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Subject: Re: [edk2] DisconnectController API not working. Thanks for the suggestion Amit. I tried the reconnect -r but it doesn't seem to help. On Wed, Jun 28, 2017 at 10:29 AM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>> wrote: Hi Tresko, I looks like there is no problem with your implementation, as was the case with me. I can suggest you a quick trick here, if it won’t work I will help you further which might take a while. Follow the steps below. 1. Go to refi shell 2. Reconnect -r 3. If the sysytem hangs. 4. Try to update your BIOS/UEFI to latest (as I had noticed the eariler BIOS/UEFI had some some problem which normally gets fixed with updates). 5. After update once again try Reconnect -r. 6. If theres a no hang restart the system and now you can try your app or just give disconnect in uefi shell. 7. If still I doesn’t work you can ping me I might suggest the other way around. Amit On Jun 28, 2017, at 8:05 PM, TVKR <tres...@gmail.com<mailto:tres...@gmail.com>> wrote: Hi Amit, Here is the output. It is the call 'gBS->DisconnectController (ControllerHandle, NULL, NULL)' (where ControllerHandle=7219EA98) that doesn't seem to correctly work. FS0:\> drivers Output Truncated.. 176 07042200 B Y Y 1 1 Intel(R) PRO/1000 7.3.18 PCI-E PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0)/Offset(0x1D200,0x3E9FF) 178 07042200 B Y Y 1 1 Intel(R) PRO/1000 7.3.18 PCI-E PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x1)/Offset(0x1D200,0x3E9FF) FS0:\> dh 176 -d -v 176: 7219E798 DriverVersion 0x00020028 EfiDriverHealthProtocolGuid DriverConfiguration DriverDiagnostics2 ComponentName2 DriverDiagnostics ComponentName DriverBinding ImageDevicePath LoadedImage Revision..: 0x1000 ParentHandle..: 72B70A18 SystemTable...: 788FEF18 DeviceHandle..: 7219EA98 FilePath..: 7219E998 OptionsSize...: 0 LoadOptions...: ImageBase.: 776A ImageSize.: 555E0 CodeType..: EfiBootServicesCode DataType..: EfiBootServicesData Unload: 776A0708 Child[176]: Intel(R) PRO/1000 7.3.18 PCI-E Driver Image Name : Offset(0x1D200,0x3E9FF) Driver Version : 07031800 Driver Type: Bus Configuration : YES Diagnostics: YES Child Controllers : Ctrl[175] : PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) Child[219]: Intel Ethernet Server Adapter I350-T2 FS0:\> dh 175 -d -v 175: 7219EA98 UnknownDevice UnknownDevice BusSpecificDriverOverride LoadFile2 PCIIO DevicePath PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) Controller Name: PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) Device Path: PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) Controller Type: BUS Configuration : NO Diagnostics: NO Managed by : Drv[176] : Intel(R) PRO/1000 7.3.18 PCI-E Parent Controllers : Parent[75] : PciRoot(0x0) Child Controllers : Child[219]: Intel Ethernet Server Adapter I350-T2 Thanks On Wed, Jun 28, 2017 at 9:07 AM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>> wrote: Hi Tresko, >Hi Amit, >I am seeing the exact same issue on my system with DisconnectController. The >shell command 'disconnect' works but when I use the gBS->DisconnectController >>call from my application it doesn't seem to really disconnect the same >controller (even though the call returns SUCCESS) and it still appears to be >managed by >driver. I even checked the ControllerHandle passed and it looks >correct. Were you able to resolve this eventually? Yes i was able to resolve it. It might be helpful if you can tell me the output of dh -d command. Thanks Amit From: TVKR <tres...@gmail.com<mailto:tres...@gmail.com>> Sent: Wednesday, June 28, 2017 6:06:11 PM To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>; akami...@hotmail.com<mailto:akami...@hotmail.com> Subject: Re: [edk2] DisconnectController API not working. BTW, I ported the disconnect code (under ShellPkg\Library\
Re: [edk2] DisconnectController API not working.
Did it hang ? From: TVKR <tres...@gmail.com> Sent: Wednesday, June 28, 2017 10:45:13 PM To: Amit kumar Cc: edk2-devel@lists.01.org Subject: Re: [edk2] DisconnectController API not working. Thanks for the suggestion Amit. I tried the reconnect -r but it doesn't seem to help. On Wed, Jun 28, 2017 at 10:29 AM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>> wrote: Hi Tresko, I looks like there is no problem with your implementation, as was the case with me. I can suggest you a quick trick here, if it won’t work I will help you further which might take a while. Follow the steps below. 1. Go to refi shell 2. Reconnect -r 3. If the sysytem hangs. 4. Try to update your BIOS/UEFI to latest (as I had noticed the eariler BIOS/UEFI had some some problem which normally gets fixed with updates). 5. After update once again try Reconnect -r. 6. If theres a no hang restart the system and now you can try your app or just give disconnect in uefi shell. 7. If still I doesn’t work you can ping me I might suggest the other way around. Amit On Jun 28, 2017, at 8:05 PM, TVKR <tres...@gmail.com<mailto:tres...@gmail.com>> wrote: Hi Amit, Here is the output. It is the call 'gBS->DisconnectController (ControllerHandle, NULL, NULL)' (where ControllerHandle=7219EA98) that doesn't seem to correctly work. FS0:\> drivers Output Truncated.. 176 07042200 B Y Y 1 1 Intel(R) PRO/1000 7.3.18 PCI-E PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0)/Offset(0x1D200,0x3E9FF) 178 07042200 B Y Y 1 1 Intel(R) PRO/1000 7.3.18 PCI-E PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x1)/Offset(0x1D200,0x3E9FF) FS0:\> dh 176 -d -v 176: 7219E798 DriverVersion 0x00020028 EfiDriverHealthProtocolGuid DriverConfiguration DriverDiagnostics2 ComponentName2 DriverDiagnostics ComponentName DriverBinding ImageDevicePath LoadedImage Revision..: 0x1000 ParentHandle..: 72B70A18 SystemTable...: 788FEF18 DeviceHandle..: 7219EA98 FilePath..: 7219E998 OptionsSize...: 0 LoadOptions...: ImageBase.: 776A ImageSize.: 555E0 CodeType..: EfiBootServicesCode DataType..: EfiBootServicesData Unload: 776A0708 Child[176]: Intel(R) PRO/1000 7.3.18 PCI-E Driver Image Name : Offset(0x1D200,0x3E9FF) Driver Version : 07031800 Driver Type: Bus Configuration : YES Diagnostics: YES Child Controllers : Ctrl[175] : PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) Child[219]: Intel Ethernet Server Adapter I350-T2 FS0:\> dh 175 -d -v 175: 7219EA98 UnknownDevice UnknownDevice BusSpecificDriverOverride LoadFile2 PCIIO DevicePath PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) Controller Name: PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) Device Path: PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) Controller Type: BUS Configuration : NO Diagnostics: NO Managed by : Drv[176] : Intel(R) PRO/1000 7.3.18 PCI-E Parent Controllers : Parent[75] : PciRoot(0x0) Child Controllers : Child[219]: Intel Ethernet Server Adapter I350-T2 Thanks On Wed, Jun 28, 2017 at 9:07 AM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>> wrote: Hi Tresko, >Hi Amit, >I am seeing the exact same issue on my system with DisconnectController. The >shell command 'disconnect' works but when I use the gBS->DisconnectController >>call from my application it doesn't seem to really disconnect the same >controller (even though the call returns SUCCESS) and it still appears to be >managed by >driver. I even checked the ControllerHandle passed and it looks >correct. Were you able to resolve this eventually? Yes i was able to resolve it. It might be helpful if you can tell me the output of dh -d command. Thanks Amit From: TVKR <tres...@gmail.com<mailto:tres...@gmail.com>> Sent: Wednesday, June 28, 2017 6:06:11 PM To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>; akami...@hotmail.com<mailto:akami...@hotmail.com> Subject: Re: [edk2] DisconnectController API not working. BTW, I ported the disconnect code (under ShellPkg\Library\UefiShellDriver1CommandsLib) to a standalone application and it fails too. Looks like there is something else in the shell app that is taking care of properly disconnecting the controller. Thanks On Tue, Jun 27, 2017 at 5:54 PM, TVKR <tres...@gmail.com<mailto:tres...@gmail.com>> wrote: Hi Amit, I am seeing the exact same issue on my system with DisconnectController. The shell command 'disconnect' works but when I use the gBS->DisconnectController call from my application it doesn't seem to really disconnect the same controller (even though the call returns SUCCESS) and it still appears to be ma
Re: [edk2] DisconnectController API not working.
Hi Tresko, I looks like there is no problem with your implementation, as was the case with me. I can suggest you a quick trick here, if it won’t work I will help you further which might take a while. Follow the steps below. 1. Go to refi shell 2. Reconnect -r 3. If the sysytem hangs. 4. Try to update your BIOS/UEFI to latest (as I had noticed the eariler BIOS/UEFI had some some problem which normally gets fixed with updates). 5. After update once again try Reconnect -r. 6. If theres a no hang restart the system and now you can try your app or just give disconnect in uefi shell. 7. If still I doesn’t work you can ping me I might suggest the other way around. Amit On Jun 28, 2017, at 8:05 PM, TVKR <tres...@gmail.com<mailto:tres...@gmail.com>> wrote: Hi Amit, Here is the output. It is the call 'gBS->DisconnectController (ControllerHandle, NULL, NULL)' (where ControllerHandle=7219EA98) that doesn't seem to correctly work. FS0:\> drivers Output Truncated.. 176 07042200 B Y Y 1 1 Intel(R) PRO/1000 7.3.18 PCI-E PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0)/Offset(0x1D200,0x3E9FF) 178 07042200 B Y Y 1 1 Intel(R) PRO/1000 7.3.18 PCI-E PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x1)/Offset(0x1D200,0x3E9FF) FS0:\> dh 176 -d -v 176: 7219E798 DriverVersion 0x00020028 EfiDriverHealthProtocolGuid DriverConfiguration DriverDiagnostics2 ComponentName2 DriverDiagnostics ComponentName DriverBinding ImageDevicePath LoadedImage Revision..: 0x1000 ParentHandle..: 72B70A18 SystemTable...: 788FEF18 DeviceHandle..: 7219EA98 FilePath..: 7219E998 OptionsSize...: 0 LoadOptions...: ImageBase.: 776A ImageSize.: 555E0 CodeType..: EfiBootServicesCode DataType..: EfiBootServicesData Unload: 776A0708 Child[176]: Intel(R) PRO/1000 7.3.18 PCI-E Driver Image Name : Offset(0x1D200,0x3E9FF) Driver Version : 07031800 Driver Type: Bus Configuration : YES Diagnostics: YES Child Controllers : Ctrl[175] : PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) Child[219]: Intel Ethernet Server Adapter I350-T2 FS0:\> dh 175 -d -v 175: 7219EA98 UnknownDevice UnknownDevice BusSpecificDriverOverride LoadFile2 PCIIO DevicePath PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) Controller Name: PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) Device Path: PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) Controller Type: BUS Configuration : NO Diagnostics: NO Managed by : Drv[176] : Intel(R) PRO/1000 7.3.18 PCI-E Parent Controllers : Parent[75] : PciRoot(0x0) Child Controllers : Child[219]: Intel Ethernet Server Adapter I350-T2 Thanks On Wed, Jun 28, 2017 at 9:07 AM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>> wrote: Hi Tresko, >Hi Amit, >I am seeing the exact same issue on my system with DisconnectController. The >shell command 'disconnect' works but when I use the gBS->DisconnectController >>call from my application it doesn't seem to really disconnect the same >controller (even though the call returns SUCCESS) and it still appears to be >managed by >driver. I even checked the ControllerHandle passed and it looks >correct. Were you able to resolve this eventually? Yes i was able to resolve it. It might be helpful if you can tell me the output of dh -d command. Thanks Amit From: TVKR <tres...@gmail.com<mailto:tres...@gmail.com>> Sent: Wednesday, June 28, 2017 6:06:11 PM To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>; akami...@hotmail.com<mailto:akami...@hotmail.com> Subject: Re: [edk2] DisconnectController API not working. BTW, I ported the disconnect code (under ShellPkg\Library\UefiShellDriver1CommandsLib) to a standalone application and it fails too. Looks like there is something else in the shell app that is taking care of properly disconnecting the controller. Thanks On Tue, Jun 27, 2017 at 5:54 PM, TVKR <tres...@gmail.com<mailto:tres...@gmail.com>> wrote: Hi Amit, I am seeing the exact same issue on my system with DisconnectController. The shell command 'disconnect' works but when I use the gBS->DisconnectController call from my application it doesn't seem to really disconnect the same controller (even though the call returns SUCCESS) and it still appears to be managed by driver. I even checked the ControllerHandle passed and it looks correct. Were you able to resolve this eventually? Thanks -Original Message- From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Amit kumar Sent: Tuesday, April 4, 2017 12:07 AM To: Tian, Feng https://lists.01.org/mailman/listinfo/edk2-devel>> Cc: edk2-devel at li
Re: [edk2] DisconnectController API not working.
Hi Tresko, >Hi Amit, >I am seeing the exact same issue on my system with DisconnectController. The >shell command 'disconnect' works but when I use the gBS->DisconnectController >>call from my application it doesn't seem to really disconnect the same >controller (even though the call returns SUCCESS) and it still appears to be >managed by >driver. I even checked the ControllerHandle passed and it looks >correct. Were you able to resolve this eventually? Yes i was able to resolve it. It might be helpful if you can tell me the output of dh -d command. Thanks Amit From: TVKR <tres...@gmail.com> Sent: Wednesday, June 28, 2017 6:06:11 PM To: edk2-devel@lists.01.org; akami...@hotmail.com Subject: Re: [edk2] DisconnectController API not working. BTW, I ported the disconnect code (under ShellPkg\Library\UefiShellDriver1CommandsLib) to a standalone application and it fails too. Looks like there is something else in the shell app that is taking care of properly disconnecting the controller. Thanks On Tue, Jun 27, 2017 at 5:54 PM, TVKR <tres...@gmail.com<mailto:tres...@gmail.com>> wrote: Hi Amit, I am seeing the exact same issue on my system with DisconnectController. The shell command 'disconnect' works but when I use the gBS->DisconnectController call from my application it doesn't seem to really disconnect the same controller (even though the call returns SUCCESS) and it still appears to be managed by driver. I even checked the ControllerHandle passed and it looks correct. Were you able to resolve this eventually? Thanks -Original Message- From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Amit kumar Sent: Tuesday, April 4, 2017 12:07 AM To: Tian, Feng https://lists.01.org/mailman/listinfo/edk2-devel>> Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel> Subject: Re: [edk2] DisconnectController API not working. No i am not trying to disconnect USB controller in use. From: Tian, Feng https://lists.01.org/mailman/listinfo/edk2-devel>> Sent: Wednesday, April 5, 2017 8:21:36 AM To: Andrew Fish; Amit kumar Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>; Tian, Feng Subject: RE: [edk2] DisconnectController API not working. Kumar, Do "map -r" at first please. PS: for the issue you encounter, are you trying to disconnect the usb controller in use? Please note at this time you are reading the file from usb key. It means the disconnect will never succeed. Thanks Feng -Original Message- From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Andrew Fish Sent: Tuesday, April 4, 2017 12:07 AM To: Amit kumar https://lists.01.org/mailman/listinfo/edk2-devel>> Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel> Subject: Re: [edk2] DisconnectController API not working. > On Apr 3, 2017, at 2:58 AM, Amit kumar hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>> wrote: > > Hi Andrew , > > I did some testing and found out, same code works fine on Server boards but > it fails on desktop boards. > Servers tend to connect less things as it can take a long time. > I Have double checked the ControllerHandle by printing its handle index using > ConvertHandleToHandleIndex(ControllerHandle), the ControllerHandle looks > correct. > > > I have one new query; > > i have made a startup.nsh file in which i am issuing load driver.efi , i am > getting file not found. > > i have also tried using load fs0:driver.efi, and again i get file not found. > I have been trying to run this script from internal shell as well as usb > shell. > Does that command work if you boot the shell? Thanks, Andrew Fish > > Regards > > Amit Kumar > > > From: afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel> > https://lists.01.org/mailman/listinfo/edk2-devel>> on > behalf of Andrew Fish > https://lists.01.org/mailman/listinfo/edk2-devel>> > Sent: Friday, March 31, 2017 10:42:08 PM > To: Amit kumar > Cc: edk2-devel at > lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel> > Subject: Re: [edk2] DisconnectController API not working. > > > On Mar 31, 2017, at 5:26 AM, Amit kumar hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel><mailto:akamit91 > at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>>> wrote: > > > Hi , > > I am trying to disconnect a controller from the usb mass storage > driver, for which i
Re: [edk2] [PATCH V5] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol
Spec + Pach Looks fine to me. - Original Message - Sender : Star Zeng <star.z...@intel.com> Date : 2017-06-28 18:52 (GMT+5:30) Title : [PATCH V5] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol To : edk2-devel@lists.01.org CC : Amit Kumar<amit...@samsung.com>, null<ler...@redhat.com>, null<michael.d.kin...@intel.com>, null<liming@intel.com>, null<gso...@gmail.com>, null<star.z...@intel.com> From: Amit Kumar <amit...@samsung.com> Change since v4: Revise the patch based on V4 sent by Amit Kumar 1) Only return the corresponding protocol interface in *Interface if the return status is EFI_SUCCESS or EFI_ALREADY_STARTED. 2) Interface is returned unmodified for all error conditions except EFI_UNSUPPORTED and EFI_ALREADY_STARTED, NULL will be returned in *Interface when EFI_UNSUPPORTED and Attributes is not EFI_OPEN_PROTOCOL_TEST_PROTOCOL, the protocol interface will be returned in *Interface when EFI_ALREADY_STARTED. Change since v3: 1) Fixed issue when Attributes = EFI_OPEN_PROTOCOL_TEST_PROTOCOL and Inteface = NULL case. [Reported by:star.zeng at intel.com] Change Since v2: 1) Modified to use EFI_ERROR to get status code Change since v1: 1) Fixed typo protocal to protocol 2) Fixed coding style Cc: Laszlo Ersek <ler...@redhat.com> Cc: Amit Kumar <amit...@samsung.com> Cc: Michael D Kinney <michael.d.kin...@intel.com> Cc: Liming Gao <liming@intel.com> Cc: Gabriel Somlo <gso...@gmail.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Amit Kumar <amit...@samsung.com> Signed-off-by: Star Zeng <star.z...@intel.com> --- MdeModulePkg/Core/Dxe/Hand/Handle.c | 36 +++- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/Hand/Handle.c index 59b89148c8f0..3862a3876f4a 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c @@ -1006,12 +1006,8 @@ CoreOpenProtocol ( // // Check for invalid Interface // - if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { -if (Interface == NULL) { - return EFI_INVALID_PARAMETER; -} else { - *Interface = NULL; -} + if ((Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) && (Interface == NULL)) { +return EFI_INVALID_PARAMETER; } // @@ -1078,12 +1074,6 @@ CoreOpenProtocol ( goto Done; } - // - // This is the protocol interface entry for this protocol - // - if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { -*Interface = Prot->Interface; - } Status = EFI_SUCCESS; ByDriver= FALSE; @@ -1177,8 +1167,28 @@ CoreOpenProtocol ( } Done: + + if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { +// +// Keep Interface unmodified in case of any Error +// except EFI_ALREADY_STARTED and EFI_UNSUPPORTED. +// +if (!EFI_ERROR (Status) || Status == EFI_ALREADY_STARTED) { + // + // EFI_ALREADY_STARTED is not an error for bus driver. + // Return the corresponding protocol interface. + // + *Interface = Prot->Interface; +} else if (Status == EFI_UNSUPPORTED) { + // + // Return NULL Interface if Unsupported Protocol. + // + *Interface = NULL; +} + } + // - // Done. Release the database lock are return + // Done. Release the database lock and return // CoreReleaseProtocolLock (); return Status; -- 2.7.0.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH V4] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol
Change since v3: 1) Fixed issue when Attributes = EFI_OPEN_PROTOCOL_TEST_PROTOCOL and Inteface = NULL case. [Reported by:star.zeng at intel.com] Change Since v2: 1) Modified to use EFI_ERROR to get status code Change since v1: 1) Fixed typo protocal to protocol 2) Fixed coding style Modified source code to update Interface as per spec. 1) In case of Protocol is un-supported, interface should be returned NULL. 2) In case of any error, interface should not be modified. 3) In case of Test Protocol, interface is optional. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Amit Kumar <amit...@samsung.com> --- MdeModulePkg/Core/Dxe/Hand/Handle.c | 26 ++ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/Hand/Handle.c index 59b8914..fe58b6c 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c @@ -1006,12 +1006,8 @@ CoreOpenProtocol ( // // Check for invalid Interface // - if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { -if (Interface == NULL) { - return EFI_INVALID_PARAMETER; -} else { - *Interface = NULL; -} + if ((Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) && (Interface == NULL)) { +return EFI_INVALID_PARAMETER; } // @@ -1075,15 +1071,13 @@ CoreOpenProtocol ( Prot = CoreGetProtocolInterface (UserHandle, Protocol); if (Prot == NULL) { Status = EFI_UNSUPPORTED; +if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL){ + //Return NULL Interface if Unsupported Protocol + *Interface = NULL; +} goto Done; } - // - // This is the protocol interface entry for this protocol - // - if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { -*Interface = Prot->Interface; - } Status = EFI_SUCCESS; ByDriver= FALSE; @@ -1177,6 +1171,14 @@ CoreOpenProtocol ( } Done: + + // + // This is the protocol interface entry for this protocol. + // In case of any Error, Interface should not be updated as per spec. + // + if (!EFI_ERROR (Status) && (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL)) { +*Interface = Prot->Interface; + } // // Done. Release the database lock are return // -- 1.9.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH V3] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol
Change Since v2: 1) Modified to use EFI_ERROR to get status code Change since v1: 1) Fixed typo protocal to protocol 2) Fixed coding style Modified source code to update Interface as per spec. 1) In case of Protocol is un-supported, interface should be returned NULL. 2) In case of any error, interface should not be modified. 3) In case of Test Protocol, interface is optional. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Amit Kumar <amit...@samsung.com> --- MdeModulePkg/Core/Dxe/Hand/Handle.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/Hand/Handle.c index 1c25521..6de300f 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c @@ -1004,12 +1004,8 @@ CoreOpenProtocol ( // // Check for invalid Interface // - if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { -if (Interface == NULL) { - return EFI_INVALID_PARAMETER; -} else { - *Interface = NULL; -} + if ((Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) && (Interface == NULL)) { +return EFI_INVALID_PARAMETER; } // @@ -1073,15 +1069,11 @@ CoreOpenProtocol ( Prot = CoreGetProtocolInterface (UserHandle, Protocol); if (Prot == NULL) { Status = EFI_UNSUPPORTED; +// Return NULL Interface if Unsupported Protocol +*Interface = NULL; goto Done; } - // - // This is the protocol interface entry for this protocol - // - if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { -*Interface = Prot->Interface; - } Status = EFI_SUCCESS; ByDriver= FALSE; @@ -1175,6 +1167,14 @@ CoreOpenProtocol ( } Done: + + // + // This is the protocol interface entry for this protocol. + // In case of any Error, Interface should not be updated as per spec. + // + if (!EFI_ERROR (Status) && Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { +*Interface = Prot->Interface; + } // // Done. Release the database lock are return // -- 1.9.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH V2] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol
Change since v1: 1) Fixed typo protocal to protocol 2) Fixed coding style Modified source code to update Interface as per spec. 1) In case of Protocol is un-supported, interface should be returned NULL. 2) In case of any error, interface should not be modified. 3) In case of Test Protocol, interface is optional. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Amit Kumar <amit...@samsung.com> --- MdeModulePkg/Core/Dxe/Hand/Handle.c | 25 + 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/Hand/Handle.c index 1c25521..db23170 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c @@ -1004,12 +1004,8 @@ CoreOpenProtocol ( // // Check for invalid Interface // - if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { -if (Interface == NULL) { - return EFI_INVALID_PARAMETER; -} else { - *Interface = NULL; -} + if ((Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) && (Interface == NULL)) { +return EFI_INVALID_PARAMETER; } // @@ -1073,15 +1069,11 @@ CoreOpenProtocol ( Prot = CoreGetProtocolInterface (UserHandle, Protocol); if (Prot == NULL) { Status = EFI_UNSUPPORTED; +// Return NULL Interface if Unsupported Protocol +*Interface = NULL; goto Done; } - // - // This is the protocol interface entry for this protocol - // - if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { -*Interface = Prot->Interface; - } Status = EFI_SUCCESS; ByDriver= FALSE; @@ -1175,6 +1167,15 @@ CoreOpenProtocol ( } Done: + + // + // This is the protocol interface entry for this protocol. + // In case of any Error, Interface should not be updated as per spec. + // + if ((Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) + && (Status == EFI_SUCCESS)) { +*Interface = Prot->Interface; + } // // Done. Release the database lock are return // -- 1.9.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol
Modified source code to update Interface as per spec. 1) In case of Protocol is un-supported, interface should be returned NULL. 2) In case of any error, interface should not be modified. 3) In case of Test Protocol, interface is optional. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Amit Kumar <amit...@samsung.com> --- MdeModulePkg/Core/Dxe/Hand/Handle.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/Hand/Handle.c index 1c25521..0afa86b 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c @@ -1004,13 +1004,8 @@ CoreOpenProtocol ( // // Check for invalid Interface // - if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { -if (Interface == NULL) { - return EFI_INVALID_PARAMETER; -} else { - *Interface = NULL; -} - } + if ((Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) && (Interface == NULL)) +return EFI_INVALID_PARAMETER; // // Check for invalid UserHandle @@ -1073,15 +1068,11 @@ CoreOpenProtocol ( Prot = CoreGetProtocolInterface (UserHandle, Protocol); if (Prot == NULL) { Status = EFI_UNSUPPORTED; +// Return NULL Interface if Unsupported Protocal +*Interface = NULL; goto Done; } - // - // This is the protocol interface entry for this protocol - // - if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { -*Interface = Prot->Interface; - } Status = EFI_SUCCESS; ByDriver= FALSE; @@ -1175,6 +1166,15 @@ CoreOpenProtocol ( } Done: + + // + // This is the protocol interface entry for this protocol. + // In case of any Error, Interface should not be updated as per spec. + // + if ((Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) + && (Status == EFI_SUCCESS)) { +*Interface = Prot->Interface; + } // // Done. Release the database lock are return // -- 1.9.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] ThundeBolt 3/ USB C UEFI drivers
Hi, I have some queries. 1. Does ThundeBolt 3 and USB C shave the same uefi drivers ? 2. Is there any driver in UEFI for them ? 3. Do they use USB Mass Storage Driver ? 4. Do they support booting like USB 3.1 /3.0 / 2 ? Thanks And Regards Amit ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] How to make my application automatically launch like uefi shell ?
Hi, I have created a uefi application and i want to directly launch from the Pen Drive, just like uefi shell. I made a EFI/BOOT directory in USB and copied my application in this director and name it BOOTX64.efi it seems to works in some PCs, But there are some PCs where it doesn't work even in boot menu i can see no entry. Can somebody help me ? Thanks And Regards Amit ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] Problem in EFI_BOOT_SERVICES.OpenProtocol()
Certainly i will do that. Meanwhile can i submit the patch too ? Amit From: af...@apple.com <af...@apple.com> on behalf of Andrew Fish <af...@apple.com> Sent: Thursday, June 1, 2017 11:08:59 PM To: Amit kumar Cc: edk2-devel@lists.01.org Subject: Re: [edk2] Problem in EFI_BOOT_SERVICES.OpenProtocol() On Jun 1, 2017, at 10:37 AM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>> wrote: Hello Andrew, Thanks for quick reply and acknowledging my query. Please file a bugzilla against the code. Thanks, Andrew Fish Amit From: af...@apple.com<mailto:af...@apple.com> <af...@apple.com<mailto:af...@apple.com>> on behalf of Andrew Fish <af...@apple.com<mailto:af...@apple.com>> Sent: Thursday, June 1, 2017 10:59:03 PM To: Amit kumar Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Subject: Re: [edk2] Problem in EFI_BOOT_SERVICES.OpenProtocol() > On Jun 1, 2017, at 10:13 AM, Amit kumar > <akami...@hotmail.com<mailto:akami...@hotmail.com>> wrote: > > Hello Andrew, > > As per UEFI Spec EFI_ALREADY_STARTED is treated as error code, thus PciIo > (The Interface 3rd parameter ) should remain NULL. > But afterOpenProtocol call even though Status = EFI_ALREADY_STARTED PciIo > (The Interface 3rd parameter ) is getting modified and it not NULL anymore. > Is this not a problem ? > Amit, I agree it looks like the code will fill in the Interface and return EFI_ALREADY_STARTED. And that does seem to conflict with the section of the spec you quote. Good catch. https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/Dxe/Hand/Handle.c#L1097 // // This is the protocol interface entry for this protocol // if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { *Interface = Prot->Interface; } Status = EFI_SUCCESS; ByDriver= FALSE; Exclusive = FALSE; for ( Link = Prot->OpenList.ForwardLink; Link != >OpenList; Link = Link->ForwardLink) { OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE); ExactMatch = (BOOLEAN)((OpenData->AgentHandle == ImageHandle) && (OpenData->Attributes == Attributes) && (OpenData->ControllerHandle == ControllerHandle)); if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) { ByDriver = TRUE; if (ExactMatch) { Status = EFI_ALREADY_STARTED; goto Done; } } if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_EXCLUSIVE) != 0) { Exclusive = TRUE; } else if (ExactMatch) { OpenData->OpenCount++; Status = EFI_SUCCESS; goto Done; } } Thanks, Andrew Fish > Status = gBS->OpenProtocol ( > Controller, > , > (VOID **) , > This->DriverBindingHandle, > Controller, > EFI_OPEN_PROTOCOL_BY_DRIVER > ); > > > From: af...@apple.com<mailto:af...@apple.com> > <af...@apple.com<mailto:af...@apple.com>> on behalf of Andrew Fish > <af...@apple.com<mailto:af...@apple.com>> > Sent: Thursday, June 1, 2017 10:28:16 PM > To: Amit kumar > Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> > Subject: Re: [edk2] Problem in EFI_BOOT_SERVICES.OpenProtocol() > > >> On Jun 1, 2017, at 9:46 AM, Amit kumar >> <akami...@hotmail.com<mailto:akami...@hotmail.com>> wrote: >> >> Hi, >> I am trying to open PciIoProtocol and facing some issue. >> >> below is the code >> >> EFI_PCI_IO_PROTOCOL *PciIo=NULL; >> EFI_STATUS Status; >> >> Status = gBS->OpenProtocol ( >> Controller, >> , >> (VOID **) , >> This->DriverBindingHandle, >> Controller, >> EFI_OPEN_PROTOCOL_BY_DRIVER >> ); >> >> it returns Status = EFI_ALREADY_STARTED, but PciIo is not NULL. >> Is it not supposed to return PciIo as NULL ? >> As per UEFI 2.6 Spec Section 6.3 page 182. >> > > Amit, > > Look at the Status Codes Returned section at the end of that section. > > Attributes is BY_DRIVER and there is an item on the open list with an > attribute of BY_DRIVER whose agent handle is the same as AgentHandle. > > Attributes is BY_DRIVER|EXCLUSIVE and there is an item on the open list with > an attribute of BY_DRIVER|EXCLUSIVE whose agent handle is the same as > AgentHandle. > > Thanks, > > Andrew Fish > >> There a
Re: [edk2] Problem in EFI_BOOT_SERVICES.OpenProtocol()
Hello Andrew, Thanks for quick reply and acknowledging my query. Amit From: af...@apple.com <af...@apple.com> on behalf of Andrew Fish <af...@apple.com> Sent: Thursday, June 1, 2017 10:59:03 PM To: Amit kumar Cc: edk2-devel@lists.01.org Subject: Re: [edk2] Problem in EFI_BOOT_SERVICES.OpenProtocol() > On Jun 1, 2017, at 10:13 AM, Amit kumar <akami...@hotmail.com> wrote: > > Hello Andrew, > > As per UEFI Spec EFI_ALREADY_STARTED is treated as error code, thus PciIo > (The Interface 3rd parameter ) should remain NULL. > But afterOpenProtocol call even though Status = EFI_ALREADY_STARTED PciIo > (The Interface 3rd parameter ) is getting modified and it not NULL anymore. > Is this not a problem ? > Amit, I agree it looks like the code will fill in the Interface and return EFI_ALREADY_STARTED. And that does seem to conflict with the section of the spec you quote. Good catch. https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/Dxe/Hand/Handle.c#L1097 // // This is the protocol interface entry for this protocol // if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { *Interface = Prot->Interface; } Status = EFI_SUCCESS; ByDriver= FALSE; Exclusive = FALSE; for ( Link = Prot->OpenList.ForwardLink; Link != >OpenList; Link = Link->ForwardLink) { OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE); ExactMatch = (BOOLEAN)((OpenData->AgentHandle == ImageHandle) && (OpenData->Attributes == Attributes) && (OpenData->ControllerHandle == ControllerHandle)); if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) { ByDriver = TRUE; if (ExactMatch) { Status = EFI_ALREADY_STARTED; goto Done; } } if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_EXCLUSIVE) != 0) { Exclusive = TRUE; } else if (ExactMatch) { OpenData->OpenCount++; Status = EFI_SUCCESS; goto Done; } } Thanks, Andrew Fish > Status = gBS->OpenProtocol ( > Controller, > , > (VOID **) , > This->DriverBindingHandle, > Controller, > EFI_OPEN_PROTOCOL_BY_DRIVER > ); > > > From: af...@apple.com <af...@apple.com> on behalf of Andrew Fish > <af...@apple.com> > Sent: Thursday, June 1, 2017 10:28:16 PM > To: Amit kumar > Cc: edk2-devel@lists.01.org > Subject: Re: [edk2] Problem in EFI_BOOT_SERVICES.OpenProtocol() > > >> On Jun 1, 2017, at 9:46 AM, Amit kumar <akami...@hotmail.com> wrote: >> >> Hi, >> I am trying to open PciIoProtocol and facing some issue. >> >> below is the code >> >> EFI_PCI_IO_PROTOCOL *PciIo=NULL; >> EFI_STATUS Status; >> >> Status = gBS->OpenProtocol ( >> Controller, >> , >> (VOID **) , >> This->DriverBindingHandle, >> Controller, >> EFI_OPEN_PROTOCOL_BY_DRIVER >> ); >> >> it returns Status = EFI_ALREADY_STARTED, but PciIo is not NULL. >> Is it not supposed to return PciIo as NULL ? >> As per UEFI 2.6 Spec Section 6.3 page 182. >> > > Amit, > > Look at the Status Codes Returned section at the end of that section. > > Attributes is BY_DRIVER and there is an item on the open list with an > attribute of BY_DRIVER whose agent handle is the same as AgentHandle. > > Attributes is BY_DRIVER|EXCLUSIVE and there is an item on the open list with > an attribute of BY_DRIVER|EXCLUSIVE whose agent handle is the same as > AgentHandle. > > Thanks, > > Andrew Fish > >> There are a number of reasons that this function call can return an error. >> If an error is returned, then >> AgentHandle, ControllerHandle, and Attributes are not added to the list of >> agents >> consuming the protocol interface specified by Handle and Protocol, and >> Interface is >> returned unmodified. >> >> Thanks And Regards >> Amit >> ___ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel > > ___ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] Problem in EFI_BOOT_SERVICES.OpenProtocol()
Hello Andrew, As per UEFI Spec EFI_ALREADY_STARTED is treated as error code, thus PciIo (The Interface 3rd parameter ) should remain NULL. But afterOpenProtocol call even though Status = EFI_ALREADY_STARTED PciIo (The Interface 3rd parameter ) is getting modified and it not NULL anymore. Is this not a problem ? Status = gBS->OpenProtocol ( Controller, , (VOID **) , This->DriverBindingHandle, Controller, EFI_OPEN_PROTOCOL_BY_DRIVER ); From: af...@apple.com <af...@apple.com> on behalf of Andrew Fish <af...@apple.com> Sent: Thursday, June 1, 2017 10:28:16 PM To: Amit kumar Cc: edk2-devel@lists.01.org Subject: Re: [edk2] Problem in EFI_BOOT_SERVICES.OpenProtocol() > On Jun 1, 2017, at 9:46 AM, Amit kumar <akami...@hotmail.com> wrote: > > Hi, > I am trying to open PciIoProtocol and facing some issue. > > below is the code > > EFI_PCI_IO_PROTOCOL *PciIo=NULL; > EFI_STATUS Status; > > Status = gBS->OpenProtocol ( > Controller, > , > (VOID **) , > This->DriverBindingHandle, > Controller, > EFI_OPEN_PROTOCOL_BY_DRIVER > ); > > it returns Status = EFI_ALREADY_STARTED, but PciIo is not NULL. > Is it not supposed to return PciIo as NULL ? > As per UEFI 2.6 Spec Section 6.3 page 182. > Amit, Look at the Status Codes Returned section at the end of that section. Attributes is BY_DRIVER and there is an item on the open list with an attribute of BY_DRIVER whose agent handle is the same as AgentHandle. Attributes is BY_DRIVER|EXCLUSIVE and there is an item on the open list with an attribute of BY_DRIVER|EXCLUSIVE whose agent handle is the same as AgentHandle. Thanks, Andrew Fish > There are a number of reasons that this function call can return an error. If > an error is returned, then > AgentHandle, ControllerHandle, and Attributes are not added to the list of > agents > consuming the protocol interface specified by Handle and Protocol, and > Interface is > returned unmodified. > > Thanks And Regards > Amit > ___ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] Problem in EFI_BOOT_SERVICES.OpenProtocol()
Hi, I am trying to open PciIoProtocol and facing some issue. below is the code EFI_PCI_IO_PROTOCOL *PciIo=NULL; EFI_STATUS Status; Status = gBS->OpenProtocol ( Controller, , (VOID **) , This->DriverBindingHandle, Controller, EFI_OPEN_PROTOCOL_BY_DRIVER ); it returns Status = EFI_ALREADY_STARTED, but PciIo is not NULL. Is it not supposed to return PciIo as NULL ? As per UEFI 2.6 Spec Section 6.3 page 182. There are a number of reasons that this function call can return an error. If an error is returned, then AgentHandle, ControllerHandle, and Attributes are not added to the list of agents consuming the protocol interface specified by Handle and Protocol, and Interface is returned unmodified. Thanks And Regards Amit ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] Accessing AVX/AVX2 instruction in UEFI.
Mike, Andrew Thanks for your suggestions, it looks like MMIO is the bottleneck in my application. I have one more query. Does each core have independent YMM registers or is it shared among the cores ? Thanks And Regards Amit Kumar From: Kinney, Michael D <michael.d.kin...@intel.com> Sent: Thursday, May 4, 2017 10:56:44 PM To: Andrew Fish; Amit kumar; Kinney, Michael D Cc: edk2-devel@lists.01.org Subject: RE: [edk2] Accessing AVX/AVX2 instruction in UEFI. Amit, I agree with Andrew that establishing a good measurement method is very important and that raising TPL to HIGH_LEVEL(disabling interrupts) during measurement may improve the consistency of the measurement results. You also likely want to test both large buffer operations as well as a loop on small buffer operations to see if there are differences based on the size of the requested operation. In order to verify that your measurement method is working, you may want to test some of the existing BaseMemoryLib implementations before testing your new one. * BaseMemoryLibC code implementation * BaseMemoryLibMmx Uses MMX registers/instructions * BaseMemoryLibSse2Uses SSE2 registers/instructions * BaseMemoryLibRepStr Uses REP STR instructions * BaseMemoryLibOptDxe Blend of above libs with good perf in DXE/UEFI phase * BaseMemoryLibOptPei Blend of above libs with good perf in PEI phase I recommend you try measuring the first 4 to see if your measurements show differences. Base on my own evaluation in the past, I have found that DXE/UEFI code works well with BaseMemoryLibRepStr. It tends to go as fast as the largest register width access the CPU supports. One additional element that may be impacting your results is the type of memory that is being testing and that memory ranges cache settings. If you are accessing MMIO, FLASH, or some other type of device memory, you may be seeing bandwidth limitations from that device. Best regards, Mike > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Andrew > Fish > Sent: Thursday, May 4, 2017 8:21 AM > To: Amit kumar <akami...@hotmail.com> > Cc: Kinney, Michael D <michael.d.kin...@intel.com>; edk2-devel@lists.01.org > Subject: Re: [edk2] Accessing AVX/AVX2 instruction in UEFI. > > Amit, > > In regards to AVX/AVX2 performance how are you doing the measuring? > > In EFI it is hard to measure wall clock time for things that take a long time. > Basically there is no scheduler in EFI and no threads, but there are events. > The > events can preempt your App while it is running and the time spent in events > would > look to you like time spent in your App. > > Generally the time spent in events should be constant (hot plugging USB or > other > changes like that may have a noticeable impact). If the goal of the > performance > measurement is to make the system boot faster you care more about the delta, > than the > absolute time (so the event overhead does not matter). > > If you are just doing a computation that does not do any IO then you may be > able to > raise the TPL to prevent events from being part of your measurement. > > Thanks, > > Andrew Fish > > PS I assume your are measuring the RELEASE code since you are turning off > optimization > on the DEBUG code. > > > On May 4, 2017, at 5:22 AM, Amit kumar <akami...@hotmail.com> wrote: > > > > Here are the compiler flags > > [BuildOptions] > > MSFT:DEBUG_*_*_CC_FLAGS = /Od /FAsc /GL- > > MSFT:RELEASE_*_*_CC_FLAGS = /FAsc /D MDEPKG_NDEBUG > > MSFT:RELEASE_*_*_DLINK_FLAGS = /BASE:0x1 /ALIGN:4096 /FILEALIGN:4096 > > > > > > > > From: Amit kumar <akami...@hotmail.com> > > Sent: Thursday, May 4, 2017 5:48:11 PM > > To: Andrew Fish > > Cc: Mike Kinney; edk2-devel@lists.01.org > > Subject: Re: [edk2] Accessing AVX/AVX2 instruction in UEFI. > > > > > > Yes am aligning the data at 32 byte boundary while allocating memory in both > environments. > > > > in windows using _alligned_malloc(size,32); > > > > in UEFI > > > > Offset = (UINTN)src & 0xFF; > > > > src = (CHAR8 *)((UINTN) src - Offset + 0x20); > > > > > > Thanks > > > > Amit > > > > > > From: af...@apple.com <af...@apple.com> on behalf of Andrew Fish > > <af...@apple.com> > > Sent: Thursday, May 4, 2017 5:02:55 PM > > To: Amit kumar > > Cc: Mike Kinney; edk2-devel@lists.01.org > > Subject: Re: [edk2] Accessing AVX/AVX2 instruction in UEFI. > > > > > >> On May 4, 2017, at 4:13 AM, Amit kumar <aka
Re: [edk2] Accessing AVX/AVX2 instruction in UEFI.
Here are the compiler flags [BuildOptions] MSFT:DEBUG_*_*_CC_FLAGS = /Od /FAsc /GL- MSFT:RELEASE_*_*_CC_FLAGS = /FAsc /D MDEPKG_NDEBUG MSFT:RELEASE_*_*_DLINK_FLAGS = /BASE:0x1 /ALIGN:4096 /FILEALIGN:4096 From: Amit kumar <akami...@hotmail.com> Sent: Thursday, May 4, 2017 5:48:11 PM To: Andrew Fish Cc: Mike Kinney; edk2-devel@lists.01.org Subject: Re: [edk2] Accessing AVX/AVX2 instruction in UEFI. Yes am aligning the data at 32 byte boundary while allocating memory in both environments. in windows using _alligned_malloc(size,32); in UEFI Offset = (UINTN)src & 0xFF; src = (CHAR8 *)((UINTN) src - Offset + 0x20); Thanks Amit From: af...@apple.com <af...@apple.com> on behalf of Andrew Fish <af...@apple.com> Sent: Thursday, May 4, 2017 5:02:55 PM To: Amit kumar Cc: Mike Kinney; edk2-devel@lists.01.org Subject: Re: [edk2] Accessing AVX/AVX2 instruction in UEFI. > On May 4, 2017, at 4:13 AM, Amit kumar <akami...@hotmail.com> wrote: > > Hi, > > > Even after using AVX2 instruction my code shown no performance improvement in > UEFI although there is substantial improvement when i run the similar code in > windows . > > Am i missing something ? > Is the data aligned the same in both environments? Thanks, Andrew Fish > Using MSVC compiler and the codes written in ASM. > > Thanks And Regards > > Amit > > ____ > From: edk2-devel <edk2-devel-boun...@lists.01.org> on behalf of Amit kumar > <akami...@hotmail.com> > Sent: Wednesday, May 3, 2017 11:18:39 AM > To: Kinney, Michael D; Andrew Fish > Cc: edk2-devel@lists.01.org > Subject: Re: [edk2] Accessing AVX/AVX2 instruction in UEFI. > > Thank you Michael and Andrew > > > Regards > > Amit > > ____ > From: Kinney, Michael D <michael.d.kin...@intel.com> > Sent: Tuesday, May 2, 2017 10:33:45 PM > To: Andrew Fish; Amit kumar; Kinney, Michael D > Cc: edk2-devel@lists.01.org > Subject: RE: [edk2] Accessing AVX/AVX2 instruction in UEFI. > > Amit, > > The information from Andrew is correct. > > The document that covers this topic is the > Intel(r) 64 and IA-32 Architectures Software Developer Manuals > > https://software.intel.com/en-us/articles/intel-sdm > > Volume 1, Section 13.5.3 describes the AVX State. There are > More details about detecting and enabling different AVX features > in that document. > > If the CPU supports AVX, then the basic assembly instructions > required to use AVX instructions are the following that sets > bits 0, 1, 2 of XCR0. > >mov rcx, 0 >xgetbv >or rax, 0007h >xsetbv > > One additional item you need to be aware of is that UEFI firmware only > saves/Restores CPU registers required for the UEFI ABI calling convention > when a timer interrupt or exception is processed. > > This means CPU state such as the YMM registers are not saved/restored > across an interrupt and may be modified if code in interrupt context > also uses YMM registers. > > When you enable the use of extended registers, interrupts should be > saved/disabled and restored around the extended register usage. > > You can use the following functions from MdePkg BaseLib to do this > > /** > Disables CPU interrupts and returns the interrupt state prior to the disable > operation. > > @retval TRUE CPU interrupts were enabled on entry to this call. > @retval FALSE CPU interrupts were disabled on entry to this call. > > **/ > BOOLEAN > EFIAPI > SaveAndDisableInterrupts ( > VOID > ); > > /** > Set the current CPU interrupt state. > > Sets the current CPU interrupt state to the state specified by > InterruptState. If InterruptState is TRUE, then interrupts are enabled. If > InterruptState is FALSE, then interrupts are disabled. InterruptState is > returned. > > @param InterruptState TRUE if interrupts should enabled. FALSE if > interrupts should be disabled. > > @return InterruptState > > **/ > BOOLEAN > EFIAPI > SetInterruptState ( > IN BOOLEAN InterruptState > ); > > Algorithm: > > { > BOOLEAN InterruptState; > > InterruptState = SaveAndDisableInterrupts(); > > // Enable use of AVX/AVX2 instructions > > // Use AVX/AVX2 instructions > > SetInterruptState (InterruptState); > } > > Best regards, > > Mike > >> -Original Message- >> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of >> Andrew Fish >> Sent: Tuesday, May 2, 2017 8:12 AM >> To: Amit kumar <akami..
Re: [edk2] Accessing AVX/AVX2 instruction in UEFI.
Yes am aligning the data at 32 byte boundary while allocating memory in both environments. in windows using _alligned_malloc(size,32); in UEFI Offset = (UINTN)src & 0xFF; src = (CHAR8 *)((UINTN) src - Offset + 0x20); Thanks Amit From: af...@apple.com <af...@apple.com> on behalf of Andrew Fish <af...@apple.com> Sent: Thursday, May 4, 2017 5:02:55 PM To: Amit kumar Cc: Mike Kinney; edk2-devel@lists.01.org Subject: Re: [edk2] Accessing AVX/AVX2 instruction in UEFI. > On May 4, 2017, at 4:13 AM, Amit kumar <akami...@hotmail.com> wrote: > > Hi, > > > Even after using AVX2 instruction my code shown no performance improvement in > UEFI although there is substantial improvement when i run the similar code in > windows . > > Am i missing something ? > Is the data aligned the same in both environments? Thanks, Andrew Fish > Using MSVC compiler and the codes written in ASM. > > Thanks And Regards > > Amit > > ____ > From: edk2-devel <edk2-devel-boun...@lists.01.org> on behalf of Amit kumar > <akami...@hotmail.com> > Sent: Wednesday, May 3, 2017 11:18:39 AM > To: Kinney, Michael D; Andrew Fish > Cc: edk2-devel@lists.01.org > Subject: Re: [edk2] Accessing AVX/AVX2 instruction in UEFI. > > Thank you Michael and Andrew > > > Regards > > Amit > > ________ > From: Kinney, Michael D <michael.d.kin...@intel.com> > Sent: Tuesday, May 2, 2017 10:33:45 PM > To: Andrew Fish; Amit kumar; Kinney, Michael D > Cc: edk2-devel@lists.01.org > Subject: RE: [edk2] Accessing AVX/AVX2 instruction in UEFI. > > Amit, > > The information from Andrew is correct. > > The document that covers this topic is the > Intel(r) 64 and IA-32 Architectures Software Developer Manuals > > https://software.intel.com/en-us/articles/intel-sdm > > Volume 1, Section 13.5.3 describes the AVX State. There are > More details about detecting and enabling different AVX features > in that document. > > If the CPU supports AVX, then the basic assembly instructions > required to use AVX instructions are the following that sets > bits 0, 1, 2 of XCR0. > >mov rcx, 0 >xgetbv >or rax, 0007h >xsetbv > > One additional item you need to be aware of is that UEFI firmware only > saves/Restores CPU registers required for the UEFI ABI calling convention > when a timer interrupt or exception is processed. > > This means CPU state such as the YMM registers are not saved/restored > across an interrupt and may be modified if code in interrupt context > also uses YMM registers. > > When you enable the use of extended registers, interrupts should be > saved/disabled and restored around the extended register usage. > > You can use the following functions from MdePkg BaseLib to do this > > /** > Disables CPU interrupts and returns the interrupt state prior to the disable > operation. > > @retval TRUE CPU interrupts were enabled on entry to this call. > @retval FALSE CPU interrupts were disabled on entry to this call. > > **/ > BOOLEAN > EFIAPI > SaveAndDisableInterrupts ( > VOID > ); > > /** > Set the current CPU interrupt state. > > Sets the current CPU interrupt state to the state specified by > InterruptState. If InterruptState is TRUE, then interrupts are enabled. If > InterruptState is FALSE, then interrupts are disabled. InterruptState is > returned. > > @param InterruptState TRUE if interrupts should enabled. FALSE if > interrupts should be disabled. > > @return InterruptState > > **/ > BOOLEAN > EFIAPI > SetInterruptState ( > IN BOOLEAN InterruptState > ); > > Algorithm: > > { > BOOLEAN InterruptState; > > InterruptState = SaveAndDisableInterrupts(); > > // Enable use of AVX/AVX2 instructions > > // Use AVX/AVX2 instructions > > SetInterruptState (InterruptState); > } > > Best regards, > > Mike > >> -Original Message- >> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of >> Andrew Fish >> Sent: Tuesday, May 2, 2017 8:12 AM >> To: Amit kumar <akami...@hotmail.com> >> Cc: edk2-devel@lists.01.org >> Subject: Re: [edk2] Accessing AVX/AVX2 instruction in UEFI. >> >> >>> On May 2, 2017, at 6:57 AM, Amit kumar <akami...@hotmail.com> wrote: >>> >>> Hi, >>> >>> Am trying to optimize an application using AVX/AVX2, but my code hangs >>> while trying >> to access YMM registers. >>> The instruction where my
Re: [edk2] Accessing AVX/AVX2 instruction in UEFI.
Hi, Even after using AVX2 instruction my code shown no performance improvement in UEFI although there is substantial improvement when i run the similar code in windows . Am i missing something ? Using MSVC compiler and the codes written in ASM. Thanks And Regards Amit From: edk2-devel <edk2-devel-boun...@lists.01.org> on behalf of Amit kumar <akami...@hotmail.com> Sent: Wednesday, May 3, 2017 11:18:39 AM To: Kinney, Michael D; Andrew Fish Cc: edk2-devel@lists.01.org Subject: Re: [edk2] Accessing AVX/AVX2 instruction in UEFI. Thank you Michael and Andrew Regards Amit From: Kinney, Michael D <michael.d.kin...@intel.com> Sent: Tuesday, May 2, 2017 10:33:45 PM To: Andrew Fish; Amit kumar; Kinney, Michael D Cc: edk2-devel@lists.01.org Subject: RE: [edk2] Accessing AVX/AVX2 instruction in UEFI. Amit, The information from Andrew is correct. The document that covers this topic is the Intel(r) 64 and IA-32 Architectures Software Developer Manuals https://software.intel.com/en-us/articles/intel-sdm Volume 1, Section 13.5.3 describes the AVX State. There are More details about detecting and enabling different AVX features in that document. If the CPU supports AVX, then the basic assembly instructions required to use AVX instructions are the following that sets bits 0, 1, 2 of XCR0. mov rcx, 0 xgetbv or rax, 0007h xsetbv One additional item you need to be aware of is that UEFI firmware only saves/Restores CPU registers required for the UEFI ABI calling convention when a timer interrupt or exception is processed. This means CPU state such as the YMM registers are not saved/restored across an interrupt and may be modified if code in interrupt context also uses YMM registers. When you enable the use of extended registers, interrupts should be saved/disabled and restored around the extended register usage. You can use the following functions from MdePkg BaseLib to do this /** Disables CPU interrupts and returns the interrupt state prior to the disable operation. @retval TRUE CPU interrupts were enabled on entry to this call. @retval FALSE CPU interrupts were disabled on entry to this call. **/ BOOLEAN EFIAPI SaveAndDisableInterrupts ( VOID ); /** Set the current CPU interrupt state. Sets the current CPU interrupt state to the state specified by InterruptState. If InterruptState is TRUE, then interrupts are enabled. If InterruptState is FALSE, then interrupts are disabled. InterruptState is returned. @param InterruptState TRUE if interrupts should enabled. FALSE if interrupts should be disabled. @return InterruptState **/ BOOLEAN EFIAPI SetInterruptState ( IN BOOLEAN InterruptState ); Algorithm: { BOOLEAN InterruptState; InterruptState = SaveAndDisableInterrupts(); // Enable use of AVX/AVX2 instructions // Use AVX/AVX2 instructions SetInterruptState (InterruptState); } Best regards, Mike > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Andrew > Fish > Sent: Tuesday, May 2, 2017 8:12 AM > To: Amit kumar <akami...@hotmail.com> > Cc: edk2-devel@lists.01.org > Subject: Re: [edk2] Accessing AVX/AVX2 instruction in UEFI. > > > > On May 2, 2017, at 6:57 AM, Amit kumar <akami...@hotmail.com> wrote: > > > > Hi, > > > > Am trying to optimize an application using AVX/AVX2, but my code hangs > > while trying > to access YMM registers. > > The instruction where my code hangs is : > > > > > > vmovups ymm0, YMMWORD PTR [rax] > > > > > > I have verified the cpuid in OS and it supports AVX and AVX2 instruction. > > Processor > i7 6th gen. > > Can somebody help me out here ? Is there a way to enable YMM registers ? > > > > Amit, > > I think these instructions will generate an illegal instruction fault until > you enable > AVX. You need to check the Cpu ID bits in your code, then write BIT18 of CR4. > After > that XGETBV/XSETBV instructions are enabled and you can or in the lower 2 > bits of > XCR0. This basic operation is in the Intel Docs, it is just hard to find. > Usually the > OS has done this for the programmer and all the code needs to do is check the > CPU ID. > > Thanks, > > Andrew Fish > > > > > Thanks And Regards > > Amit Kumar > > > > ___ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel > > ___ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] Accessing AVX/AVX2 instruction in UEFI.
Thank you Michael and Andrew Regards Amit From: Kinney, Michael D <michael.d.kin...@intel.com> Sent: Tuesday, May 2, 2017 10:33:45 PM To: Andrew Fish; Amit kumar; Kinney, Michael D Cc: edk2-devel@lists.01.org Subject: RE: [edk2] Accessing AVX/AVX2 instruction in UEFI. Amit, The information from Andrew is correct. The document that covers this topic is the Intel(r) 64 and IA-32 Architectures Software Developer Manuals https://software.intel.com/en-us/articles/intel-sdm Volume 1, Section 13.5.3 describes the AVX State. There are More details about detecting and enabling different AVX features in that document. If the CPU supports AVX, then the basic assembly instructions required to use AVX instructions are the following that sets bits 0, 1, 2 of XCR0. mov rcx, 0 xgetbv or rax, 0007h xsetbv One additional item you need to be aware of is that UEFI firmware only saves/Restores CPU registers required for the UEFI ABI calling convention when a timer interrupt or exception is processed. This means CPU state such as the YMM registers are not saved/restored across an interrupt and may be modified if code in interrupt context also uses YMM registers. When you enable the use of extended registers, interrupts should be saved/disabled and restored around the extended register usage. You can use the following functions from MdePkg BaseLib to do this /** Disables CPU interrupts and returns the interrupt state prior to the disable operation. @retval TRUE CPU interrupts were enabled on entry to this call. @retval FALSE CPU interrupts were disabled on entry to this call. **/ BOOLEAN EFIAPI SaveAndDisableInterrupts ( VOID ); /** Set the current CPU interrupt state. Sets the current CPU interrupt state to the state specified by InterruptState. If InterruptState is TRUE, then interrupts are enabled. If InterruptState is FALSE, then interrupts are disabled. InterruptState is returned. @param InterruptState TRUE if interrupts should enabled. FALSE if interrupts should be disabled. @return InterruptState **/ BOOLEAN EFIAPI SetInterruptState ( IN BOOLEAN InterruptState ); Algorithm: { BOOLEAN InterruptState; InterruptState = SaveAndDisableInterrupts(); // Enable use of AVX/AVX2 instructions // Use AVX/AVX2 instructions SetInterruptState (InterruptState); } Best regards, Mike > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Andrew > Fish > Sent: Tuesday, May 2, 2017 8:12 AM > To: Amit kumar <akami...@hotmail.com> > Cc: edk2-devel@lists.01.org > Subject: Re: [edk2] Accessing AVX/AVX2 instruction in UEFI. > > > > On May 2, 2017, at 6:57 AM, Amit kumar <akami...@hotmail.com> wrote: > > > > Hi, > > > > Am trying to optimize an application using AVX/AVX2, but my code hangs > > while trying > to access YMM registers. > > The instruction where my code hangs is : > > > > > > vmovups ymm0, YMMWORD PTR [rax] > > > > > > I have verified the cpuid in OS and it supports AVX and AVX2 instruction. > > Processor > i7 6th gen. > > Can somebody help me out here ? Is there a way to enable YMM registers ? > > > > Amit, > > I think these instructions will generate an illegal instruction fault until > you enable > AVX. You need to check the Cpu ID bits in your code, then write BIT18 of CR4. > After > that XGETBV/XSETBV instructions are enabled and you can or in the lower 2 > bits of > XCR0. This basic operation is in the Intel Docs, it is just hard to find. > Usually the > OS has done this for the programmer and all the code needs to do is check the > CPU ID. > > Thanks, > > Andrew Fish > > > > > Thanks And Regards > > Amit Kumar > > > > ___ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel > > ___ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] Accessing AVX/AVX2 instruction in UEFI.
Hi, Am trying to optimize an application using AVX/AVX2, but my code hangs while trying to access YMM registers. The instruction where my code hangs is : vmovups ymm0, YMMWORD PTR [rax] I have verified the cpuid in OS and it supports AVX and AVX2 instruction. Processor i7 6th gen. Can somebody help me out here ? Is there a way to enable YMM registers ? Thanks And Regards Amit Kumar ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [APPLE MACBOOK BUG] Reconnect -r command hangs in MacBook Air (13-inch, Mid 2011) MacBookAir4, 2 MBA41.0077.B12 (2015-001) 1.73f66 (SMC 1.8)
Hi Alexei, I am not getting any messages like Data Abort Exception PC at 0xAFAFAFB2 CPSR 0xA033 NzCveaifT_svc Are these messages coming in debug mode?. when i run reconnect -r all i see is a hang and the platform stops to respond. Is there any follow up on this issue (Is it resolved ?). Thanks And Regards Amit Ku From: Alexei Fedorov <alexei.fedo...@arm.com> Sent: Thursday, April 27, 2017 6:05:42 PM To: Amit kumar; edk2-devel@lists.01.org Subject: Re: [edk2] [APPLE MACBOOK BUG] Reconnect -r command hangs in MacBook Air (13-inch, Mid 2011) MacBookAir4, 2 MBA41.0077.B12 (2015-001) 1.73f66 (SMC 1.8) Can it be related to https://bugzilla.tianocore.org/show_bug.cgi?id=211 ? Alexei. From: edk2-devel <edk2-devel-boun...@lists.01.org> on behalf of Amit kumar <akami...@hotmail.com> Sent: 27 April 2017 12:45:09 To: edk2-devel@lists.01.org Subject: [edk2] [APPLE MACBOOK BUG] Reconnect -r command hangs in MacBook Air (13-inch, Mid 2011) MacBookAir4, 2 MBA41.0077.B12 (2015-001) 1.73f66 (SMC 1.8) Hi, I have been doing some experiments with MacBook Air in EFI SHELL and found out that Reconnect -r command hangs(ALWAYS REPRODUCIBLE), and sometime devices -b command(Not reproducible all the time) hangs too. Please help me get around this issue . System Details :: MacBook Air (13-inch, Mid 2011) MacBookAir4,2 MBA41.0077.B12 (2015-001) 1.73f66 (SMC 1.8) Os: Sierra EFI ver command output: EFI Specification Revision : 1.10 EFI Vendor : Apple EFI Revision : 1.10 EFI Shell Version :: 2.31 Thanks And Regards Amit Kumar ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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. ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [APPLE MACBOOK BUG] Reconnect -r command hangs in MacBook Air (13-inch, Mid 2011) MacBookAir4, 2 MBA41.0077.B12 (2015-001) 1.73f66 (SMC 1.8)
Hi, I have been doing some experiments with MacBook Air in EFI SHELL and found out that Reconnect -r command hangs(ALWAYS REPRODUCIBLE), and sometime devices -b command(Not reproducible all the time) hangs too. Please help me get around this issue . System Details :: MacBook Air (13-inch, Mid 2011) MacBookAir4,2 MBA41.0077.B12 (2015-001) 1.73f66 (SMC 1.8) Os: Sierra EFI ver command output: EFI Specification Revision : 1.10 EFI Vendor : Apple EFI Revision : 1.10 EFI Shell Version :: 2.31 Thanks And Regards Amit Kumar ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [MAC HELP] Does Mac has a grubx64.efi ? /
Thank you very much. Thanks And Regards Amit Kumar From: af...@apple.com <af...@apple.com> on behalf of Andrew Fish <af...@apple.com> Sent: Monday, April 24, 2017 9:14:19 PM To: Amit kumar Cc: edk2-devel@lists.01.org Subject: Re: [edk2] [MAC HELP] Does Mac has a grubx64.efi ? / > On Apr 24, 2017, at 5:27 AM, Amit kumar <akami...@hotmail.com> wrote: > > Hi , > > I am trying to boot a mac OS X from the efi shell so i opened the EFI > partition. > As usual there was EFI directory inside which there was APPLE director. > so i went to EFI/APPLE director and found out there where two more > directories inside /EFI/APPLE > 1. FIRMWARE and 2. EXTENSIONS but there was no grubx64.efi like linux system. > E.g > we can boot ubutu using : > EFI/ubuntu/grubx64.efi > and for windows we have > EFI/Boot/BOOTX64.efi > > i found out there is a ThorUtil.efi in /EFI/APPLE/FIRMWARE but when i try to > run it, it says ThorUtil.efi is not recognized as an internal or external > command, operable program, or a batch file. > > > Can some help me booting a mac OS from UEFI shell. > P.S :: I have a mac air 13, intel i5, OS X > >From macOS you can run `bless --info` and this will show you the current path >to the OS loader. The common location is System/Library/CoreServices/boot.efi on your OS boot volume. Thanks, Andrew Fish > Thanks And Regards > Amit Kumar > ___ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [MAC HELP] Does Mac has a grubx64.efi ?
Hi , I am trying to boot a mac OS X from the efi shell so i opened the EFI partition. As usual there was EFI directory inside which there was APPLE director. so i went to EFI/APPLE director and found out there where two more directories inside /EFI/APPLE 1. FIRMWARE and 2. EXTENSIONS but there was no grubx64.efi like linux system. E.g we can boot ubutu using : EFI/ubuntu/grubx64.efi and for windows we have EFI/Boot/BOOTX64.efi i found out there is a ThorUtil.efi in /EFI/APPLE/FIRMWARE but when i try to run it, it says ThorUtil.efi is not recognized as an internal or external command, operable program, or a batch file. Can some help me booting a mac OS from UEFI shell. P.S :: I have a mac air 13, intel i5, OS X Thanks And Regards Amit Kumar ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [HII] Is it possible to get user input from a shell application by throwing a pop up window.
Hi, Is there a method/way for a uefi app to get input from an user by throwing a pop up window. Thanks Amit. ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] How to get fs index from controller handle.
Thanks for correction. FileDevicePath(devicepath,L"XYZ\\Par\\Chld\\filename.efi "); Amit From: af...@apple.com <af...@apple.com> on behalf of Andrew Fish <af...@apple.com> Sent: Friday, April 7, 2017 8:12:46 PM To: Amit kumar Cc: Carsey, Jaben; edk2-devel@lists.01.org Subject: Re: [edk2] How to get fs index from controller handle. On Apr 7, 2017, at 3:40 AM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>> wrote: Sorry my bad, actually it works instead of FileDevicePath(devicepath,L"XYZ\Par\Chld\filename.efi "); i have to use FileDevicePath(devicepath,L"XYZ\\\Par\\\Chld\\filename.efi "); I think it is 2 \\ not 3 and you have a space at the end of the string. Thanks, Andrew Fish Thanks for your help and support. Amit From: edk2-devel <edk2-devel-boun...@lists.01.org<mailto:edk2-devel-boun...@lists.01.org>> on behalf of Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>> Sent: Friday, April 7, 2017 3:46:37 PM To: Carsey, Jaben; af...@apple.com<mailto:af...@apple.com> Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Subject: Re: [edk2] How to get fs index from controller handle. Andrew, Jaben Thanks for your suggestions. I have one more query , i have a handle that contains a devicepath and i have a file say filename.efi wich is inside directory structure. say XYZ\Par\Chld\filename.efi NewDevPath =FileDevicePath(devicepath,L"XYZ\Par\Chld\filename.efi "); and then i do gBS->LoadImage ( FALSE, ImageHandle, NewDevPath, NULL, 0, ); which returns me Status = Not Found; But when i place the filename.efi in volume root NewDevPath =FileDevicePath(devicepath,L"filename.efi "); LoadImage succeeds. Can some one tell me how to deal with directories while generating the devicepath for a file inside a directory. Amit From: Carsey, Jaben <jaben.car...@intel.com<mailto:jaben.car...@intel.com>> Sent: Friday, April 7, 2017 2:22:15 AM To: af...@apple.com<mailto:af...@apple.com> Cc: Amit kumar; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Subject: RE: [edk2] How to get fs index from controller handle. Andrew, I was assuming not wanting ShellExecute() might extend to the rest of the shell. If the shell is in use, that can definitely help. While those 2 APIs do exist in theory, there is a single one that does all I think: GetDevicePathFromFilePath. -Jaben From: af...@apple.com<mailto:af...@apple.com> [mailto:af...@apple.com] Sent: Thursday, April 06, 2017 1:49 PM To: Carsey, Jaben <jaben.car...@intel.com<mailto:jaben.car...@intel.com>> Cc: Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>>; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Subject: Re: [edk2] How to get fs index from controller handle. Importance: High On Apr 6, 2017, at 1:30 PM, Carsey, Jaben <jaben.car...@intel.com<mailto:jaben.car...@intel.com><mailto:jaben.car...@intel.com>> wrote: That's the way to do it. the hard work is around finding the DevicePath for the application you want to run to pass to LoadImage. Jaben, It was easy in the old days. DevPath = gSE2->NameToPath (ShellPathName); gSE2->GetFsName (DevPath, FALSE, & ShellPathName); Maybe we should default EFI_SHELL_ENVIRONMENT2 to on :)? Half joking. I used those 2 APIs in the past to glue in shell volume names to a really simplistic C lib. Also if you have the File System Handle and path you can use the DevicePathLib. /** Allocates a device path for a file and appends it to an existing device path. If Device is a valid device handle that contains a device path protocol, then a device path for the file specified by FileName is allocated and appended to the device path associated with the handle Device. The allocated device path is returned. If Device is NULL or Device is a handle that does not support the device path protocol, then a device path containing a single device path node for the file specified by FileName is allocated and returned. The memory for the new device path is allocated from EFI boot services memory. It is the responsibility of the caller to free the memory allocated. If FileName is NULL, then ASSERT(). If FileName is not aligned on a 16-bit boundary, then ASSERT(). @param Device A pointer to a device handle. This parameter is optional and may be NULL. @param FileName A pointer to a Null-terminated Unicode string. @return The allocated device path. **/ EFI_DEVICE_PATH_PROTOCOL * EFIAPI FileDevicePath ( IN EFI_HANDLE Devic
Re: [edk2] How to get fs index from controller handle.
Sorry my bad, actually it works instead of FileDevicePath(devicepath,L"XYZ\Par\Chld\filename.efi "); i have to use FileDevicePath(devicepath,L"XYZ\\\Par\\\Chld\\filename.efi "); Thanks for your help and support. Amit From: edk2-devel <edk2-devel-boun...@lists.01.org> on behalf of Amit kumar <akami...@hotmail.com> Sent: Friday, April 7, 2017 3:46:37 PM To: Carsey, Jaben; af...@apple.com Cc: edk2-devel@lists.01.org Subject: Re: [edk2] How to get fs index from controller handle. Andrew, Jaben Thanks for your suggestions. I have one more query , i have a handle that contains a devicepath and i have a file say filename.efi wich is inside directory structure. say XYZ\Par\Chld\filename.efi NewDevPath =FileDevicePath(devicepath,L"XYZ\Par\Chld\filename.efi "); and then i do gBS->LoadImage ( FALSE, ImageHandle, NewDevPath, NULL, 0, ); which returns me Status = Not Found; But when i place the filename.efi in volume root NewDevPath =FileDevicePath(devicepath,L"filename.efi "); LoadImage succeeds. Can some one tell me how to deal with directories while generating the devicepath for a file inside a directory. Amit From: Carsey, Jaben <jaben.car...@intel.com> Sent: Friday, April 7, 2017 2:22:15 AM To: af...@apple.com Cc: Amit kumar; edk2-devel@lists.01.org Subject: RE: [edk2] How to get fs index from controller handle. Andrew, I was assuming not wanting ShellExecute() might extend to the rest of the shell. If the shell is in use, that can definitely help. While those 2 APIs do exist in theory, there is a single one that does all I think: GetDevicePathFromFilePath. -Jaben From: af...@apple.com [mailto:af...@apple.com] Sent: Thursday, April 06, 2017 1:49 PM To: Carsey, Jaben <jaben.car...@intel.com> Cc: Amit kumar <akami...@hotmail.com>; edk2-devel@lists.01.org Subject: Re: [edk2] How to get fs index from controller handle. Importance: High On Apr 6, 2017, at 1:30 PM, Carsey, Jaben <jaben.car...@intel.com<mailto:jaben.car...@intel.com>> wrote: That's the way to do it. the hard work is around finding the DevicePath for the application you want to run to pass to LoadImage. Jaben, It was easy in the old days. DevPath = gSE2->NameToPath (ShellPathName); gSE2->GetFsName (DevPath, FALSE, & ShellPathName); Maybe we should default EFI_SHELL_ENVIRONMENT2 to on :)? Half joking. I used those 2 APIs in the past to glue in shell volume names to a really simplistic C lib. Also if you have the File System Handle and path you can use the DevicePathLib. /** Allocates a device path for a file and appends it to an existing device path. If Device is a valid device handle that contains a device path protocol, then a device path for the file specified by FileName is allocated and appended to the device path associated with the handle Device. The allocated device path is returned. If Device is NULL or Device is a handle that does not support the device path protocol, then a device path containing a single device path node for the file specified by FileName is allocated and returned. The memory for the new device path is allocated from EFI boot services memory. It is the responsibility of the caller to free the memory allocated. If FileName is NULL, then ASSERT(). If FileName is not aligned on a 16-bit boundary, then ASSERT(). @param Device A pointer to a device handle. This parameter is optional and may be NULL. @param FileName A pointer to a Null-terminated Unicode string. @return The allocated device path. **/ EFI_DEVICE_PATH_PROTOCOL * EFIAPI FileDevicePath ( IN EFI_HANDLE Device, OPTIONAL IN CONST CHAR16*FileName ); Thanks, Andrew Fish -----Original Message- From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Amit kumar Sent: Thursday, April 06, 2017 9:45 AM To: Andrew Fish <af...@apple.com<mailto:af...@apple.com>> Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Subject: Re: [edk2] How to get fs index from controller handle. Importance: High Hi, Can i use gbs->loadimage() and gbs->startimage() to load an efi application and execute it. Suppose i have a app1.efi and from app1.efi i want to execute app2.efi. Or is there some other way to do it ? Not considering ShellExecute(); Amit From: af...@apple.com<mailto:af...@apple.com> <af...@apple.com<mailto:af...@apple.com>> on behalf of Andrew Fish <af...@apple.com<mailto:af...@apple.com>> Sent: Thursday, April 6, 2017 4:39:22 PM To: Amit kumar Cc: edk2-devel@lists.01.org<mailto
Re: [edk2] How to get fs index from controller handle.
Andrew, Jaben Thanks for your suggestions. I have one more query , i have a handle that contains a devicepath and i have a file say filename.efi wich is inside directory structure. say XYZ\Par\Chld\filename.efi NewDevPath =FileDevicePath(devicepath,L"XYZ\Par\Chld\filename.efi "); and then i do gBS->LoadImage ( FALSE, ImageHandle, NewDevPath, NULL, 0, ); which returns me Status = Not Found; But when i place the filename.efi in volume root NewDevPath =FileDevicePath(devicepath,L"filename.efi "); LoadImage succeeds. Can some one tell me how to deal with directories while generating the devicepath for a file inside a directory. Amit From: Carsey, Jaben <jaben.car...@intel.com> Sent: Friday, April 7, 2017 2:22:15 AM To: af...@apple.com Cc: Amit kumar; edk2-devel@lists.01.org Subject: RE: [edk2] How to get fs index from controller handle. Andrew, I was assuming not wanting ShellExecute() might extend to the rest of the shell. If the shell is in use, that can definitely help. While those 2 APIs do exist in theory, there is a single one that does all I think: GetDevicePathFromFilePath. -Jaben From: af...@apple.com [mailto:af...@apple.com] Sent: Thursday, April 06, 2017 1:49 PM To: Carsey, Jaben <jaben.car...@intel.com> Cc: Amit kumar <akami...@hotmail.com>; edk2-devel@lists.01.org Subject: Re: [edk2] How to get fs index from controller handle. Importance: High On Apr 6, 2017, at 1:30 PM, Carsey, Jaben <jaben.car...@intel.com<mailto:jaben.car...@intel.com>> wrote: That's the way to do it. the hard work is around finding the DevicePath for the application you want to run to pass to LoadImage. Jaben, It was easy in the old days. DevPath = gSE2->NameToPath (ShellPathName); gSE2->GetFsName (DevPath, FALSE, & ShellPathName); Maybe we should default EFI_SHELL_ENVIRONMENT2 to on :)? Half joking. I used those 2 APIs in the past to glue in shell volume names to a really simplistic C lib. Also if you have the File System Handle and path you can use the DevicePathLib. /** Allocates a device path for a file and appends it to an existing device path. If Device is a valid device handle that contains a device path protocol, then a device path for the file specified by FileName is allocated and appended to the device path associated with the handle Device. The allocated device path is returned. If Device is NULL or Device is a handle that does not support the device path protocol, then a device path containing a single device path node for the file specified by FileName is allocated and returned. The memory for the new device path is allocated from EFI boot services memory. It is the responsibility of the caller to free the memory allocated. If FileName is NULL, then ASSERT(). If FileName is not aligned on a 16-bit boundary, then ASSERT(). @param Device A pointer to a device handle. This parameter is optional and may be NULL. @param FileName A pointer to a Null-terminated Unicode string. @return The allocated device path. **/ EFI_DEVICE_PATH_PROTOCOL * EFIAPI FileDevicePath ( IN EFI_HANDLE Device, OPTIONAL IN CONST CHAR16*FileName ); Thanks, Andrew Fish -Original Message- From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Amit kumar Sent: Thursday, April 06, 2017 9:45 AM To: Andrew Fish <af...@apple.com<mailto:af...@apple.com>> Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Subject: Re: [edk2] How to get fs index from controller handle. Importance: High Hi, Can i use gbs->loadimage() and gbs->startimage() to load an efi application and execute it. Suppose i have a app1.efi and from app1.efi i want to execute app2.efi. Or is there some other way to do it ? Not considering ShellExecute(); Amit From: af...@apple.com<mailto:af...@apple.com> <af...@apple.com<mailto:af...@apple.com>> on behalf of Andrew Fish <af...@apple.com<mailto:af...@apple.com>> Sent: Thursday, April 6, 2017 4:39:22 PM To: Amit kumar Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Subject: Re: [edk2] How to get fs index from controller handle. On Apr 6, 2017, at 3:30 AM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com><mailto:akami...@hotmail.com>> wrote: Hi, I want to get the fs index from the controller handle. e.g In map command i see my controller is mapped to fs10. So i there any API i can use in my code to get the fs index( which is 10 as in example) from the controller handle. Amit, It is important to remember that fs0:, and the other device names are a S
Re: [edk2] How to get fs index from controller handle.
Hi, Can i use gbs->loadimage() and gbs->startimage() to load an efi application and execute it. Suppose i have a app1.efi and from app1.efi i want to execute app2.efi. Or is there some other way to do it ? Not considering ShellExecute(); Amit From: af...@apple.com <af...@apple.com> on behalf of Andrew Fish <af...@apple.com> Sent: Thursday, April 6, 2017 4:39:22 PM To: Amit kumar Cc: edk2-devel@lists.01.org Subject: Re: [edk2] How to get fs index from controller handle. On Apr 6, 2017, at 3:30 AM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>> wrote: Hi, I want to get the fs index from the controller handle. e.g In map command i see my controller is mapped to fs10. So i there any API i can use in my code to get the fs index( which is 10 as in example) from the controller handle. Amit, It is important to remember that fs0:, and the other device names are a Shell concept and not an EFI concept. So they only exist in the context of the shell. I took a quick look and I did not see an easy way to do this with the current Shell APIs. In the older Shell you could use this protocol EfiShellEnvironment2 Protocol has a function that converts a EFI_DEVICE_PATH_PROTOCOL (would be on your controller handle) to a CHAR16. Thus you can get the volume name the Shell would display to the user. I don't the index exists as a concept. So EFI_SHELL_ENVIRONMENT2.GetFsName() and EFI_SHELL_ENVIRONMENT2.GetFsDevicepath() are the closest thing I can think of. https://github.com/tianocore/edk2/blob/master/ShellPkg/Include/Protocol/EfiShellEnvironment2.h#L812 The only problem with that is EfiShellEnvironment2 is not produced by the Shell by default. ## This flag is used to control the protocols produced by the shell # If TRUE the shell will produce EFI_SHELL_ENVIRONMENT2 and EFI_SHELL_INTERFACE gEfiShellPkgTokenSpaceGuid.PcdShellSupportOldProtocols|FALSE|BOOLEAN|0x0002 I've use the EFI_SHELL_ENVIRONMENT2 in the past to enable a non Shell application to print out volume names that match the map command of the shell. Hopefully some one knows how to do this in the modern Shell? Thanks, Andrew Fish Regards Amit ___ edk2-devel mailing list edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] How to get fs index from controller handle.
Hi, I want to get the fs index from the controller handle. e.g In map command i see my controller is mapped to fs10. So i there any API i can use in my code to get the fs index( which is 10 as in example) from the controller handle. Regards Amit ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] DisconnectController API not working.
Hi Andrew , I did some testing and found out, same code works fine on Server boards but it fails on desktop boards. I Have double checked the ControllerHandle by printing its handle index using ConvertHandleToHandleIndex(ControllerHandle), the ControllerHandle looks correct. I have one new query; i have made a startup.nsh file in which i am issuing load driver.efi , i am getting file not found. i have also tried using load fs0:driver.efi, and again i get file not found. I have been trying to run this script from internal shell as well as usb shell. Regards Amit Kumar From: af...@apple.com <af...@apple.com> on behalf of Andrew Fish <af...@apple.com> Sent: Friday, March 31, 2017 10:42:08 PM To: Amit kumar Cc: edk2-devel@lists.01.org Subject: Re: [edk2] DisconnectController API not working. On Mar 31, 2017, at 5:26 AM, Amit kumar <akami...@hotmail.com<mailto:akami...@hotmail.com>> wrote: Hi , I am trying to disconnect a controller from the usb mass storage driver, for which i am using Status = gBS->DisconnectController ( ControllerHandle, NULL, NULL ); after the call i get Status = SUCCESS , but when i run drivers command in shell, i find it still being manged by the same old driver handle. Although when i run disconnect command from shell (e.g disconnect 163 ...output disconnect(163,0,0):Status = SUCCESS) it works as expected and detaches the controller from the driver. Can some body point me out what could be the reason. Amit, It is always good to double check you are using the right ControllerHandle. Sequence of events matters. There are boot flows and Shell commands that do ConnectController. ~/work/src/edk2/ShellPkg(master)>git grep ConnectController Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402:gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE); Library/UefiShellDriver1CommandsLib/Connect.c:54:Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE); Library/UefiShellDriver1CommandsLib/Connect.c:95:gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE); Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers ( Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we call the gBS->ConnectController function. Library/UefiShellDriver1CommandsLib/Connect.c:158: Status = gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive); Library/UefiShellDriver1CommandsLib/Connect.c:167:Status = gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive); Library/UefiShellDriver1CommandsLib/Connect.c:298:Status = gBS->ConnectController ( Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectControllers ( Library/UefiShellDriver1CommandsLib/Connect.c:391: return (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL))); Library/UefiShellDriver1CommandsLib/Connect.c:536: Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0)); Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE ConnectControllerContextOverride[2]; Library/UefiShellDriver1CommandsLib/DrvCfg.c:514: ConnectControllerContextOverride[0] = DriverImageHandle; Library/UefiShellDriver1CommandsLib/DrvCfg.c:515: ConnectControllerContextOverride[1] = NULL; Library/UefiShellDriver1CommandsLib/DrvCfg.c:516:gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE); Library/UefiShellLevel2CommandsLib/Load.c:52:Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE); Thanks, Andrew Fish ___ edk2-devel mailing list edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] DisconnectController API not working.
Hi , I am trying to disconnect a controller from the usb mass storage driver, for which i am using Status = gBS->DisconnectController ( ControllerHandle, NULL, NULL ); after the call i get Status = SUCCESS , but when i run drivers command in shell, i find it still being manged by the same old driver handle. Although when i run disconnect command from shell (e.g disconnect 163 ...output disconnect(163,0,0):Status = SUCCESS) it works as expected and detaches the controller from the driver. Can some body point me out what could be the reason. ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] Reset from post BDS pahse to PEI phase
Hi , I have been facing some problem with blockIO reads even after reconnect and update map. when i try to do dblk on some of my blocks it returns with EFI_INVALID_PARAMETER. Is there a way to reinitialize the EFI platform from post bds phase or post dxe phase without putting the board in power-off mode( like in the case of shell reset command or system restart). Thanks and Regards Amit ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] SIMD Instruction supported in UEFI?
>From UEFI shell From: Ken Taylor <ken_tay...@phoenix.com> Sent: Thursday, March 9, 2017 4:51 AM To: Amit kumar; edk2-devel@lists.01.org Subject: RE: [edk2] SIMD Instruction supported in UEFI? Hi Amit, Maybe in UEFI the code in question crosses a cache line boundary when executed in UEFI, with the loop or part of the instruction itself on one side of the boundary and the rest on the other? At what point are you trying to execute this code, is it still from the UEFI shell or have you moved it into a driver that runs earlier? You might try changing the linker flags to force 4k code alignment on your test binary. Regards, -Ken. -Original Message- From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Amit kumar Sent: Wednesday, March 08, 2017 7:10 AM To: edk2-devel@lists.01.org Subject: [edk2] SIMD Instruction supported in UEFI? Hi ; I have written a UEFI app in ASM which runs XOR on a block of data using SIMD instructions ("PXOR") in UEFI environment. It takes around 2 Seconds to run this code, but when i use normal C XOR operator ("^") it takes 1 Seconds. Is there something wrong ? I mean SIMD instructions must be giving me better performance(my expectation); But when i do same experiment in Windows environment SIMD code ( _mm_xor_si128 ) gives me 9 times better performance than normal XOR instruction. Have i missed something?. Regards Amit Kumar ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] SIMD Instruction supported in UEFI?
Hi ; I have written a UEFI app in ASM which runs XOR on a block of data using SIMD instructions ("PXOR") in UEFI environment. It takes around 2 Seconds to run this code, but when i use normal C XOR operator ("^") it takes 1 Seconds. Is there something wrong ? I mean SIMD instructions must be giving me better performance(my expectation); But when i do same experiment in Windows environment SIMD code ( _mm_xor_si128 ) gives me 9 times better performance than normal XOR instruction. Have i missed something?. Regards Amit Kumar ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] SIMD Instruction supported ?
Hi, I have been trying to exploit SIMD capabilities in a EFI shell application. I have written a code which calls a procedure with is written in X64 asm. but my application freezes at the following instruction movdqa xmm0, XMMWORD PTR [rax] Is SIMD supported in UEFI ? Platform Details : Processor :: intel I7, IvyBridge; P.S i have checked the CPUID and SSE2 XMM are supported. Also the similar code works in windows environment. Regards Amit ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel