Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/amigappc/amigappc Some code cleanup and style guide...



details:   https://anonhg.NetBSD.org/src/rev/53ea6e7c1c91
branches:  trunk
changeset: 755054:53ea6e7c1c91
user:      phx <phx%NetBSD.org@localhost>
date:      Fri May 21 12:52:14 2010 +0000

description:
Some code cleanup and style guide compliance.

diffstat:

 sys/arch/amigappc/amigappc/autoconf.c |  62 ++++++++++-------------
 sys/arch/amigappc/amigappc/machdep.c  |  91 +++++++++++++++++-----------------
 sys/arch/amigappc/amigappc/mainbus.c  |  26 ++-------
 3 files changed, 79 insertions(+), 100 deletions(-)

diffs (truncated from 503 to 300 lines):

diff -r cc77ced91541 -r 53ea6e7c1c91 sys/arch/amigappc/amigappc/autoconf.c
--- a/sys/arch/amigappc/amigappc/autoconf.c     Fri May 21 11:59:38 2010 +0000
+++ b/sys/arch/amigappc/amigappc/autoconf.c     Fri May 21 12:52:14 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.2 2010/02/02 19:15:33 phx Exp $ */
+/*     $NetBSD: autoconf.c,v 1.3 2010/05/21 12:52:14 phx Exp $ */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.2 2010/02/02 19:15:33 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.3 2010/05/21 12:52:14 phx Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -42,15 +42,16 @@
 #include <sys/disklabel.h>
 #include <sys/disk.h>
 #include <sys/proc.h>
+#include <sys/kernel.h>
+
 #include <machine/cpu.h>
+
 #include <amiga/amiga/cfdev.h>
 #include <amiga/amiga/device.h>
 #include <amiga/amiga/custom.h>
 
 static void findroot(void);
 
-#include <sys/kernel.h>
-
 u_long boot_partition;
 
 int amiga_realconfig;
@@ -61,6 +62,7 @@
 void
 cpu_configure(void)
 {
+
        /*
         * this is the real thing baby (i.e. not console init)
         */
@@ -101,7 +103,7 @@
 simple_devprint(void *auxp, const char *pnp)
 {
 
-       return(QUIET);
+       return QUIET;
 }
 
 int
@@ -111,10 +113,10 @@
 
        len = strlen(fp);
        if (strlen(sp) != len)
-               return(0);
+               return 0;
        if (bcmp(fp, sp, len) == 0)
-               return(1);
-       return(0);
+               return 1;
+       return 0;
 }
 
 /*
@@ -132,7 +134,7 @@
        const struct cfattach *ca;
 
        if (amiga_realconfig)
-               return(config_found(pdp, auxp, pfn) != NULL);
+               return config_found(pdp, auxp, pfn) != NULL;
 
        if (pdp == NULL) {
                memset(&temp, 0, sizeof temp);
@@ -148,11 +150,11 @@
                if (ca != NULL) {
                        (*ca->ca_attach)(pdp, NULL, auxp);
                        pdp->dv_cfdata = NULL;
-                       return(1);
+                       return 1;
                }
        }
        pdp->dv_cfdata = NULL;
-       return(0);
+       return 0;
 }
 
 /*
@@ -171,15 +173,8 @@
         * we need mainbus' cfdata.
         */
        cf = config_rootsearch(NULL, "mainbus", NULL);
-       if (cf == NULL) {
+       if (cf == NULL)
                panic("no mainbus");
-       }
-#if 0 /* XXX doesn't exist on amigappc */
-       /*
-        * delay clock calibration.
-        */
-       amiga_config_found(cf, NULL, __UNCONST("clock"), NULL);
-#endif
 
        /*
         * internal grf.
@@ -373,7 +368,6 @@
  * realtime clock and scsi controller, so that this hardware is only
  * included as "configured" if this IS an A3000
  */
-
 int a3000_flag = 1;            /* patchable */
 #ifdef A4000
 int a4000_flag = 1;            /* patchable - default to A4000 */
@@ -389,14 +383,14 @@
        short sc;
 
        if ((machineid >> 16) == 3000)
-               return (1);                     /* It's an A3000 */
+               return 1;                       /* It's an A3000 */
        if (machineid >> 16)
-               return (0);                     /* It's not an A3000 */
+               return 0;                       /* It's not an A3000 */
        /* Machine type is unknown, so try to guess it */
        /* where is fastram on the A4000 ?? */
        /* if fastram is below 0x07000000, assume it's not an A3000 */
        if (boot_fphystart < 0x07000000)
-               return(0);
+               return 0;
        /*
         * OK, fastram starts at or above 0x07000000, check specific
         * machines
@@ -407,23 +401,23 @@
                        switch (cfdev[sc].rom.prodid) {
                        case 0:         /* PPI Mercury - A3000 */
                        case 1:         /* PP&S A3000 '040 */
-                               return(1);
+                               return 1;
                        case 150:       /* PPI Zeus - it's an A2000 */
                        case 105:       /* PP&S A2000 '040 */
                        case 187:       /* PP&S A500 '040 */
-                               return(0);
+                               return 0;
                        }
                        break;
 
                case 2112:                      /* IVS */
                        switch (cfdev[sc].rom.prodid) {
                        case 242:
-                               return(0);      /* A2000 accelerator? */
+                               return 0;       /* A2000 accelerator? */
                        }
                        break;
                }
        }
