mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 19:26:32 +00:00
A 'boot logo' of sorts to show we're about to switch to kernel mode.
We'll pass the FB address into kernel land so we can continue writing on it. svn path=/branches/powerpc/; revision=24357
This commit is contained in:
@@ -201,11 +201,31 @@ static int prom_next_node(int *nodep)
|
||||
}
|
||||
}
|
||||
|
||||
/* Appropriated from linux' btext.c
|
||||
* author:
|
||||
* Benjamin Herrenschmidt <[email protected]>
|
||||
*/
|
||||
VOID PpcVideoPrepareForReactOS() {
|
||||
int i, j, display_handle, display_size = 0;
|
||||
int i, j, k, /* display_handle, */ display_package, display_size = 0;
|
||||
int node, ret, elts;
|
||||
pci_reg_property display_regs[8];
|
||||
int device_address;
|
||||
//pci_reg_property display_regs[8];
|
||||
char type[256], path[256], name[256];
|
||||
char logo[] = {
|
||||
" "
|
||||
" XXXXXX "
|
||||
" X X "
|
||||
" X X X X "
|
||||
" X X "
|
||||
" X XXXX X "
|
||||
" X XX X "
|
||||
" X X "
|
||||
" XXXXXX "
|
||||
" "
|
||||
};
|
||||
int logo_x = 10, logo_y = 10;
|
||||
int logo_scale_x = 8, logo_scale_y = 8;
|
||||
|
||||
|
||||
for( node = ofw_finddevice("/"); prom_next_node(&node); ) {
|
||||
memset(type, 0, sizeof(type));
|
||||
@@ -231,62 +251,56 @@ VOID PpcVideoPrepareForReactOS() {
|
||||
}
|
||||
|
||||
printf("Opening display package: %s\n", path);
|
||||
|
||||
display_handle = ofw_open(path);
|
||||
|
||||
printf("display handle %x\n", display_handle);
|
||||
display_package = ofw_finddevice(path);
|
||||
printf("display package %x\n", display_package);
|
||||
|
||||
BootInfo.dispDeviceRect[0] = BootInfo.dispDeviceRect[1] = 0;
|
||||
|
||||
ofw_getprop(display_handle, "width",
|
||||
ofw_getprop(display_package, "width",
|
||||
(void *)&BootInfo.dispDeviceRect[2], sizeof(int));
|
||||
ofw_getprop(display_handle, "height",
|
||||
ofw_getprop(display_package, "height",
|
||||
(void *)&BootInfo.dispDeviceRect[3], sizeof(int));
|
||||
ofw_getprop(display_handle, "depth",
|
||||
ofw_getprop(display_package, "depth",
|
||||
(void *)&BootInfo.dispDeviceDepth, sizeof(int));
|
||||
ofw_getprop(display_handle, "linebytes",
|
||||
ofw_getprop(display_package, "linebytes",
|
||||
(void *)&BootInfo.dispDeviceRowBytes, sizeof(int));
|
||||
|
||||
if(ofw_getprop
|
||||
(display_handle,
|
||||
"address",
|
||||
(void *)&BootInfo.dispDeviceBase,
|
||||
sizeof(BootInfo.dispDeviceBase)) > 0) {
|
||||
goto finish;
|
||||
}
|
||||
BootInfo.dispDeviceRect[2] = REV(BootInfo.dispDeviceRect[2]);
|
||||
BootInfo.dispDeviceRect[3] = REV(BootInfo.dispDeviceRect[3]);
|
||||
BootInfo.dispDeviceDepth = REV(BootInfo.dispDeviceDepth);
|
||||
BootInfo.dispDeviceRowBytes = REV(BootInfo.dispDeviceRowBytes);
|
||||
|
||||
if((elts = ofw_getprop(display_handle,
|
||||
"assigned-addresses",
|
||||
(void *)display_regs,
|
||||
sizeof(display_regs))) <= 0) {
|
||||
printf("Could not get assigned addresses\n");
|
||||
if(ofw_getprop
|
||||
(display_package,
|
||||
"address",
|
||||
(void *)&device_address,
|
||||
sizeof(device_address)) < 1) {
|
||||
printf("Could not get device base\n");
|
||||
return;
|
||||
}
|
||||
|
||||
elts /= sizeof(display_regs[0]);
|
||||
for( i = 0; i < elts; i++ ) {
|
||||
display_size = display_regs[i].size_lo;
|
||||
if( display_size >= (1 << 20) ) {
|
||||
BootInfo.dispDeviceBase = (void *)display_regs[i].addr.a_lo;
|
||||
|
||||
/* Map pages for display at some location */
|
||||
BootInfo.logicalDisplayBase = (void *)0xc0000000;
|
||||
|
||||
for( i = 0; i < display_size; i += (1 << 12) ) {
|
||||
InsertPageEntry((ULONG_PTR)((PCHAR)BootInfo.logicalDisplayBase)+i,
|
||||
(ULONG_PTR)((PCHAR)BootInfo.dispDeviceBase)+i);
|
||||
}
|
||||
}
|
||||
}
|
||||
BootInfo.dispDeviceBase = (PVOID)(REV(device_address));
|
||||
|
||||
finish:
|
||||
/* Draw something ... */
|
||||
elts = 0;
|
||||
for( i = 0; i < BootInfo.dispDeviceRect[3]; i++ ) {
|
||||
for( j = 0; j < BootInfo.dispDeviceRect[2]; j++ ) {
|
||||
((PCHAR)BootInfo.logicalDisplayBase)
|
||||
[(j * (BootInfo.dispDeviceDepth/8)) +
|
||||
(i * (BootInfo.dispDeviceRowBytes))] = elts++;
|
||||
display_size = BootInfo.dispDeviceRowBytes * BootInfo.dispDeviceRect[3];
|
||||
|
||||
printf("Display size is %x bytes (%x per row times %x rows)\n",
|
||||
display_size,
|
||||
BootInfo.dispDeviceRowBytes,
|
||||
BootInfo.dispDeviceRect[3]);
|
||||
|
||||
printf("display is at %x\n", BootInfo.dispDeviceBase);
|
||||
|
||||
for( i = 0; i < logo_y * logo_scale_y; i++ ) {
|
||||
for( j = 0; j < logo_x * logo_scale_x; j++ ) {
|
||||
elts = (j/logo_scale_x) + ((i/logo_scale_y) * logo_x);
|
||||
|
||||
for( k = 0; k < BootInfo.dispDeviceDepth/8; k++ ) {
|
||||
SetPhysByte(((ULONG_PTR)BootInfo.dispDeviceBase)+
|
||||
k +
|
||||
((j * (BootInfo.dispDeviceDepth/8)) +
|
||||
(i * (BootInfo.dispDeviceRowBytes))),
|
||||
logo[elts] == ' ' ? 0 : 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,12 @@ inline int GetMSR() {
|
||||
return res;
|
||||
}
|
||||
|
||||
inline int GetDEC() {
|
||||
register int res asm ("r3");
|
||||
__asm__("mfdec 3");
|
||||
return res;
|
||||
}
|
||||
|
||||
__asm__("\t.globl GetPhys\n"
|
||||
"GetPhys:\t\n"
|
||||
"mflr 0\n\t"
|
||||
@@ -15,8 +21,12 @@ __asm__("\t.globl GetPhys\n"
|
||||
"xori 3,3,4\n\t" /* Undo effects of LE without swapping */
|
||||
"andi. 6,5,0xffef\n\t"/* turn off MSR[DR] */
|
||||
"mtmsr 6\n\t"
|
||||
"isync\n\t"
|
||||
"sync\n\t"
|
||||
"lwz 3,0(3)\n\t" /* Get actual value at phys addr r3 */
|
||||
"mtmsr 5\n\t"
|
||||
"isync\n\t"
|
||||
"sync\n\t"
|
||||
"lwz 0,0(1)\n\t"
|
||||
"addi 1,1,16\n\t"
|
||||
"mtlr 0\n\t"
|
||||
@@ -31,8 +41,35 @@ __asm__("\t.globl SetPhys\n"
|
||||
"xori 3,3,4\n\t" /* Undo effects of LE without swapping */
|
||||
"andi. 6,5,0xffef\n\t"/* turn off MSR[DR] */
|
||||
"mtmsr 6\n\t"
|
||||
"stw 4,0(3)\n\t" /* Get actual value at phys addr r3 */
|
||||
"sync\n\t"
|
||||
"eieio\n\t"
|
||||
"stw 4,0(3)\n\t" /* Set actual value at phys addr r3 */
|
||||
"dcbst 0,3\n\t"
|
||||
"mtmsr 5\n\t"
|
||||
"sync\n\t"
|
||||
"eieio\n\t"
|
||||
"mr 3,4\n\t"
|
||||
"lwz 0,0(1)\n\t"
|
||||
"addi 1,1,16\n\t"
|
||||
"mtlr 0\n\t"
|
||||
"blr"
|
||||
);
|
||||
|
||||
__asm__("\t.globl SetPhysByte\n"
|
||||
"SetPhysByte:\t\n"
|
||||
"mflr 0\n\t"
|
||||
"stwu 0,-16(1)\n\t"
|
||||
"mfmsr 5\n\t"
|
||||
"xori 3,3,7\n\t" /* Undo effects of LE without swapping */
|
||||
"andi. 6,5,0xffef\n\t"/* turn off MSR[DR] */
|
||||
"mtmsr 6\n\t"
|
||||
"sync\n\t"
|
||||
"eieio\n\t"
|
||||
"stb 4,0(3)\n\t" /* Set actual value at phys addr r3 */
|
||||
"dcbst 0,3\n\t"
|
||||
"mtmsr 5\n\t"
|
||||
"sync\n\t"
|
||||
"eieio\n\t"
|
||||
"mr 3,4\n\t"
|
||||
"lwz 0,0(1)\n\t"
|
||||
"addi 1,1,16\n\t"
|
||||
@@ -183,6 +220,7 @@ inline void SetBat( int bat, int inst, int batHi, int batLo ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
__asm__("isync\n\tsync");
|
||||
}
|
||||
|
||||
inline int GetSDR1() {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#ifndef FREELDR_MMU_H
|
||||
#define FREELDR_MMU_H
|
||||
|
||||
int GetDEC();
|
||||
int GetMSR();
|
||||
int GetPhys( int addr );
|
||||
void SetPhys( int addr, int val );
|
||||
void SetPhysByte( int addr, int val );
|
||||
int GetSR(int n);
|
||||
void GetBat( int bat, int inst, int *batHi, int *batLo );
|
||||
void SetBat( int bat, int inst, int batHi, int batLo );
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#ifndef REACTOS_PPCBOOT_H
|
||||
#define REACTOS_PPCBOOT_H
|
||||
|
||||
typedef struct _boot_infos_t {
|
||||
int dispDeviceRect[4];
|
||||
int dispDeviceRowBytes;
|
||||
int dispDeviceDepth;
|
||||
void *dispDeviceBase;
|
||||
} boot_infos_t;
|
||||
|
||||
#endif/*REACTOS_PPCBOOT_H*/
|
||||
Reference in New Issue
Block a user