Yes in theory you can do this, however it requires a computer system that is known-good; that is, you can trust the accuracy of what it reports when you hash data on it.
You also require some hardware tools and a little bit of skill / practice.
What you can do is locate the chip on your device's mainboard in which the bios / efi is stored and read the data inside the chip. Many of these EEPROM flash chips have an SPI interface to the motherboard, so you can get a simple SPI chip reader to pull the data out of the chip without having to desolder it.
Once you've made a copy of the data in the flash chip on a known-good computer, you can examine the data and compare it to a known-good image of the flash data. Usually you download that data from the computer manufacturer. For example, Apple includes firmware images in their software updates. Traditional mainboard manufacturers offer the bios image for download on their web site.
I'm glossing over some details here for the purpose of brevity. There are things that make this a bit more complex than I've made out here, but in general the workflow will do what you want.