HAL, Motherboard Detection

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
cxzuk
Member
Member
Posts: 164
Joined: Mon Dec 21, 2009 6:03 pm

HAL, Motherboard Detection

Post by cxzuk »

Hi all,

Im interested in implementing a HAL layer.. From what i can understand, its basically a motherboard driver?

If this is true.. Is it possible to detect what the motherboard supports and provides? (RTC, DMA, Buses?)

Thankyou
Mike Brown
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: HAL, Motherboard Detection

Post by Owen »

All the information you'll need is availabel in the ACPI tables. On most systems, you'll have a root "System driver"; for PCs, this will probably be the "ACPI PC" driver. You come across a device type defined in ACPI (E.G. a root PCI bus) and load the corresponding driver.

The concept of a "HAL" or "System driver" is really that of a potentially virtual "root bus" for enumerating the devices of the system. The amount of dynamism there can vary; on an ARM SOC, for example, you would probably have a root driver which enumerated a bunch of hardcoded devices, of which perhaps only a few (e.g. I2C, USB) would serve as bus bridges.
User avatar
mark3094
Member
Member
Posts: 164
Joined: Mon Feb 14, 2011 10:32 pm
Location: Australia
Contact:

Re: HAL, Motherboard Detection

Post by mark3094 »

From what i can understand, its basically a motherboard driver?
The HAL is similar to a motherboard driver in a way...
The HAL is a layer between the Kernel and the hardware. The Kernel does not access the hardware directly, but interfaces with the HAL, and the HAL does the hardware work. I like to think if it a bit like an API (although I'm sure that's not entirely accurate)...

This makes things easier when porting to different hardware, as the Kernel doesn't require many changes, if any. Just the HAL.

You could use the HAL for detecting hardware, but you don't necessarily have to


(Minor disclaimer... I'm still working on my OS and HAL, so there may but much more to it than I'm letting on)
cxzuk
Member
Member
Posts: 164
Joined: Mon Dec 21, 2009 6:03 pm

Re: HAL, Motherboard Detection

Post by cxzuk »

Thankyou!

I think the ACPI is what im after, but it seems incredibly complex for what i would like to start with.

I have had a look at the output of acpidump on linux, Would it be right to say that in order to find out what chips, processors and memory are available, i only need read the DSDT?

Mike Brown
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: HAL, Motherboard Detection

Post by gerryg400 »

You need to read the MADT (signature == APIC). It gives interrupt and APIC info. Some processor info can be inferred from this.

Memory info should come from the BIOS E820 services.

Some computers also have an MP table. This can be a little easier to read.
If a trainstation is where trains stop, what is a workstation ?
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: HAL, Motherboard Detection

Post by Owen »

I strongly suggest you do what Linux, Darwin, Solaris, FreeBSD and most others do: Use Intel's ACPICA. It's well tested, its a full implementation, it is far easier than implementing it on your own.
Post Reply