[coreboot] [RFC] UBRX v0.2

Pete Batard pete at akeo.ie
Tue Jul 26 19:33:28 CEST 2011


> On 2011.07.18 04:14, Scott Duplichan wrote:
>> I have an AMD SB900 board with Nuvoton NCT6776F. To make the serial port
>> work on this board, two pieces of non-generic code are needed.

As promised, I have now updated UBRX to support SB900 boards and 
NCT6776F SIOs.

As for the SB800, the SB900 init is currently not enabled by default and 
must be selected with a build option. It is also very much untested. 
While adding SB900 support, I also found a bug with regards to the SB800 
init, where DS was used instead of ES, which leaves me quite surprised 
the previous 48 MHz init actually worked at all...

With regards to the NCT6776F extra init, it is handled enirely from a 
data section, currently residing in bios.S, which goes something like this:

special_init:
   # WinBond W83977TF (example)
#  .word 0xffff  # PnP chip ID mask
#  .word 0x9773  # PnP chip ID (big endian format: [0x20][0x21])
#  .byte 0x22    # PnP register index
#  .byte 0xfe    # AND mask to apply (clear bits - here, clear bit 0)
#  .byte 0x30    # OR value to apply (set bits - here, set bits 4&5)
#  .byte 0xff    # end of section
   # The Nuvoton NCT6776F defaults with Serial A & B disabled => enable them
   .word 0xffff
   .word 0xc333  # NCT6776F chip ID
   .byte 0x2a    # Multi Function Selection register
   .byte 0x1f    # bit 7, 6 & 5 cleared => Serial A & B enabled
   .byte 0x00
   .byte 0xff    # end of section
special_init_end:

I believe this approach should make it easy enough to add other PnP SIO 
special inits. The big question of course is how many of those will be 
required...


Finally, to make UBRX a bit more interesting as a panic room, I have 
added a "RISC" script mode to the console, aimed at being used primarily 
for CAR setup. It offers the following commands [1]:

? - dump accumulator:
   Display the current value of EAX in hexascii (32 bit).
$ <hex value>  - assign immediate:
   Assign an immediate 32 bit hexascii value to EAX. Leading zeroes can
   be omitted.
a/b/c/d - move accumulator to register:
   Move the current value of EAX into CR0/EBX/ECX/EDX respectively.
A/B/C/D - move register to accumulator:
   Move the current value of CR0/EBX/ECX/EDX into EAX.
p/q/r - output to port
   Move AL(byte)/AX(word)/EAX(longword) to the port indexed by DX.
P/Q/R - input from port
   Move the current byte/word/longword value of the port indexed by DX to
   AL/AX/EAX respectively.
x/y/z - move accumulator to memory
   Move AL(byte)/AX(word)/EAX(longword) to the 32 bit memory location
   indexed by EDX.
X/Y/Z - move from memory to accumulator
   Move the byte/word/longword value of the 32 bit memory location
   indexed by EDX into AL/AX/EAX respectively.
# - cpuid
   Issue the CPUID instruction. The current values of EAX will be used
   for the index. The returned values can be accessed in EAX/EBX/ECX/EDX.
! - invd
   Invalidate (flush) internal cache
m - write to MSR
   Write the 64 bit value from EDX:EAX into the Model Specific Register
   indexed by ECX.
M - read from MSR
   Read the 64 bit value from the Model Specific Register indexed by ECX
   into EDX:EAX.
. - exit script mode and return to main prompt.

Theoretically, the above instructions should provide everything needed 
for CAR setup. And with a jump call ('r' from the main prompt) that uses 
the last EAX/EBX from script mode as CS:IP/SS:SP, one may actually be 
able to use the current script mode to transfer and run a complete 
binary from CAR, though, it is likely to be very impractical right now, 
especially with no handshaking in place for pasting scripts.

However if you want to poke around ports or memory prior to init, this 
early _alpha_ of UBRX may be of help.

To obtain the latest version, visit http://code.google.com/p/akeo/
As usual, test reports and/or comments will be much appreciated, 
regardless of the x86 hardware being used.

Regards,

/Pete

[1] http://code.google.com/p/akeo/source/browse/ubrx/USAGE




More information about the coreboot mailing list