ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

macharm.c
Go to the documentation of this file.
00001 /*
00002  * PROJECT:         ReactOS Boot Loader
00003  * LICENSE:         BSD - See COPYING.ARM in the top level directory
00004  * FILE:            boot/freeldr/arch/arm/marcharm.c
00005  * PURPOSE:         Provides abstraction between the ARM Boot Loader and FreeLDR
00006  * PROGRAMMERS:     ReactOS Portable Systems Group
00007  */
00008 
00009 /* INCLUDES *******************************************************************/
00010 
00011 #include <freeldr.h>
00012 #include <internal/arm/intrin_i.h>
00013 
00014 /* GLOBALS ********************************************************************/
00015 
00016 PARM_BOARD_CONFIGURATION_BLOCK ArmBoardBlock;
00017 ULONG gDiskReadBuffer, gFileSysBuffer;
00018 BOOLEAN ArmHwDetectRan;
00019 PCONFIGURATION_COMPONENT_DATA RootNode;
00020 
00021 BOOLEAN AcpiPresent = FALSE;
00022 
00023 ULONG FirstLevelDcacheSize;
00024 ULONG FirstLevelDcacheFillSize;
00025 ULONG FirstLevelIcacheSize;
00026 ULONG FirstLevelIcacheFillSize;
00027 ULONG SecondLevelDcacheSize;
00028 ULONG SecondLevelDcacheFillSize;
00029 ULONG SecondLevelIcacheSize;
00030 ULONG SecondLevelIcacheFillSize;
00031   
00032 ARC_DISK_SIGNATURE reactos_arc_disk_info;
00033 ULONG reactos_disk_count;
00034 CHAR reactos_arc_hardware_data[256];
00035 
00036 ULONG SizeBits[] =
00037 {
00038     -1,      // INVALID
00039     -1,      // INVALID
00040     1 << 12, // 4KB
00041     1 << 13, // 8KB
00042     1 << 14, // 16KB
00043     1 << 15, // 32KB
00044     1 << 16, // 64KB
00045     1 << 17  // 128KB
00046 };
00047 
00048 ULONG AssocBits[] =
00049 {
00050     -1,      // INVALID
00051     -1,      // INVALID
00052     4        // 4-way associative
00053 };
00054 
00055 ULONG LenBits[] =
00056 {
00057     -1,      // INVALID
00058     -1,      // INVALID
00059     8        // 8 words per line (32 bytes)
00060 };
00061 
00062 /* FUNCTIONS ******************************************************************/
00063 
00064 VOID
00065 ArmInit(IN PARM_BOARD_CONFIGURATION_BLOCK BootContext)
00066 {
00067     /* Remember the pointer */
00068     ArmBoardBlock = BootContext;
00069     
00070     /* Let's make sure we understand the LLB */
00071     ASSERT(ArmBoardBlock->MajorVersion == ARM_BOARD_CONFIGURATION_MAJOR_VERSION);
00072     ASSERT(ArmBoardBlock->MinorVersion == ARM_BOARD_CONFIGURATION_MINOR_VERSION);
00073     
00074     /* This should probably go away once we support more boards */
00075     ASSERT((ArmBoardBlock->BoardType == MACH_TYPE_FEROCEON) ||
00076            (ArmBoardBlock->BoardType == MACH_TYPE_VERSATILE_PB) ||
00077            (ArmBoardBlock->BoardType == MACH_TYPE_OMAP3_BEAGLE) ||
00078            (ArmBoardBlock->BoardType == MACH_TYPE_OMAP_ZOOM2));
00079 
00080     /* Call FreeLDR's portable entrypoint with our command-line */
00081     BootMain(ArmBoardBlock->CommandLine);
00082 }
00083 
00084 VOID
00085 ArmPrepareForReactOS(IN BOOLEAN Setup)
00086 {
00087     return;
00088 }
00089 
00090 BOOLEAN
00091 ArmDiskGetBootPath(OUT PCHAR BootPath,
00092                    IN unsigned Size)
00093 {
00094     PCCH Path = "ramdisk(0)";
00095     
00096     /* Make sure enough space exists */
00097     if (Size < sizeof(Path)) return FALSE;
00098     
00099     /* On ARM platforms, the loader is always in RAM */
00100     strcpy(BootPath, Path);
00101     return TRUE;
00102 }
00103 
00104 PCONFIGURATION_COMPONENT_DATA
00105 ArmHwDetect(VOID)
00106 {
00107     ARM_CACHE_REGISTER CacheReg;
00108     
00109     /* Create the root node */
00110     if (ArmHwDetectRan++) return RootNode;
00111     FldrCreateSystemKey(&RootNode);
00112     
00113     /*
00114      * TODO:
00115      * There's no such thing as "PnP" on embedded hardware.
00116      * The boot loader will send us a device tree, similar to ACPI
00117      * or OpenFirmware device trees, and we will convert it to ARC.
00118      */
00119     
00120     /* Get cache information */
00121     CacheReg = KeArmCacheRegisterGet();   
00122     FirstLevelDcacheSize = SizeBits[CacheReg.DSize];
00123     FirstLevelDcacheFillSize = LenBits[CacheReg.DLength];
00124     FirstLevelDcacheFillSize <<= 2;
00125     FirstLevelIcacheSize = SizeBits[CacheReg.ISize];
00126     FirstLevelIcacheFillSize = LenBits[CacheReg.ILength];
00127     FirstLevelIcacheFillSize <<= 2;
00128     SecondLevelDcacheSize =
00129     SecondLevelDcacheFillSize =
00130     SecondLevelIcacheSize =
00131     SecondLevelIcacheFillSize = 0;
00132     
00133     /* Register RAMDISK Device */
00134     RamDiskInitialize();
00135     
00136     /* Fill out the ARC disk block */
00137     reactos_arc_disk_info.Signature = 0xBADAB00F;
00138     reactos_arc_disk_info.CheckSum = 0xDEADBABE;
00139     reactos_arc_disk_info.ArcName = "ramdisk(0)";
00140     reactos_disk_count = 1;
00141     
00142     /* Return the root node */
00143     return RootNode;
00144 }
00145 
00146 FREELDR_MEMORY_DESCRIPTOR ArmMemoryMap[32];
00147 
00148 PFREELDR_MEMORY_DESCRIPTOR
00149 ArmMemGetMemoryMap(OUT ULONG *MemoryMapSize)
00150 {
00151     ASSERT(ArmBoardBlock->MemoryMapEntryCount <= 32);
00152 
00153     /* Return whatever the board returned to us (CS0 Base + Size and FLASH0) */
00154     for (i = 0; i < ArmBoardBlock->MemoryMapEntryCount; i++)
00155     {
00156         ArmMemoryMap[i].BasePage = ArmBoardBlock->MemoryMap[i].BaseAddress / PAGE_SIZE;
00157         ArmMemoryMap[i].PageCount = ArmBoardBlock->MemoryMap[i].Length / PAGE_SIZE;
00158         if (ArmBoardBlock->MemoryMap[i].Type == BiosMemoryUsable)
00159             ArmMemoryMap[i].MemoryType = MemoryFree;
00160         else
00161             ArmMemoryMap[i].MemoryType = MemoryFirmwarePermanent;
00162     }
00163 
00164     return ArmBoardBlock->MemoryMapEntryCount;
00165 }
00166 
00167 VOID
00168 ArmHwIdle(VOID)
00169 {
00170     /* UNIMPLEMENTED */
00171 }
00172 
00173 VOID
00174 MachInit(IN PCCH CommandLine)
00175 {
00176     /* Copy Machine Routines from Firmware Table */
00177     MachVtbl.ConsPutChar = ArmBoardBlock->ConsPutChar;
00178     MachVtbl.ConsKbHit = ArmBoardBlock->ConsKbHit;
00179     MachVtbl.ConsGetCh = ArmBoardBlock->ConsGetCh;
00180     MachVtbl.VideoClearScreen = ArmBoardBlock->VideoClearScreen;
00181     MachVtbl.VideoSetDisplayMode = ArmBoardBlock->VideoSetDisplayMode;
00182     MachVtbl.VideoGetDisplaySize = ArmBoardBlock->VideoGetDisplaySize;
00183     MachVtbl.VideoPutChar = ArmBoardBlock->VideoPutChar;
00184     MachVtbl.GetTime = ArmBoardBlock->GetTime;
00185     
00186     /* Setup board-specific ARM routines */
00187     switch (ArmBoardBlock->BoardType)
00188     {
00189         /* Check for Feroceon-base boards */
00190         case MACH_TYPE_FEROCEON:
00191             TuiPrintf("Not implemented\n");
00192             while (TRUE);
00193             break;
00194 
00195         /* Check for TI OMAP3 ZOOM-II MDK */
00196         case MACH_TYPE_OMAP_ZOOM2:
00197             
00198             /* Setup the disk and file system buffers */
00199             gDiskReadBuffer = 0x81094000;
00200             gFileSysBuffer = 0x81094000;
00201             break;
00202             
00203         /* Check for ARM Versatile PB boards */
00204         case MACH_TYPE_VERSATILE_PB:
00205             
00206             /* Setup the disk and file system buffers */
00207             gDiskReadBuffer = 0x00090000;
00208             gFileSysBuffer = 0x00090000;
00209             break;
00210             
00211         /* Check for TI OMAP3 Beagleboard */
00212         case MACH_TYPE_OMAP3_BEAGLE:
00213             TuiPrintf("Not implemented\n");
00214             while (TRUE);
00215             break;
00216             
00217         default:
00218             ASSERT(FALSE);
00219     }
00220     
00221     /* Setup generic ARM routines for all boards */
00222     MachVtbl.PrepareForReactOS = ArmPrepareForReactOS;
00223     MachVtbl.GetMemoryMap = ArmMemGetMemoryMap;
00224     MachVtbl.HwDetect = ArmHwDetect;
00225     MachVtbl.DiskGetBootPath = ArmDiskGetBootPath;
00226     MachVtbl.HwIdle = ArmHwIdle;
00227 }

Generated on Sat May 26 2012 04:17:52 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.