Hi guys,
I have been testing my os on various computers today, and i have discovered something wierd.
It works well in bochs,virtualbox,vmware, Lenovo T60 latptop, HP w/atom, Dell Quad Xeon, and on a Dual Pentium PRO my code works. But not for this fucking HP NC8230 laptop..
My timer code uses the LAPIC timer if LAPIC is present, with fallback to PIT+PIC. SMP is used if APIC found, and IPI sendt to all cpu's except self. Code works really well actually.
Now on a HP NC8230 (Pentium M 1.86Ghz) i get a strange error.. The computer have an LAPIC (CPUID indicates it, and MSR finds it), wich i initialize. It returns reasonable values and everything looks promising.. (Can also see the counter counting down by reading out counter value). But interrupt never fires! So no fun!
I also noticed that it has an IOAPIC. This also reports back reasonable values, but for the redirect entries it looks like only a few of them are writable..?? All the others have **STRANGE** values. Im able to reprogram KEYBOARD + PS2MOUSE, but seems that IOAPIC is not working at all..
So now my question is. Can it be that the APIC and/or IOAPIC is present but not in use? I did not find it parsing MPTABLES or ACPI.. On the NC8230 there is no MPTABLE by the way...
Anyone got an idea if it actually can be that the LAPIC is not usable on this CPU??
-
Thomas
Can LAPIC / IOAPIC be present but not usable??
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: Can LAPIC / IOAPIC be present but not usable??
If CPUID reports an APIC, then the local APIC should be usable, so the timer not firing is an unusual and interesting result. However, if the system has neither MP nor ACPI tables documenting the IO APIC, then assume there isn't one and operate the PIC in legacy mode.
Re: Can LAPIC / IOAPIC be present but not usable??
LAPICs can be disabled in software, make sure your code hasn't triggered the LAPIC software disable. Generally if you do this accidentally it'll be near the code that installs your spurious interrupt vector.
Reserved for OEM use.
Re: Can LAPIC / IOAPIC be present but not usable??
Hi,
Thanks for you replies.
I guess the IOAPIC part is ok. Checking for IOAPIC presence in MPTABLES is probably a good idea. I found out by Google that IOAPIC's was included in alot of computers while it was not properly "wired" up.. So that might be the case here.
About the APIC enabling and the spourious vector i dont think its a problem in my code. The code is pretty "static":
Its also working for all the computers except this HP NC8230 laptop.. I found some info on Google that some had Linux issues with this computer related to booting and computer loocking up in APIC timer calibration.. Sounds very much like same problem as me.. I have had no problem with Linux on that pc before, so it might require some special/careful handling while initializing it....?
If anyone have a working kernel with APIC as a multiboot image i would be more than happy to test it on this pc to see if your implementations works better than mine.. I cannot really understand why the APIC timer should not work.. easiest part of APIC...
-
Thomas
Thanks for you replies.
I guess the IOAPIC part is ok. Checking for IOAPIC presence in MPTABLES is probably a good idea. I found out by Google that IOAPIC's was included in alot of computers while it was not properly "wired" up.. So that might be the case here.
About the APIC enabling and the spourious vector i dont think its a problem in my code. The code is pretty "static":
Code: Select all
ApicWrite(apicaddr + 0x0f0, ApicRead(apicaddr + 0x0f0) | 0x100 | 0xff);
If anyone have a working kernel with APIC as a multiboot image i would be more than happy to test it on this pc to see if your implementations works better than mine.. I cannot really understand why the APIC timer should not work.. easiest part of APIC...
-
Thomas
Re: Can LAPIC / IOAPIC be present but not usable??
Hi,
I found this; http://forum.s-t-d.org/viewtopic.php?id=2572
Does not provide any solution though... Can it really be that the APIC have a bug on these HP systems? The APIC is inside the CPU chip for these so i guess it must be a Pentium M (for this model) issue maby??
Linux works well on that pc (apart from that one on the forum i guess).. I tested it with ubuntu earlier and it had APIC up and running them. Can it be that Linux used the PIT for timer source since this APIC timer was not working??
I have not looked at linux source code. Try not to do it Have made it until now but it has been painful so far. Very tempted to take a peek at the APIC timer code now i have to admit
Anyone seen anything like this before?
-
Thomas
I found this; http://forum.s-t-d.org/viewtopic.php?id=2572
Does not provide any solution though... Can it really be that the APIC have a bug on these HP systems? The APIC is inside the CPU chip for these so i guess it must be a Pentium M (for this model) issue maby??
Linux works well on that pc (apart from that one on the forum i guess).. I tested it with ubuntu earlier and it had APIC up and running them. Can it be that Linux used the PIT for timer source since this APIC timer was not working??
I have not looked at linux source code. Try not to do it Have made it until now but it has been painful so far. Very tempted to take a peek at the APIC timer code now i have to admit
Anyone seen anything like this before?
-
Thomas
Re: Can LAPIC / IOAPIC be present but not usable??
If anyone is interested;
The bug was my fault. I had hardcoded 0xfee000b0 for EOI register address of APIC. For all test computers except this one this was ok.
Why i did not find out this earlier i don't know, but the results on Google on APIC problems on timer calibration on this pc model actually lead me out on a wild goose chase after something to support this.
After a re-cap i did some step-by-step analysis of all code blocks included and ended up finding a hardcoded EOI and a commented out ApicEOI()
-
Thomas
The bug was my fault. I had hardcoded 0xfee000b0 for EOI register address of APIC. For all test computers except this one this was ok.
Why i did not find out this earlier i don't know, but the results on Google on APIC problems on timer calibration on this pc model actually lead me out on a wild goose chase after something to support this.
After a re-cap i did some step-by-step analysis of all code blocks included and ended up finding a hardcoded EOI and a commented out ApicEOI()
-
Thomas