Fixed support for disk and filesystem. We're reading files normally.
authorArt Yerkes <art.yerkes@gmail.com>
Tue, 29 Aug 2006 06:28:13 +0000 (06:28 +0000)
committerArt Yerkes <art.yerkes@gmail.com>
Tue, 29 Aug 2006 06:28:13 +0000 (06:28 +0000)
Now working on display modes and character input.

svn path=/branches/powerpc/; revision=23764

reactos/boot/freeldr/bootsect/ofw_util.s
reactos/boot/freeldr/freeldr/arch/powerpc/mach.c
reactos/boot/freeldr/freeldr/fs/fs.c
reactos/boot/freeldr/freeldr/include/arch.h
reactos/boot/freeldr/freeldr/include/of.h
reactos/tools/ofw_interface/calls.ofw

index d4abe5e..7e0aa84 100644 (file)
@@ -50,7 +50,8 @@ call_ofw:
        mr      %r5,%r6
        mr      %r6,%r7
        mr      %r7,%r8
-
+       mr      %r8,%r9
+       
        /* Goto the swapped function */
        bctrl
 
index 60f1a6f..c2097a0 100644 (file)
@@ -169,11 +169,16 @@ VOID PpcVideoPrepareForReactOS() {
  */
 ULONG PpcGetMemoryMap( PBIOS_MEMORY_MAP BiosMemoryMap,
                        ULONG MaxMemoryMapSize ) {
-    int i, memhandle, returned, total = 0, num_mem = 0;
+    int i, memhandle, mmuhandle, returned, total = 0, num_mem = 0;
     int memdata[256];
 
+    printf("PpcGetMemoryMap(%d)\n", MaxMemoryMapSize);
+
     ofw_getprop(chosen_package, "memory", 
                (char *)&memhandle, sizeof(memhandle));
+    ofw_getprop(chosen_package, "mmu",
+               (char *)&mmuhandle, sizeof(mmuhandle));
+
     returned = ofw_getprop(memhandle, "available", 
                           (char *)memdata, sizeof(memdata));
 
@@ -188,6 +193,10 @@ ULONG PpcGetMemoryMap( PBIOS_MEMORY_MAP BiosMemoryMap,
            BiosMemoryMap[num_mem].Length = TOTAL_HEAP_NEEDED;       
            ofw_claim(BiosMemoryMap[num_mem].BaseAddress, 
                      BiosMemoryMap[num_mem].Length, 0x1000); /* claim it */
+           printf("virt2phys(%x)->%x\n",
+                  BiosMemoryMap[num_mem].BaseAddress,
+                  ofw_virt2phys
+                  (mmuhandle, BiosMemoryMap[num_mem].BaseAddress));
            total += BiosMemoryMap[0].Length;
            num_mem++;
        }
@@ -237,7 +246,7 @@ BOOLEAN PpcDiskBootingFromFloppy(VOID) {
 }
 
 BOOLEAN PpcDiskReadLogicalSectors( ULONG DriveNumber, ULONGLONG SectorNumber,
-                                ULONG SectorCount, PVOID Buffer ) {
+                                  ULONG SectorCount, PVOID Buffer ) {
     int rlen = 0;
 
     if( part_handle == -1 ) {
@@ -254,11 +263,13 @@ BOOLEAN PpcDiskReadLogicalSectors( ULONG DriveNumber, ULONGLONG SectorNumber,
        return FALSE;
     }
 
-    if( ofw_seek( part_handle, SectorNumber * 512 ) ) {
-       printf("Seek to %x failed\n", SectorNumber * 512);
+    if( ofw_seek( part_handle, 
+                  (ULONG)(SectorNumber >> 25), 
+                  (ULONG)((SectorNumber * 512) & 0xffffffff) ) ) {
+       printf("Seek to %x failed\n", (ULONG)(SectorNumber * 512));
        return FALSE;
     }
-    rlen = ofw_read( part_handle, Buffer, SectorCount * 512 );
+    rlen = ofw_read( part_handle, Buffer, (ULONG)(SectorCount * 512) );
     return rlen > 0;
 }
 
@@ -293,15 +304,25 @@ VOID PpcHwDetect() {
 typedef unsigned int uint32_t;
 
 void PpcInit( of_proxy the_ofproxy ) {
-    int len;
+    int len, stdin_handle_chosen;
     ofproxy = the_ofproxy;
 
-    ofw_print_string("Made it into freeldr LE code ... bootstrap complete\n");
+    ofw_print_string("Freeldr PowerPC Init\n");
 
     chosen_package = ofw_finddevice( "/chosen" );
 
+    ofw_print_string("Freeldr: chosen_package is ");
+    ofw_print_number(chosen_package);
+    ofw_print_string("\n");
+
     ofw_getprop( chosen_package, "stdin",
-                 (char *)&stdin_handle, sizeof(stdin_handle) );
+                 (char *)&stdin_handle_chosen, sizeof(stdin_handle_chosen) );
+
+    ofw_print_string("Freeldr: stdin_handle is ");
+    ofw_print_number(stdin_handle_chosen);
+    ofw_print_string("\n");
+
+    stdin_handle = stdin_handle_chosen;
 
     /* stdin_handle = REV(stdin_handle); */
 
index f4595a6..f7116b9 100644 (file)
@@ -27,6 +27,7 @@
 /////////////////////////////////////////////////////////////////////////////////////////////
 
 ULONG                  FsType = 0;     // Type of filesystem on boot device, set by FsOpenVolume()
+PVOID                   FsStaticBufferDisk = 0, FsStaticBufferData = 0;
 
 /////////////////////////////////////////////////////////////////////////////////////////////
 // FUNCTIONS
@@ -51,8 +52,20 @@ static BOOLEAN FsOpenVolume(ULONG DriveNumber, ULONGLONG StartSector, ULONGLONG
 {
        CHAR ErrorText[80];
 
+       printf("FsOpenVolume: (disk=%d,start=%d,count=%d,type=%d)\n",
+              DriveNumber, StartSector, SectorCount, Type);
+
        FsType = Type;
 
+       if( !FsStaticBufferDisk )
+           FsStaticBufferDisk = MmAllocateMemory( 0x20000 );
+       if( !FsStaticBufferDisk )
+       {
+               FileSystemError("could not allocate filesystem static buffer");
+               return FALSE;
+       }
+       FsStaticBufferData = ((PCHAR)FsStaticBufferDisk) + 0x10000;
+           
        switch (FsType)
        {
        case FS_FAT:
index 037f1cf..c92c4c9 100644 (file)
 #define STACK16ADDR    0x7000  /* The 16-bit stack top will be at 0000:7000 */
 #define STACK32ADDR    0x78000 /* The 32-bit stack top will be at 7000:8000, or 0x78000 */
 
+#ifdef _M_IX86
 #define BIOSCALLBUFFER         0x78000 /* Buffer to store temporary data for any Int386() call */
 #define BIOSCALLBUFSEGMENT     0x7800  /* Buffer to store temporary data for any Int386() call */
 #define BIOSCALLBUFOFFSET      0x0000  /* Buffer to store temporary data for any Int386() call */
 #define FILESYSBUFFER          0x80000 /* Buffer to store file system data (e.g. cluster buffer for FAT) */
 #define DISKREADBUFFER         0x90000 /* Buffer to store data read in from the disk via the BIOS */
+#elif defined(_M_PPC)
+extern PVOID FsStaticBufferDisk, FsStaticBufferData;
+#define DISKREADBUFFER         FsStaticBufferDisk
+#define FILESYSBUFFER           FsStaticBufferData
+#endif
 
 /* Makes "x" a global variable or label */
 #define EXTERN(x)      .global x; x:
index 22170c9..8f96755 100644 (file)
@@ -10,7 +10,7 @@
 #include <string.h>
 
 typedef int (*of_proxy)
-    ( int table_off, void *arg1, void *arg2, void *arg3, void *arg4, void *arg5 );
+    ( int table_off, void *arg1, void *arg2, void *arg3, void *arg4, void *arg5, void *arg6 );
 typedef long jmp_buf[100];
 extern of_proxy ofproxy;
 extern void le_swap( void *begin, void *end, void *dest );
index 31f1b8d..4bbab90 100644 (file)
@@ -8,7 +8,7 @@ read                    3       1       int char*:arg2 int int
 exit                   0       0       
 child                  1       1       int int
 peer                   1       1       int int
-seek                   2       1       int int int
+seek                   3       1       int int int int
 # MMU methods 
 # claim (virt size align -- base)
 claim                  3       1       int int int int