Andy, DXE drivers are not sufficient for this use case - this is what UEFI Driver Binding is for. This has been an outstanding issue for ARM for a few years now. We need to define a bus protocol like PCI_IO that handles memory-mapped SoC peripherals like the two SDIO controllers. With a bus protocol we can then produce child handles for each controller and a driver can use UEFI Driver Binding to connect to the devices, allocate device-specific context structures, and publish unique protocols on each handle.
On our systems we do something like this but I think we eventually need something in the UEFI spec to provide an interoperable solution. So what would it take to get this? Something like: 1. Define a protocol - use PCI_IO as a basis and strip off PCI concepts like BARs, config space, etc 2. Define a scheme for identifying SoC devices. Handle both 'class' cases and individual instances. Leverage existing industry standards as much as possible. Make sure to embody the UEFI extensibility principles (i.e. don't just define numeric IDs starting at zero since this would have to be centrally maintained). We could always just use GUIDs for this. 3. Define (or leverage) a device path node for this so that you can test for something in your Driver Binding Supported() function 4. Create a component with the list of SoC devices. Could be as simple as a C table or as complex as ACPI within UEFI. 5. Create a bus driver that reads the list of devices and products the child handles. The bus driver implements the IO protocol. I apologize since this was probably not the answer you were looking for. Let me know if you're interested in taking this on. Thanks, Eugene -----Original Message----- From: Andreas Galauner [mailto:andr...@galauner.de] Sent: Saturday, May 09, 2015 5:45 PM To: edk2-devel@lists.sourceforge.net Subject: [edk2] Multiple devices with the same driver Hi all, I'm currently porting UEFI to the Xilinx Zynq (ARM) platform because I was interested in UEFI in general and wanted to get a feeling for the internals and the concepts behind the whole platform. I have a working port which boots as a 2nd stage bootloader, starts the 2nd core and has pretty console output. So, I now need to implement all the DXE drivers. The first thing I want to implement is the SDIO Host controller to actually be able to load a kernel and dtb from an SD card. The Zynq has two SDIO host controllers and I want the BSP to be flexible. Now, I could use a PCD to specify which one should be used. That's what I did for all the timers and the serial port. But I find that very inflexible. I'd rather have one driver for both of the host controllers and enable them separately via PCDs because it depends on the actual board which of the interfaces is wired up. The problem is, I can't find out how to implement one DXE driver which gets instantiated two times. Each instance being responsible for one SDIO host controller. I understand that for PCI-based devices, the bus driver is responsible for enumerating all devices on the bus and loading the appropriate drivers, but how would I do something like this on an embedded platform with platform devices like the SDIO host controllers? Do I need a virtual bus? Any pointers to an existing implementation and/or a short explanation would be cool. I'm sure I'm not the first one with this problem, but I'm not sure what to search for. That's also the reason for the clumsy subject. Thanks, - Andy ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel