Electronic – Read or set registers in motherboard

computersdatasheetmicrocontrollermotherboardsensor

With microcontrollers it is pretty easy to switch a LED on/off, by writing on a register.

This question is instead an attempt to write to a PCI device register in a desktop computer.

In a similar way, I would like to read/write the registers in the motherboard to control fans (on, off or even speed) or the power or hard disk LEDs, or temperature sensors.

Given – for example – an Asus motherboard and a Linux OS, is it possible? And what kind of datasheet should be readed, if it exists, to obtain the register names in the motherboard? I never found for a consumer motherboard something like the datasheet of a microcontroller.

Best Answer

The documentation no doubt exists. Not always freely available but it exists.

There is always linux and bsd source code you can read as well if they support these peripherals, there you go (yes I know that is not always an easy read).

If there is already a device driver for this peripheral then learn how to communicate with that device driver. lm-sensors as pjc50 commented is one example.

If not you can often punch through the operating system protection with mmap() and from the application talk to things directly. Depending on what you are trying to do (mother board test equipment, pcie card test equipment, etc) that may suffice. The correct way to do it is modify or write a kernel driver and talk to/through it to get at the peripheral, can be as thin or thick of a driver as you desire but at least the last mile of writes/reads come from the kernel space not application.

Note DOS is still used for motherboard and other testing being one of the best bare metal operating systems (intentional oxymoron), and if you are working closely with a motherboard company they might provide the source or snippets of code from their test programs that blink leds or read the temperature sensor, etc.

Yes motherboard documentation even if you have access is not the same as a microcontroller, the audience is different, it is often only the bios programmers (contractors) and internal test folks that need the documentation, and that is it so it could be scribbles on a whiteboard.

Being a PC what an operating system needs is defined by convention or discoverable, so you dont need documentation, you just programmatically search for things and find what is present. As needed based on what you find then you go to that specific chip vendors site to get the datasheet (which does read like a microcontrollers) for that part. some pcie bridge chip from intel, right there at intels web site. A usb bridge or master, same deal. Video card, well they might not be as open. Hard disk controller, find the datasheet. Ethernet, find the datasheet and read it. lspci is your friend. lsusb is your friend. google is your friend.