bzt wrote:Okay, I see your confusion now. Yes, they are exactly that, libraries on top of UEFI protocols to hide all that ugly GUID interfaces.
bzt wrote:Print[/url] is also implemented as a user library, just like with GNU-EFI and POSIX-UEFI. The only difference is, POSIX-UEFI calls this "printf", and not "Print", again only to provide the usual POSIX API for it.
No confusion, I mentioned Print() myself. Sure, there are also AllocatePool() and a bunch of other functions. But all of them are mentioned in the UEFI Spec (including Print). For example, The AllocatePool() wrapper is mentioned in this example:
//
// Create a new child
//
PrivateChild = EfiLibAllocatePool (sizeof (ARP_PRIVATE_DATA));
if (PrivateChild == NULL) {
return EFI_OUT_OF_RESOURCES;
}
UEFI Spec 2.8, Errata B, page 395.
It doesn't really matter that they are not technically in the UEFI firmware. They're part of "UEFI".
bzt wrote:vvaltchev wrote:they just expose UEFI as it is, nothing more.
Not quite. They provide a layer on top of the UEFI.
A few functions, mentioned in the UEFI spec do not really provide a "layer" on the top of UEFI. They're really minor utils. A software layer is another thing.
bzt wrote:They also do provide a lot of header files with the typedefs and the GUID defines, but so does POSIX-UEFI.
OK, this is an
important point. The typedefs and GUIDs provided by GNU-EFI, EDK2 and your POSIX-UEFI do
NOT count as a
software layer. They're
not code and cannot be considered as part your library's interface. It's like defining all the syscall numbers, expecting users to use syscall(2) + your defines and claiming that you cover the whole interface of the kernel. Again, that's
very useful, but it's not a software layer.
bzt wrote:
That's exactly what I did. That's why I've said everything is covered that a bootloader needs. If there's no library function for something, then there's at least a typedef struct and a GUID define for the interface so that you don't have to rely on 3rd party header files. You can't expect more from EDK2 nor from GNU-EFI either.
OK, do you realize that we're looking at the things from a
completely different angle? Obviously, you "cover" everything with typedefs and GUIDs, like GNU-EFI does. I never even thought of questioning that. But that does not mean "covering" to me, as I just explained. For me, your library
covers only the UEFI features that are exposed through your POSIX-like interface. The rest is a fall-back to the native UEFI interface.
bzt wrote:vvaltchev wrote:Or least, aim to do that. In your case, if I've understood you correctly, you just don't care
No, you did not understood at all. I specifically asked for protocols that you need besides of the ones already covered, because I care.
If you care, do you realize that implementing a bunch of new interfaces will inevitably make POSIX-UEFI to be a different library? Either you add new functions or support "special" files like /dev/diskNp0 etc, it would be a ton of work. Of course, if you show some genuine interest in that, I will start mentioning the interfaces that I believe should be wrapped. But, again, that will change your library significantly. I'd be super surprised if you moved from your original (hard) position to that, but that's how software improves and people collaborate. There's nothing bad in changing your mind. Just, allow me to be skeptic.
Still, to you show some goodwill from my side, I'll mention the first one. The
graphics output protocol. It's essential for a bootloader. Through multiboot, the bootloader communicates to the kernel the current video mode with the base pointer and bunch of other info (width, height, bpp, etc.). You need to query the current video mode with GOP. The kernel itself might also have a preferred video mode, which is set in it's ELF binary (according to the multiboot spec). So, you'll have to switch to that video mode, if it's available. Finally, on some laptops with "retina" displays the default video mode (= native display resolution) is NOT good enough, even for the bootloader itself, because the default font is too small and it does not get scaled. Better to select a "human" (smaller) resolution before having any interaction with the user. Note: I'm talking about an interactive bootloader. That case is important.
So, you'll have to figure out a nice way to expose 100% of the graphics output protocol in your library. You might create a bunch of special files like /sys/gop/0, /sys/gop/1, /sys/gop/count plus a bunch of IOCTLs or, in alternative, you can design a whole new interface. People will need to query the available video modes, set them, handle errors, and, write to video framebuffer (there are graphical UEFI bootloaders as well). Note: if the new interface is in C, the
risk is ending up with something too similar to the native UEFI interface, maybe with the only difference that structs and typedefs have better (shorter) names. If the new interface is file-based, the
risk is that it might be inconvenient to use, it depends. While it's easy for me to enumerate the interfaces that should be wrapped, designing them is a
complicated task. So, if you get frustrated with that, I'd totally understand. That's why I proposed C++, actually. I have a love-hate relationship with that language, but at least I can say that you could offer simpler, high-level interfaces with it. Of course, that's at the price of making yours a C++ library. I'd understand if you didn't like the idea. The problem is that it is NOT simple to design good interfaces.
So, what do you think ?