Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/next68k/next68k Misc KNF and cosmetics. No binary ...
details: https://anonhg.NetBSD.org/src/rev/cc66d641f88e
branches: trunk
changeset: 772100:cc66d641f88e
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sun Dec 18 04:29:32 2011 +0000
description:
Misc KNF and cosmetics. No binary changes.
diffstat:
sys/arch/next68k/next68k/nextrom.c | 306 ++++++++++++++++++++----------------
sys/arch/next68k/next68k/nextrom.h | 16 +-
2 files changed, 178 insertions(+), 144 deletions(-)
diffs (truncated from 498 to 300 lines):
diff -r d0c93e0d972f -r cc66d641f88e sys/arch/next68k/next68k/nextrom.c
--- a/sys/arch/next68k/next68k/nextrom.c Sun Dec 18 03:46:02 2011 +0000
+++ b/sys/arch/next68k/next68k/nextrom.c Sun Dec 18 04:29:32 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nextrom.c,v 1.23 2011/12/18 03:46:02 tsutsui Exp $ */
+/* $NetBSD: nextrom.c,v 1.24 2011/12/18 04:29:32 tsutsui Exp $ */
/*
* Copyright (c) 1998 Darrin B. Jewell
* All rights reserved.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nextrom.c,v 1.23 2011/12/18 03:46:02 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nextrom.c,v 1.24 2011/12/18 04:29:32 tsutsui Exp $");
#include "opt_ddb.h"
#include "opt_serial.h"
@@ -56,12 +56,12 @@
volatile struct mon_global *mg;
-#define MON(type, off) (*(type *)((u_int) (mg) + off))
+#define MON(type, off) (*(type *)((u_int) (mg) + off))
#define RELOC(v, t) (*((t *)((u_int)&(v) + NEXT_RAMBASE)))
#define MONRELOC(type, off) \
- (*(volatile type *)((u_int) RELOC(mg,volatile struct mon_global *) + off))
+ (*(volatile type *)((u_int)RELOC(mg, volatile struct mon_global *) + off))
typedef int (*getcptr)(void);
@@ -80,47 +80,49 @@
#else
#define ROM_PUTC(c) \
- (*MONRELOC(putcptr,MG_putc))(c)
+ (*MONRELOC(putcptr, MG_putc))(c)
#define ROM_PUTS(xs) \
- do { volatile const char *_s = xs + NEXT_RAMBASE; \
- while(_s && *_s) (*MONRELOC(putcptr,MG_putc))(*_s++); \
- } while(0)
+ do { \
+ volatile const char *_s = xs + NEXT_RAMBASE; \
+ while (_s && *_s) \
+ (*MONRELOC(putcptr, MG_putc))(*_s++); \
+ } while (/* CONSTCOND */0)
/* Print a hex byte on the rom console */
#if 1
static char romprint_hextable[] = "0123456789abcdef@";
-#define ROM_PUTX(v) \
- do { \
- (*MONRELOC(putcptr,MG_putc)) \
- (RELOC(romprint_hextable[((v)>>4)&0xf], char)); \
- (*MONRELOC(putcptr,MG_putc)) \
- (RELOC(romprint_hextable[(v)&0xf], char)); \
- } while(0);
+#define ROM_PUTX(v) \
+ do { \
+ (*MONRELOC(putcptr, MG_putc)) \
+ (RELOC(romprint_hextable[((v)>>4)&0xf], char)); \
+ (*MONRELOC(putcptr, MG_putc)) \
+ (RELOC(romprint_hextable[(v)&0xf], char)); \
+ } while (/* CONSTCOND */0);
#else
-#define lookup_hex(v) ((v)>9?('a'+(v)-0xa):('0'+(v)))
+#define lookup_hex(v) ((v) >9 ? ('a' + (v) - 0xa) : ('0' + (v)))
#define ROM_PUTX(v) \
- do { \
- (*MONRELOC(putcptr,MG_putc)) \
- (lookup_hex(((v)>>4)&0xf)); \
- (*MONRELOC(putcptr,MG_putc)) \
- (lookup_hex((v)&0xf)); \
- } while(0);
+ do { \
+ (*MONRELOC(putcptr, MG_putc)) \
+ (lookup_hex(((v) >> 4) & 0xf)); \
+ (*MONRELOC(putcptr, MG_putc)) \
+ (lookup_hex((v) & 0xf)); \
+ } while (/* CONSTCOND */0);
#endif
#endif
-u_char rom_enetaddr[6];
-u_char rom_boot_dev[20];
-u_char rom_boot_arg[20];
-u_char rom_boot_info[20];
-u_char rom_boot_file[20];
-u_char rom_bootfile[MG_boot_how-MG_bootfile];
+uint8_t rom_enetaddr[6];
+uint8_t rom_boot_dev[20];
+uint8_t rom_boot_arg[20];
+uint8_t rom_boot_info[20];
+uint8_t rom_boot_file[20];
+uint8_t rom_bootfile[MG_boot_how - MG_bootfile];
char rom_machine_type;
-u_char *rom_return_sp;
+uint8_t *rom_return_sp;
u_int rom_mon_stack;
-u_char rom_image[0x2000];
-vm_offset_t rom_image_base;
+uint8_t rom_image[0x2000];
+paddr_t rom_image_base;
u_int rom_vbr;
u_int rom_intrmask;
u_int rom_intrstat;
@@ -141,8 +143,8 @@
const char *reloc_elfmag;
#endif
- RELOC(rom_return_sp,u_char *) = args[0];
- RELOC(mg,char *) = args[1];
+ RELOC(rom_return_sp, uint8_t *) = args[0];
+ RELOC(mg, char *) = args[1];
ROM_PUTS("Welcome to NetBSD/next68k\r\n");
@@ -201,24 +203,24 @@
ROM_PUTS("Constructing the segment list...\r\n");
ROM_PUTS("machine type = 0x");
- ROM_PUTX(MONRELOC(char,MG_machine_type));
+ ROM_PUTX(MONRELOC(char, MG_machine_type));
ROM_PUTS("\r\nboard rev = 0x");
- ROM_PUTX(MONRELOC(char,MG_board_rev));
+ ROM_PUTX(MONRELOC(char, MG_board_rev));
ROM_PUTS("\r\ndmachip = 0x");
- ROM_PUTX(MONRELOC(int,MG_dmachip)>>24&0xff);
- ROM_PUTX(MONRELOC(int,MG_dmachip)>>16&0xff);
- ROM_PUTX(MONRELOC(int,MG_dmachip)>>8&0xff);
- ROM_PUTX(MONRELOC(int,MG_dmachip)>>0&0xff);
+ ROM_PUTX(MONRELOC(int, MG_dmachip) >> 24 & 0xff);
+ ROM_PUTX(MONRELOC(int, MG_dmachip) >> 16 & 0xff);
+ ROM_PUTX(MONRELOC(int, MG_dmachip) >> 8 & 0xff);
+ ROM_PUTX(MONRELOC(int, MG_dmachip) >> 0 & 0xff);
ROM_PUTS("\r\ndiskchip = 0x");
- ROM_PUTX(MONRELOC(int,MG_diskchip)>>24&0xff);
- ROM_PUTX(MONRELOC(int,MG_diskchip)>>16&0xff);
- ROM_PUTX(MONRELOC(int,MG_diskchip)>>8&0xff);
- ROM_PUTX(MONRELOC(int,MG_diskchip)>>0&0xff);
+ ROM_PUTX(MONRELOC(int, MG_diskchip) >> 24 & 0xff);
+ ROM_PUTX(MONRELOC(int, MG_diskchip) >> 16 & 0xff);
+ ROM_PUTX(MONRELOC(int, MG_diskchip) >> 8 & 0xff);
+ ROM_PUTX(MONRELOC(int, MG_diskchip) >> 0 & 0xff);
ROM_PUTS("\r\n");
/* Construct the segment list */
- {
+ {
u_int msize16;
u_int msize4;
u_int msize1;
@@ -226,30 +228,31 @@
int j = 0;
char mach;
- if (MONRELOC(char,MG_machine_type) == NeXT_X15) {
+ if (MONRELOC(char, MG_machine_type) == NeXT_X15) {
msize16 = 0x1000000;
- msize4 = 0x400000;
- msize1 = 0x100000;
+ msize4 = 0x400000;
+ msize1 = 0x100000;
ROM_PUTS("Looks like a NeXT_X15\r\n");
- } else if (MONRELOC(char,MG_machine_type) == NeXT_WARP9C) {
+ } else if (MONRELOC(char, MG_machine_type) == NeXT_WARP9C) {
msize16 = 0x800000;
msize4 = 0x200000;
- msize1 = 0x80000; /* ? */
+ msize1 = 0x80000; /* ? */
ROM_PUTS("Looks like a NeXT_WARP9C\r\n");
- } else if (MONRELOC(char,MG_machine_type) == NeXT_WARP9) {
+ } else if (MONRELOC(char, MG_machine_type) == NeXT_WARP9) {
msize16 = 0x1000000;
- msize4 = 0x400000;
- msize1 = 0x100000;
+ msize4 = 0x400000;
+ msize1 = 0x100000;
ROM_PUTS("Looks like a NeXT_WARP9\r\n");
- } else if (MONRELOC(char,MG_machine_type) == NeXT_TURBO_COLOR) {
+ } else if (MONRELOC(char, MG_machine_type) == NeXT_TURBO_COLOR)
+ {
msize16 = 0x2000000;
- msize4 = 0x800000;
- msize1 = 0x200000;
+ msize4 = 0x800000;
+ msize1 = 0x200000;
ROM_PUTS("Looks like a NeXT_TURBO_COLOR\r\n");
- } else if (MONRELOC(char,MG_machine_type) == NeXT_TURBO_MONO) {
+ } else if (MONRELOC(char, MG_machine_type) == NeXT_TURBO_MONO) {
msize16 = 0x2000000;
- msize4 = 0x800000;
- msize1 = 0x200000;
+ msize4 = 0x800000;
+ msize1 = 0x200000;
ROM_PUTS("Looks like a NeXT_TURBO_MONO\r\n");
} else {
msize16 = 0x100000;
@@ -265,148 +268,179 @@
else
RELOC(turbo, int) = 0;
- for (ix=0;ix<N_SIMM;ix++) {
-
+ for (ix = 0; ix < N_SIMM; ix++) {
+
ROM_PUTS("Memory bank 0x");
ROM_PUTX(ix);
ROM_PUTS(" has value 0x");
- ROM_PUTX(MONRELOC(char,MG_simm+ix))
- ROM_PUTS("\r\n");
-
- if ((MONRELOC(char,MG_simm+ix) & SIMM_SIZE) != SIMM_SIZE_EMPTY) {
- RELOC(phys_seg_list[j].ps_start, vm_offset_t)
- = NEXT_RAMBASE+(ix*msize16);
+ ROM_PUTX(MONRELOC(char, MG_simm + ix))
+ ROM_PUTS("\r\n");
+
+ if ((MONRELOC(char, MG_simm+ix) & SIMM_SIZE) !=
+ SIMM_SIZE_EMPTY) {
+ RELOC(phys_seg_list[j].ps_start, paddr_t) =
+ NEXT_RAMBASE + (ix * msize16);
}
- if ((MONRELOC(char,MG_simm+ix) & SIMM_SIZE) == SIMM_SIZE_16MB) {
- RELOC(phys_seg_list[j].ps_end, vm_offset_t) =
- RELOC(phys_seg_list[j].ps_start, vm_offset_t) +
- msize16;
- j++;
- }
- if ((MONRELOC(char,MG_simm+ix) & SIMM_SIZE) == SIMM_SIZE_4MB) {
- RELOC(phys_seg_list[j].ps_end, vm_offset_t) =
- RELOC(phys_seg_list[j].ps_start, vm_offset_t) +
- msize4;
+ if ((MONRELOC(char, MG_simm + ix) & SIMM_SIZE) ==
+ SIMM_SIZE_16MB) {
+ RELOC(phys_seg_list[j].ps_end, paddr_t) =
+ RELOC(phys_seg_list[j].ps_start, paddr_t) +
+ msize16;
j++;
}
- if ((MONRELOC(char,MG_simm+ix) & SIMM_SIZE) == SIMM_SIZE_1MB) {
- RELOC(phys_seg_list[j].ps_end, vm_offset_t) =
- RELOC(phys_seg_list[j].ps_start, vm_offset_t) +
- msize1;
+ if ((MONRELOC(char, MG_simm + ix) & SIMM_SIZE) ==
+ SIMM_SIZE_4MB) {
+ RELOC(phys_seg_list[j].ps_end, paddr_t) =
+ RELOC(phys_seg_list[j].ps_start, paddr_t) +
+ msize4;
+ j++;
+ }
+ if ((MONRELOC(char, MG_simm+ix) & SIMM_SIZE) ==
+ SIMM_SIZE_1MB) {
+ RELOC(phys_seg_list[j].ps_end, paddr_t) =
+ RELOC(phys_seg_list[j].ps_start, paddr_t) +
+ msize1;
j++;
}
}
- /* The NeXT ROM or something appears to reserve the very
+ /*
+ * The NeXT ROM or something appears to reserve the very
* top of memory
*/
- RELOC(phys_seg_list[j-1].ps_end, vm_offset_t) -= 0x2000;
- RELOC(rom_image_base, vm_offset_t) = RELOC(phys_seg_list[j-1].ps_end, vm_offset_t);
+ RELOC(phys_seg_list[j - 1].ps_end, paddr_t) -= 0x2000;
+ RELOC(rom_image_base, paddr_t) =
+ RELOC(phys_seg_list[j - 1].ps_end, paddr_t);
/* pmap is unhappy if it is not null terminated */
- for(;j<MAX_PHYS_SEGS;j++) {
- RELOC(phys_seg_list[j].ps_start, vm_offset_t) = 0;
- RELOC(phys_seg_list[j].ps_end, vm_offset_t) = 0;
+ for (; j < MAX_PHYS_SEGS; j++) {
+ RELOC(phys_seg_list[j].ps_start, paddr_t) = 0;
+ RELOC(phys_seg_list[j].ps_end, paddr_t) = 0;
}
}
{
int j;
ROM_PUTS("Memory segments found:\r\n");
- for (j=0;RELOC(phys_seg_list[j].ps_start, vm_offset_t);j++) {
+ for (j = 0; RELOC(phys_seg_list[j].ps_start, paddr_t); j++) {
ROM_PUTS("\t0x");
- ROM_PUTX((RELOC(phys_seg_list[j].ps_start, vm_offset_t)>>24)&0xff);
- ROM_PUTX((RELOC(phys_seg_list[j].ps_start, vm_offset_t)>>16)&0xff);
- ROM_PUTX((RELOC(phys_seg_list[j].ps_start, vm_offset_t)>>8)&0xff);
- ROM_PUTX((RELOC(phys_seg_list[j].ps_start, vm_offset_t)>>0)&0xff);
+ ROM_PUTX((RELOC(phys_seg_list[j].ps_start, paddr_t)
+ >> 24 ) & 0xff);
+ ROM_PUTX((RELOC(phys_seg_list[j].ps_start, paddr_t)
+ >> 16) & 0xff);
Home |
Main Index |
Thread Index |
Old Index