Help me understand: keyboard / firmware / linux

I’m currently running Fedora 40 on a Lenovo IdeaPad 3 (blipper) with full MrChromebox UEFI firmware.

Unfortunately the F1-12 keys do not work, neither does numpad.

I don’t only want this problem fixed, I actually want to understand it. My questions:

  • Relation between UEFI firmware and keyboard. Which roles do the keyboard hardware and UEFI firmware play?

  • Does the keyboard itself have something like an fn key that changes the behavior?

  • How can I find out which code is sent to the OS when a key is pressed?

  • Which path does the keypress take through the OS, where is (re)mapped?

If possible I’d like to “fix” my problems below the OS layer so I don’t have to jump through extra hoops like custom scripts etc. every time I install a different distribution or switch from xorg to wayland.