Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boot: Add 1BL initialization for ROM less southbridges #52

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

haxar
Copy link
Contributor

@haxar haxar commented Feb 4, 2021

Translate X-codes to C code to do 1BL initialization for ROM less southbridges, while also keeping X-codes for MCPX X3 southbridges. This makes it possible to use a southbridge (e.g. MCPX X2) that does not contain such interpreter.

May fix #18.

PR left as draft as this is not tested on every mainboard revision, including MCPX X2. Confirmed working on Xbox v1.0 w/ Conexant & xemu.

@haxar haxar changed the title boot: Translate X-codes to C in BootSystemInitialization() boot: Translate X-codes to C code for basic system initialization Feb 4, 2021
@GXTX
Copy link
Contributor

GXTX commented Feb 13, 2022

Tested this on X2 hardware. Just causes a frag. Board is a debug 1.1 basically.

@Prehistoricman
Copy link

In theory, how does the visor trick work when RAM is not yet initialised by Xcodes?

@haxar
Copy link
Contributor Author

haxar commented Jul 20, 2022

Yes, the visor overflow trick won't work since RAM is not initialized yet, so I have pursued another idea to bypass the proprietary X-code interpreter, which is pulling A20M# low at reset.

That idea is currently being implemented in my QPI fork of OpenXenium, which is using modern Winbond SPI flash in QPI mode, as a 1:1 bridge to the LPC bus, by using an FPGA instead of a very limited CPLD, with an added MOSFET to pull A20M# on the CPU low at reset.

Closing this PR as the trick will not work, and hardware initialization will be implemented this way (with possibly a coreboot or barebox port).

EDIT: This comment is only applicable to MCPX X3 southbridges & PR is missing 1BL initialization for X2 southbridges.

@haxar haxar closed this Jul 20, 2022
@haxar
Copy link
Contributor Author

haxar commented Jul 20, 2022

The visor overflow trick is not necessary for MCPX X2 southbridges, where there is no 1BL ROM, and behaves like a typical nForce chipset, and will just execute from the LPC bus (or primarily TSOP for Xbox). For MCPX X3 southbridges, the ROM is there & this PR won't be applicable (or will apply if A20M# is pulled low at reset via my OX QPI fork).

Just realizing that there is no reset vector code in Cromwell to do 1BL initialization & this PR is missing that, which #18 addresses, and why this PR in its current state did not work on @GXTX's X2 hardware.

Here's what the Cromwell image at the reset vector is currently & needs fixing:

$ objdump -DMintel -bbinary -mi386 --start-address=0x3fff0 cromwell.bin

cromwell.bin:     file format binary


Disassembly of section .data:

0003fff0 <.data+0x3fff0>:
   3fff0:	50                   	push   eax
   3fff1:	4c                   	dec    esp
   3fff2:	b3 c7                	mov    bl,0xc7
   3fff4:	e2 13                	loop   0x40009
   3fff6:	70 fc                	jo     0x3fff4
   3fff8:	32 55 29             	xor    dl,BYTE PTR [ebp+0x29]
   3fffb:	76 0c                	jbe    0x40009
   3fffd:	a8 ae                	test   al,0xae
   3ffff:	41                   	inc    ecx

This apparently needed some clarification & it's been a while since I've looked at this PR. It would probably be better for this PR to keep the X-codes for X3 southbridges, while having support for X2 (and possibly nForce) southbridges.

@haxar haxar reopened this Jul 20, 2022
@haxar haxar changed the title boot: Translate X-codes to C code for basic system initialization boot: Add basic system initialization for MCPX X2 southbridges Jul 20, 2022
@haxar
Copy link
Contributor Author

haxar commented Jul 21, 2022

The above mentioned objdump is the end/top of the Cromwell image of an MD5 sum part of a 64 byte struct BiosIdentifier that is written by writeBiosIdentifier() in imagebld.c during build.

This will have to change to accommodate a jump from the reset vector to a page that is before the 512 byte 1BL ROM, to do 1BL initialization, pull A20M# high (if using my OX QPI fork), set protected mode, then do translated X-code initialization of RAM.

@haxar haxar changed the title boot: Add basic system initialization for MCPX X2 southbridges boot: Add basic system initialization for 1BL ROM less southbridges Jul 26, 2022
@haxar haxar changed the title boot: Add basic system initialization for 1BL ROM less southbridges boot: Add 1BL initialization for ROM less southbridges Jul 26, 2022
@haxar haxar force-pushed the xcodes-to-c branch 2 times, most recently from e276f11 to f1ad8cf Compare August 9, 2022 20:46
@Ernegien
Copy link
Member

Ernegien commented Oct 23, 2022

Works great on a 1.0 Retail (MCPX X3), 1.0 Debug (MCPX X2), and 1.2 Debug (MCPX X2).

cromwell_1024.zip

Retail 1 0 Screenshot 2022-10-22 19-43-17
IMG_3078
Debug 1 0 Screenshot 2022-10-22 19-49-41
IMG_3080
Debug 1 2 Screenshot 2022-10-22 19-56-03

@Mrpilos
Copy link

Mrpilos commented Nov 17, 2023

Hello, how can I remove this bios from an Aladdin chip and put another one.
I try it through CD and it doesn't recognize it and neither does DHCP.

I need to remove the Cromwell bios.

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Fails to boot without Xcode Interpreter (MCPX X2 case)
5 participants