[haiku-commits] r42460 - haiku/trunk/src/system/boot/platform/openfirmware

  • From: kallisti5@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 21 Jul 2011 03:44:45 +0200 (CEST)

Author: kallisti5
Date: 2011-07-21 03:44:45 +0200 (Thu, 21 Jul 2011)
New Revision: 42460
Changeset: https://dev.haiku-os.org/changeset/42460

Modified:
   haiku/trunk/src/system/boot/platform/openfirmware/start.cpp
Log:
* Remove a few superfluous spaces
* Style fixes as per Axel
* Reintroduce removed OF_FAIL checks


Modified: haiku/trunk/src/system/boot/platform/openfirmware/start.cpp
===================================================================
--- haiku/trunk/src/system/boot/platform/openfirmware/start.cpp 2011-07-20 
20:31:32 UTC (rev 42459)
+++ haiku/trunk/src/system/boot/platform/openfirmware/start.cpp 2011-07-21 
01:44:45 UTC (rev 42460)
@@ -39,10 +39,10 @@
 
 static void
 call_ctors(void)
-{ 
+{
        void (**f)(void);
 
-       for (f = &__ctor_list; f < &__ctor_end; f++) {          
+       for (f = &__ctor_list; f < &__ctor_end; f++) {
                (**f)();
        }
 }
@@ -55,35 +55,40 @@
 }
 
 
-static void 
+static void
 determine_machine(void)
 {
        gMachine = MACHINE_UNKNOWN;
 
        int root = of_finddevice("/");
        char buffer[64];
+       int length;
 
        // TODO : Probe other OpenFirmware platforms and set gMachine as needed
 
-       int length = of_getprop(root, "device_type", buffer, sizeof(buffer) - 
1);
-       buffer[length] = '\0';
-
-       if (!strcasecmp("chrp", buffer))
-               gMachine = MACHINE_CHRP;
-       else //(bootrom) + QEMU
+       if ((length = of_getprop(root, "device_type", buffer, sizeof(buffer) - 
1))
+               != OF_FAILED) {
+               buffer[length] = '\0';
+               if (!strcasecmp("chrp", buffer))
+                       gMachine = MACHINE_CHRP;
+               else if (!strcasecmp("bootrom", buffer))
+                       gMachine = MACHINE_MAC;
+       } else
                gMachine = MACHINE_MAC;
-               
-       length = of_getprop(root, "model", buffer, sizeof(buffer) - 1);
-       buffer[length] = '\0';
 
-       if (!strcasecmp("pegasos", buffer))
-               gMachine |= MACHINE_PEGASOS;
+       if ((length = of_getprop(root, "model", buffer, sizeof(buffer) - 1))
+               != OF_FAILED) {
+               buffer[length] = '\0';
+               if (!strcasecmp("pegasos", buffer))
+                       gMachine |= MACHINE_PEGASOS;
+       }
 
-       length = of_getprop(root, "name", buffer, sizeof(buffer) - 1);
-       buffer[length] = '\0';
-
-       if (!strcasecmp("openbiosteam,openbios", buffer))
-               gMachine |= MACHINE_QEMU;
+       if ((length = of_getprop(root, "name", buffer, sizeof(buffer) - 1))
+               != OF_FAILED) {
+               buffer[length] = '\0';
+               if (!strcasecmp("openbiosteam,openbios", buffer))
+                       gMachine |= MACHINE_QEMU;
+       }
 }
 
 
@@ -97,7 +102,7 @@
        printf("kernel entry at %p\n", (void*)kernelEntry);
        printf("kernel stack top: %p\n", (void*)stackTop);
 
-       /* TODO: ? 
+       /* TODO: ?
        mmu_init_for_kernel();
        smp_boot_other_cpus();
        */
@@ -159,9 +164,9 @@
        determine_machine();
        console_init();
 
-       if (gMachine & MACHINE_QEMU)
+       if ((gMachine & MACHINE_QEMU) != 0)
                dprintf("OpenBIOS (QEMU?) OpenFirmware machine detected\n");
-       else if (gMachine & MACHINE_PEGASOS)
+       else if ((gMachine & MACHINE_PEGASOS) != 0)
                dprintf("Pegasos PowerPC machine detected\n");
        else
                dprintf("Apple PowerPC machine assumed\n");


Other related posts:

  • » [haiku-commits] r42460 - haiku/trunk/src/system/boot/platform/openfirmware - kallisti5