/[grub]/grub2/boot/powerpc/ieee1275/cmain.c
ViewVC logotype

Diff of /grub2/boot/powerpc/ieee1275/cmain.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by hollisb, Mon Jan 3 17:44:25 2005 UTC revision 1.7 by hollisb, Sun May 1 03:45:35 2005 UTC
# Line 23  Line 23 
23    
24  #include <grub/machine/ieee1275.h>  #include <grub/machine/ieee1275.h>
25  #include <grub/kernel.h>  #include <grub/kernel.h>
 #include <grub/machine/init.h>  
26    
27  struct module_info  struct module_info
28  {  {
# Line 31  struct module_info Line 30  struct module_info
30    uint32_t end;    uint32_t end;
31  };  };
32    
 #define roundup(a, s) (((a) + ((s) - 1)) & ~((s) - 1))  
   
33  /* OpenFirmware entry point passed to us from the real bootloader.  */  /* OpenFirmware entry point passed to us from the real bootloader.  */
34  intptr_t (*grub_ieee1275_entry_fn) (void *);  intptr_t (*grub_ieee1275_entry_fn) (void *);
35    
36  grub_uint32_t grub_ieee1275_flags;  static grub_uint32_t grub_ieee1275_flags;
 int grub_ieee1275_realmode;  
37    
38    
39    
40    int
41    grub_ieee1275_test_flag (enum grub_ieee1275_flag flag)
42    {
43      return (grub_ieee1275_flags & (1 << flag));
44    }
45    
46    void
47    grub_ieee1275_set_flag (enum grub_ieee1275_flag flag)
48    {
49      grub_ieee1275_flags |= (1 << flag);
50    }
51    
52  static void  static void
53  find_options (void)  grub_ieee1275_find_options (void)
54  {  {
55    grub_ieee1275_phandle_t options;    grub_ieee1275_phandle_t options;
56      grub_ieee1275_phandle_t openprom;
57      int realmode;
58      int smartfw;
59    
60    grub_ieee1275_finddevice ("/options", &options);    grub_ieee1275_finddevice ("/options", &options);
61    grub_ieee1275_get_property (options, "real-mode?", &grub_ieee1275_realmode,    grub_ieee1275_get_property (options, "real-mode?", &realmode,
62                                sizeof (grub_ieee1275_realmode), 0);                                sizeof (realmode), 0);
63      if (realmode)
64        grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_REAL_MODE);
65    
66      grub_ieee1275_finddevice ("/openprom", &openprom);
67      smartfw = grub_ieee1275_get_property (openprom, "SmartFirmware-version",
68                                            0, 0, 0);
69      if (smartfw != -1)
70        grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS);
71  }  }
72    
73    void cmain (uint32_t r3, uint32_t r4, uint32_t r5);
74  /* Setup the argument vector and pass control over to the main  /* Setup the argument vector and pass control over to the main
75     function.  */     function.  */
76  void  void
# Line 68  cmain (uint32_t r3, uint32_t r4 __attrib Line 88  cmain (uint32_t r3, uint32_t r4 __attrib
88    
89        grub_ieee1275_entry_fn = (intptr_t (*)(void *)) r3;        grub_ieee1275_entry_fn = (intptr_t (*)(void *)) r3;
90    
91        grub_ieee1275_flags = GRUB_IEEE1275_NO_PARTITION_0;        grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_NO_PARTITION_0);
92    
93        /* Old World Open Firmware may use 4M-5M without claiming it.  */        /* Old World Open Firmware may use 4M-5M without claiming it.  */
94        grub_ieee1275_claim (0x00400000, 0x00100000, 0, 0);        grub_ieee1275_claim (0x00400000, 0x00100000, 0, 0);
# Line 84  cmain (uint32_t r3, uint32_t r4 __attrib Line 104  cmain (uint32_t r3, uint32_t r4 __attrib
104        grub_ieee1275_entry_fn = (intptr_t (*)(void *)) r5;        grub_ieee1275_entry_fn = (intptr_t (*)(void *)) r5;
105      }      }
106    
107    find_options ();    grub_ieee1275_find_options ();
108    
109    /* If any argument was passed to the kernel (us), they are    /* If any argument was passed to the kernel (us), they are
110       put in the bootargs property of /chosen.  The string can       put in the bootargs property of /chosen.  The string can

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26