-       return (a3000_flag);            /* XXX let flag tell now */
+       return a3000_flag;              /* XXX let flag tell now */
 }
 
 int
@@ -431,19 +425,19 @@
 {
 
        if ((machineid >> 16) == 4000)
-               return (1);             /* It's an A4000 */
+               return 1;               /* It's an A4000 */
        if ((machineid >> 16) == 1200)
-               return (0);             /* It's an A1200, so not A4000 */
+               return 0;               /* It's an A1200, so not A4000 */
        /* Do I need this any more? */
        if ((custom.deniseid & 0xff) == 0xf8)
-               return (1);
+               return 1;
 #ifdef DEBUG
        if (a4000_flag)
                printf("Denise ID = %04x\n", (unsigned short)custom.deniseid);
 #endif
        if (machineid >> 16)
-               return (0);             /* It's not an A4000 */
-       return (a4000_flag);            /* Machine type not set */
+               return 0;               /* It's not an A4000 */
+       return a4000_flag;              /* Machine type not set */
 }
 
 int
@@ -451,6 +445,6 @@
 {
 
        if ((machineid >> 16) == 1200)
-               return (1);             /* It's an A1200 */
-       return (0);                     /* Machine type not set */
+               return 1;               /* It's an A1200 */
+       return 0;                       /* Machine type not set */
 }
diff -r cc77ced91541 -r 53ea6e7c1c91 sys/arch/amigappc/amigappc/machdep.c
--- a/sys/arch/amigappc/amigappc/machdep.c      Fri May 21 11:59:38 2010 +0000
+++ b/sys/arch/amigappc/amigappc/machdep.c      Fri May 21 12:52:14 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.42 2010/03/05 17:56:46 phx Exp $ */
+/* $NetBSD: machdep.c,v 1.43 2010/05/21 12:52:14 phx Exp $ */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,10 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.42 2010/03/05 17:56:46 phx Exp $");
-
-#include "opt_ddb.h"
-#include "opt_ipkdb.h"
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.43 2010/05/21 12:52:14 phx Exp $");
 
 #include <sys/param.h>
 #include <sys/mount.h>
@@ -46,6 +43,8 @@
 
 #include <uvm/uvm_extern.h>
 
+#include <dev/cons.h>
+
 #include <machine/autoconf.h>
 #include <machine/powerpc.h>
 #include <machine/stdarg.h>
@@ -53,8 +52,6 @@
 #include <powerpc/oea/bat.h>
 #include <powerpc/pic/picvar.h>
 
-#include <dev/cons.h>
-
 #include <amiga/amiga/cc.h>
 #include <amiga/amiga/cia.h>
 #include <amiga/amiga/custom.h>
@@ -62,6 +59,9 @@
 #include <amiga/amiga/memlist.h>
 #include <amigappc/amigappc/p5reg.h>
 
+#include "opt_ddb.h"
+#include "opt_ipkdb.h"
+
 #include "fd.h"
 #include "ser.h"
 
@@ -74,6 +74,10 @@
 extern void fdintr(int);
 #endif
 
+#define AMIGAMEMREGIONS 8
+static struct mem_region physmemr[AMIGAMEMREGIONS], availmemr[AMIGAMEMREGIONS];
+static char model[80];
+
 /*
  * patched by some devices at attach time (currently, only the coms)
  */
@@ -85,10 +89,6 @@
  */
 int ser_open_speed;
 
-#define AMIGAMEMREGIONS 8
-static struct mem_region physmemr[AMIGAMEMREGIONS], availmemr[AMIGAMEMREGIONS];
-char cpu_model[80];
-
 /* interrupt handler chains for level2 and level6 interrupt */
 struct isr *isr_ports;
 struct isr *isr_exter;
@@ -258,16 +258,21 @@
 static void
 amigappc_identify(void)
 {
-       extern u_long ticks_per_sec, ns_per_tick;
-       static const char pll603[] = {10, 10, 10, 10, 20, 20, 25, 0,
-                       30, 0, 40, 0, 15,0, 35, 0};
-       static const char pll604[] = {10, 10, 70, 10, 20, 65, 25, 45,
-                       30, 55, 40, 50, 15, 60, 35, 0};
-       const char *mach, *pup, *cpuname;
-       const char *p5type_p = (const char *)0xf00010;
+       extern u_long ns_per_tick, ticks_per_sec;
+       static const char pll603[] = {
+               10, 10, 10, 10, 20, 20, 25, 00,
+               30, 00, 40, 00, 15, 00, 35, 00
+       };
+       static const char pll604[] = {
+               10, 10, 70, 10, 20, 65, 25, 45,
+               30, 55, 40, 50, 15, 60, 35, 00
+       };
+       const char *cpuname, *mach, *p5type_p, *pup;
+       int busclock, cpu, cpuclock;
        register int pvr, hid1;
-       int cpu = 604;
-       int cpuclock, busclock;
+
+       /* PowerUp ROM id location */
+       p5type_p = (const char *)0xf00010;
 
        /*
         * PVR holds the CPU-type and version while
@@ -276,15 +281,12 @@
        __asm ("mfpvr %0; mfspr %1,1009" : "=r"(pvr), "=r"(hid1));



Home | Main Index | Thread Index | Old Index