On 2019-06-12 13:12, ¯\__/¯ ¯\__/¯ wrote:
I've search for the answer to this question, but I can't find it.
I also read the source code, but I still don't get how it works.
Help pl0x
Not sure exactly what you're looking for...
On modern architectures, most OSes (including OpenBSD) "walk the
hardware device tree". The possible topologies and nodes of the device
tree are controlled by the kernel source code. OpenBSD does 99% of it
at boot time, with a few notable exclusions (PCMCIA, PC CARD, USB, can't
remember what else).
Look under /usr/src/sys/arch/* for functions with "_attach_" in their
names, which should give you a very rough idea of where to start
looking.
For both historical and somewhat-current documentation on how this
works, check out
https://en.wikipedia.org/wiki/Marshall_Kirk_McKusick#Bibliography .
(I'm unaware of any OpenBSD-specific publications covering that sort of
thing, but OpenBSD *is* derived from the same BSD UNIX that Kirk wrote
about. Lessons learned about one BSD can, usually, have their concepts
applied to their cousins - although the implementation details have
diverged quite a bit by now.)
-Adam