flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Question about devices with UEFI

Author
Thread Post new topic Reply to topic
Fulgurance



Joined: 27 Nov 2017
Posts: 276
Fulgurance 13 Dec 2020, 00:48
Hello, I have just a question : what function with the UEFI can I use to in first, found all devices connected availabes (ssd, hard disk, USB) and in second, to write on devices? I search in the the documentation, but I don't found
Post 13 Dec 2020, 00:48
View user's profile Send private message Reply with quote
Feryno



Joined: 23 Mar 2005
Posts: 514
Location: Czech republic, Slovak republic
Feryno 13 Dec 2020, 16:55
you should probably study https://www.tianocore.org/
Post 13 Dec 2020, 16:55
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Fulgurance



Joined: 27 Nov 2017
Posts: 276
Fulgurance 15 Dec 2020, 08:08
I understood its on the media section with block functions, but I don't understand something, many function take mediaid to parameters, but how can I get all media ID for each connected devices?
Post 15 Dec 2020, 08:08
View user's profile Send private message Reply with quote
bzt



Joined: 09 Nov 2018
Posts: 79
bzt 16 Mar 2021, 22:21
This isn't that simple. UEFI uses protocols, so also depends on what you mean by "write on devices"? If you mean file level access, then simply use "FS0:", "FS1:" etc. If you mean sector writes, then you'll need EFI_BLOCK_IO_PROTOCOL. You can query a list of handlers which do implement that protocol using LocateHandle and then HandleProtocol on each returned handle. This does not guarantee that all connected devices will be returned, it only guarantees that all devices which implements sector read/write returned.

I've written a small UEFI wrapper to provide POSIX-like interface for UEFI. See POSIX-UEFI.
There for opening "/dev/diskX" pseudo-files with fopen(), I've implemented the aforementioned method to find devices that support block io, see here. It's in ANSI C, but you can translate that to your UEFI Assembly calls.

Cheers,
bzt
Post 16 Mar 2021, 22:21
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.