UEFI (UGA) Graphics After exiting Boot Services - c

I was writing an Operating System and testing it on an emulator in my primary computer (HP Z420), i tested it sometimes on that computer but i was always in a boot/shutdown loop that taked a long time. So i had an old pc (HP 620) Which has an old version of UEFI and nothing gets displayed when i run the O.S on it. So i founded that it has not GOP Support and Frame buffer address is always 0. I switched from gnu-efi to edk2 to give support to U.G.A, i succeeded and graphics worked, however when i exit boot services and call UgaProtocol->Blt from the kernel, the system triple faults but when i call it without exiting boot services, everything works fine.
I know that these functions are Boot Services and may use Boot Services so that maybe the cause of the triple fault
So how can i implement a permanent communication with U.G.A After exiting boot services (in G.O.P, we usually write to a frame buffer)
If i do not exit boot services, changing the gdt or the idt or any other thing causes a debug exception (Result on qemu & VBox) and halts on Real Hardware.

Related

ARM Trustzone, Open Virtualization SDK Boot stuck

I am currently working on something related to ARM Trustzone so I found this Open Virtualization (http://openvirtualization.org/)
I followed the documentation over the Sierra TEE build and boot guide to build and it compiles without issues.
However when I am trying to boot the system, it seems it loops in the "normal world" forever and the log shows the following:
Trying 127.0.0.1... Connected to localhost. Escape charater is '^['.
SW: Entering Secure Main
SW: UART driver initialized successfully the mount file system is 32
and the value is 0 file system successfully mounted in FAT32 nsk
load:load addr = 80000000, startaddr = 90d00000, size = 3aedcc Done
tzhyp_guest_context_init:SW: dispatch task id 0x111
It seems it loops in the normal world forever and the boot process is stuck at this point.
If anyone happen to work on this before please help.

Does USB mass-storage class requires re-enumeration after timeout?

this might be a stupid question,
I was debugging a USB storage device on an ARM-CortexM4 platform (STM32F4 series) which runs embedded Linux. The ARM is working as USB host, and tries to communicate with a thumb drive in USB full speed (12Mb/s).
Now here is the problem. After successful enumeration and several SCSI commands thru BULK transfers, the capacity and everything can be read correctly. However, after about 15 seconds when I try to send these SCSI commands again (under same condition), the USB host controller just returns 'Transaction Error', which looks like the device is not responding to BULK transfers anymore (not ACKing) and the host controller times out. The question is, is there any timeout mechanism for USB mass-storage class or SCSI system such that, after a timeout the system must be re-enumerated or re-probed, otherwise it won't respond anymore?
I understand this might be due to a stupid error in my program, or due to some limitations on the specific hardware. However when I used usbmon module in Linux on a PC to capture the transfers on the very same thumb drive, I can see the operating system actually sends a sequence probing command (Read-max-Lun followed by Test-unit-ready) every 5 sec, which could be the reason why the thumb drive doesn't fail on my PC.
Thanks! I'm looking forward to any replies.
I think you're on the right track with the Test Unit Ready commands.. I am in the middle of writing a mass storage device driver for an embedded device and When testing on OS X, after the initial SCSI queries, my device receives Test Unit Ready command about once every second when no other activity is occurring. Since your post is quite old, I recommend you post your own solution if you've since solved your problem.
Otherwise try adding periodic test unit ready commands from the host side when there is no other activity.. You could set and activate a timer whenever USB activity is occurring. If the timer fires, u can send a Test unit ready command.. Rinse repeat.

Programmatically getting time required for complete system boot up?

I have written an application for defragmenation which starts at boot time.We know every system boots up faster or slower depending on its configuration.I have given hard coded value of 3 seconds during boot time so that,windows registers all ports during that time.I just want to know,are there any APIs existing which gives exact time when windows system is completely ready at boot time.That is whether all USB ports and others got recognized or not.?

Locking the frame buffer device

I am developing an application for linux based embedded system which directly writes on the framebuffer device of the Linux kernel.The writing works perfectly. But the problem happens when some other event occurs with a demand of display(Like plugging a flash drive or a kernel message). Every time when it happens, the screen gets interrupted and the unwanted things appear on the screen erasing the previous graphics from the overlapped portion(other things remain unchanged).
How can I get rid of this problem?
Add console=0 to the kernel command line. It disables both the kernel outputting anything to the console, and the console login. (For development purposes, I recommend having a separate boot option, so you can boot to a console.)
Alternatively, have your application create a new virtual terminal for the framebuffer, like X does. This avoids the kernel (kernel console, really) scribbling text all over your framebuffer.

How its made such as digicoder vcr dvd players graphical user interfaces from poweron till user interface?

I have C/Java knowledge but i never understand yet, how some hardwares show there own screens/graphics from poweron stage to user interface (where it never shows linux/unix boot screen nor it shows windows booting screens).
My question is, Compared to VCR/TV digicoders poweron till user interfaces, how its made? Do we use regular linux kernel or is there any special open source framework which allow us to develop such?
Thanks
Many embedded systems use u-boot as a boot loader. U-boot provides the ability to display a "splash" screen while the linux kernel is booting.
A device will start the bootloader right after the CPU comes out of reset (usually milliseconds after power-on at most). The bootloader code can initialize the display and show a splash screen if it wants (in the same way most modern non-embedded Linux distributions have a graphical grub splashscreen). The kernel can avoid changing the display configuration, and on an embedded device the kernel can boot pretty quickly to running userspace (at least an initramfs), which can take over the display and show whatever animation, progress bar, etc until the full UI is ready.
An operating systems such a Windows or Linux are both large and general purpose. They have to initialise themselves and the hardware, which includes interrogating all connected devices for "plug & play". The OS does not know in advance which such devices are connected; it has to "discover" the hardware every time it starts. The connected hardware may even have changed since it last booted.
Embedded systems do not usually have large operating systems (or often do not have an operating system at all), and they usually have very specific hardware known to the system a priori, so do not need to test and determine the correct configuration for such devices. Often also these devices are far simpler, and are often 'on-chip' peripherals.
That said, your PC is capable of instantly displaying a user interface (just not Windows). The BIOS boot process outputs text to the display almost immediately, and the BIOS console is an interactive user interface that starts on request during boot. Also last time I booted MS-DOS on a modern PC, it took only a few seconds to start.
Not all embedded systems start "instant-on", my digital TV PVR even has a progress bar while booting, but being application specific, it still starts far faster than a general purpose computer. My Network Attached Storage (NAS) device which is an embedded system running Linux on the other hand, takes considerable time to boot since among other things, it has to start the file-system, network, USB interfaces, print server, DNLA server, and web-server. In fact many of the things required for a general purpose computer (but it has no display, the UI is presented via the web-server)
Some embedded systems with large operating systems and complex hardware can achieve "instant-on" by never truly switching off, but rather going into a low power mode where the system state is retained in memory while all the high powered devices such as a screen, WiFi, Bluetooth etc. are switched off.

Resources