Skip to contentSkip to conversation

PowerPC reset vector?

Qemu-devel Blue Swirl 4 participants 6 messages Dec 7, 2008

lore
Share & tools
lore

Blue Swirl

author
#0 lore raw

Hi,

Currently PPC hard reset vector is 0xfffffffc for most cases. I can't find this vector in the few PPC docs I have. Instead all docs point to 0x00100 + base, where base can be 0xfff00000 or zero. Is the vector correct?

OHW seems to depend on this extra vector, so if we change it, there may need to be some kind of compatibility hacks to let it work.

Background: Laurent Vivier and I are trying to get OpenBIOS to work on PPC.

#1 lore raw
Quoted 1 line · Blue Swirl

Hi,

Hi!

Quoted 4 lines

Currently PPC hard reset vector is 0xfffffffc for most cases. I can't find this vector in the few PPC docs I have. Instead all docs point to 0x00100 + base, where base can be 0xfff00000 or zero. Is the vector correct?

According to the PowerISA manual, the reset exception vector is the one you define. However on power-up, the CPU does not jump to the reset exception vector but instead:
- initialize msr
- empty all TLB
- create a boot TLB that maps the last 4kB page in the implemented effective storage address space that maps to the last 4kB page of the physical address space
- start execution of instruction at the last word address of the page mapped by the boot TLB entry.

Quoted 2 lines

OHW seems to depend on this extra vector, so if we change it, there may need to be some kind of compatibility hacks to let it work.

OHW seems to follow exactly what is mapped in a real processor. OTOH, as qemu and the firmware are coupled, we can probably decide that the processor starts at the reset exception vector.

Quoted 1 line

Background: Laurent Vivier and I are trying to get OpenBIOS to work on PPC.

Nice work. I am following the progress on openbios-devel. How close are you to have a basic version working?

Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net
author
#2 lore raw
Quoted 11 lines · Aurelien Jarno
Quoted 1 line · Blue Swirl

Hi,

Hi!

Quoted 4 lines

Currently PPC hard reset vector is 0xfffffffc for most cases. I can't find this vector in the few PPC docs I have. Instead all docs point to 0x00100 + base, where base can be 0xfff00000 or zero. Is the vector correct?

Quoted 10 lines

According to the PowerISA manual, the reset exception vector is the one
you define. However on power-up, the CPU does not jump to the reset exception vector but instead:
- initialize msr
- empty all TLB
- create a boot TLB that maps the last 4kB page in the implemented effective storage address space that maps to the last 4kB page of the physical address space
- start execution of instruction at the last word address of the page mapped by the boot TLB entry.

OK, I missed that part (Book III E, chapter 6.3 in PowerISA 2.05).

Quoted 9 lines
Quoted 2 lines

OHW seems to depend on this extra vector, so if we change it, there may need to be some kind of compatibility hacks to let it work.

OHW seems to follow exactly what is mapped in a real processor. OTOH, as
qemu and the firmware are coupled, we can probably decide that the processor starts at the reset exception vector.

Quoted 5 lines
Quoted 1 line

Background: Laurent Vivier and I are trying to get OpenBIOS to work on PPC.

Nice work. I am following the progress on openbios-devel. How close are
you to have a basic version working?

I get some output in the console in some cases ;-), Laurent has better versions.

#3 lore raw
Quoted 10 lines · Blue Swirl
Quoted 7 lines · Aurelien Jarno
Quoted 2 lines · Blue Swirl

Background: Laurent Vivier and I are trying to get OpenBIOS to work on PPC.

Nice work. I am following the progress on openbios-devel. How close are you to have a basic version working?

I get some output in the console in some cases ;-), Laurent has better versions.

I 've a very messy patch that allows me to load yaboot and then to load and start a linux kernel.
But kernel hangs immediately when it tries to create the flattened device tree (OF memory management is broken with qemu)

Laurent
----------------------- Laurent Vivier ---------------------- "The best way to predict the future is to invent it."
- Alan Kay

#4 lore raw
In reply to Aurelien Jarno
Quoted 9 lines · Aurelien Jarno
Quoted 1 line · Blue Swirl

Hi,

Hi!

Quoted 4 lines

Currently PPC hard reset vector is 0xfffffffc for most cases. I can't find this vector in the few PPC docs I have. Instead all docs point to 0x00100 + base, where base can be 0xfff00000 or zero. Is the vector correct?

Quoted 10 lines

According to the PowerISA manual, the reset exception vector is the one you define. However on power-up, the CPU does not jump to the reset exception vector but instead:
- initialize msr
- empty all TLB
- create a boot TLB that maps the last 4kB page in the implemented effective storage address space that maps to the last 4kB page of the physical address space
- start execution of instruction at the last word address of the page mapped by the boot TLB entry.

Hang on, that's not the whole story.

There are a number of supervisor-level difference between server (now called "Book III-S") and embedded ("Book III-E") PowerPC, and this is one of them. The behavior you describe is true for Book E, and also happens to be true for 405 (which predates Book E and is not similar in other respects).

However, it is *not* true for "classic" or "server" PowerPC, such as 604 or 970. Those processors reset as Blue described, with the NIP at 0xfff00100. (Actually, I think some may do even different things, like start at 0xfff00000, but I'm not sure.)

Since qemu emulates both types of PowerPC, the reset vector must not be hardcoded.

-Hollis

author
#5 lore raw
Quoted 30 lines · Hollis Blanchard
Quoted 9 lines · Aurelien Jarno
Quoted 1 line · Blue Swirl

Hi,

Hi!

Quoted 4 lines

Currently PPC hard reset vector is 0xfffffffc for most cases. I can't find this vector in the few PPC docs I have. Instead all docs point to 0x00100 + base, where base can be 0xfff00000 or zero. Is the vector correct?

Quoted 10 lines

According to the PowerISA manual, the reset exception vector is the one you define. However on power-up, the CPU does not jump to the reset exception vector but instead:
- initialize msr
- empty all TLB
- create a boot TLB that maps the last 4kB page in the implemented effective storage address space that maps to the last 4kB page of the physical address space
- start execution of instruction at the last word address of the page mapped by the boot TLB entry.

Hang on, that's not the whole story.

There are a number of supervisor-level difference between server (now called "Book III-S") and embedded ("Book III-E") PowerPC, and this is one of them. The behavior you describe is true for Book E, and also happens to be true for 405 (which predates Book E and is not similar in other respects).

Quoted 4 lines

However, it is *not* true for "classic" or "server" PowerPC, such as 604 or 970. Those processors reset as Blue described, with the NIP at 0xfff00100. (Actually, I think some may do even different things, like start at 0xfff00000, but I'm not sure.)

PowerISA actually only mentions zero-based reset vector. This is also possible (Sparc32 boots at address 0 with only boot ROM visible), but then there should be a way to switch to RAM early (like before PCI probe).

Quoted 2 lines

Since qemu emulates both types of PowerPC, the reset vector must not be hardcoded.

It should be possible to handle all three cases (0xfff00100, 0xfffffffc, 0x00000100) with one ROM image.