- Declare common functions in cpu.h

- Rename some machine dependent functions for consistency.
- Remove register declarations.
- Some KNF.
This commit is contained in:
tsutsui 2003-04-26 18:50:18 +00:00
parent a066c2841f
commit 20601f7173
4 changed files with 63 additions and 54 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.14 2001/09/20 12:29:48 tsutsui Exp $ */
/* $NetBSD: cpu.h,v 1.15 2003/04/26 18:50:18 tsutsui Exp $ */
#ifndef _NEWSMIPS_CPU_H_
#define _NEWSMIPS_CPU_H_
@ -11,6 +11,14 @@ extern int systype;
#define NEWS3400 1
#define NEWS5000 2
/* System type dependent initializations. */
#ifdef news3400
void news3400_init(void);
#endif
#ifdef news5000
void news5000_init(void);
#endif
#endif
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.68 2003/04/26 11:05:17 ragge Exp $ */
/* $NetBSD: machdep.c,v 1.69 2003/04/26 18:50:19 tsutsui Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -43,7 +43,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.68 2003/04/26 11:05:17 ragge Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.69 2003/04/26 18:50:19 tsutsui Exp $");
/* from: Utah Hdr: machdep.c 1.63 91/04/24 */
@ -133,10 +133,6 @@ void (*enable_intr) __P((void));
void (*disable_intr) __P((void));
void (*readmicrotime) __P((struct timeval *tvp));
/* System type dependent initializations. */
extern void news3400_init __P((void));
extern void news5000_init __P((void));
static void (*hardware_intr) __P((u_int, u_int, u_int, u_int));
u_int ssir;

View File

@ -1,4 +1,4 @@
/* $NetBSD: news3400.c,v 1.6 2003/01/19 16:38:43 thorpej Exp $ */
/* $NetBSD: news3400.c,v 1.7 2003/04/26 18:50:19 tsutsui Exp $ */
/*-
* Copyright (C) 1999 Tsubai Masanari. All rights reserved.
@ -37,16 +37,18 @@
#include <machine/psl.h>
#include <newsmips/newsmips/machid.h>
void level0_intr (void);
void level1_intr (void);
void hb_intr_dispatch (int);
void MachFPInterrupt (unsigned, unsigned, unsigned, struct frame *);
extern void hb_intr_dispatch(int);
#if !defined(SOFTFLOAT)
extern void MachFPInterrupt(unsigned, unsigned, unsigned, struct frame *);
#endif
int news3400_badaddr (void *, u_int);
static void enable_intr_3400 (void);
static void disable_intr_3400 (void);
static void readidrom_3400 (u_char *);
void news3400_init (void);
int news3400_badaddr(void *, u_int);
static void news3400_level0_intr(void);
static void news3400_level1_intr(void);
static void news3400_enable_intr(void);
static void news3400_disable_intr(void);
static void news3400_readidrom(u_char *);
static int badaddr_flag;
@ -66,7 +68,7 @@ news3400_intr(status, cause, pc, ipending)
/* handle clock interrupts ASAP */
if (ipending & MIPS_INT_MASK_2) {
register int stat;
int stat;
stat = *(volatile u_char *)INTST0;
stat &= INTST0_TIMINT|INTST0_KBDINT|INTST0_MSINT;
@ -102,12 +104,12 @@ news3400_intr(status, cause, pc, ipending)
}
if (ipending & MIPS_INT_MASK_1) {
level1_intr();
news3400_level1_intr();
cause &= ~MIPS_INT_MASK_1;
}
if (ipending & MIPS_INT_MASK_0) {
level0_intr();
news3400_level0_intr();
cause &= ~MIPS_INT_MASK_0;
}
@ -129,8 +131,8 @@ news3400_intr(status, cause, pc, ipending)
#define LEVEL0_MASK \
(INTST1_DMA|INTST1_SLOT1|INTST1_SLOT3|INTST1_EXT1|INTST1_EXT3)
void
level0_intr()
static void
news3400_level0_intr()
{
volatile u_char *istat1 = (void *)INTST1;
volatile u_char *iclr1 = (void *)INTCLR1;
@ -150,8 +152,8 @@ level0_intr()
#define LEVEL1_MASK0 (INTST0_CFLT|INTST0_CBSY)
#define LEVEL1_MASK1 (INTST1_BEEP|INTST1_SCC|INTST1_LANCE)
void
level1_intr()
static void
news3400_level1_intr()
{
volatile u_char *ien1 = (void *)INTEN1;
volatile u_char *istat1 = (void *)INTST1;
@ -202,7 +204,7 @@ news3400_badaddr(addr, size)
}
static void
enable_intr_3400(void)
news3400_enable_intr(void)
{
volatile u_int8_t *inten0 = (void *)INTEN0;
volatile u_int8_t *inten1 = (void *)INTEN1;
@ -230,8 +232,9 @@ enable_intr_3400(void)
}
static void
disable_intr_3400(void)
news3400_disable_intr(void)
{
volatile u_int8_t *inten0 = (void *)INTEN0;
volatile u_int8_t *inten1 = (void *)INTEN1;
@ -240,11 +243,11 @@ disable_intr_3400(void)
}
static void
readidrom_3400(rom)
news3400_readidrom(rom)
register u_char *rom;
{
register u_char *p = (u_char *)IDROM;
register int i;
u_char *p = (u_char *)IDROM;
int i;
for (i = 0; i < sizeof (struct idrom); i++, p += 2)
*rom++ = ((*p & 0x0f) << 4) + (*(p + 1) & 0x0f);
@ -255,9 +258,10 @@ extern struct idrom idrom;
void
news3400_init()
{
enable_intr = enable_intr_3400;
disable_intr = disable_intr_3400;
readidrom_3400((u_char *)&idrom);
enable_intr = news3400_enable_intr;
disable_intr = news3400_disable_intr;
news3400_readidrom((u_char *)&idrom);
hostid = idrom.id_serial;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: news5000.c,v 1.8 2001/04/27 12:55:51 tsutsui Exp $ */
/* $NetBSD: news5000.c,v 1.9 2003/04/26 18:50:19 tsutsui Exp $ */
/*-
* Copyright (C) 1999 SHIMIZU Ryo. All rights reserved.
@ -39,15 +39,13 @@
extern void (*readmicrotime) (struct timeval *tvp);
static void level1_intr (void);
static void level0_intr (void);
static void news5000_level1_intr(void);
static void news5000_level0_intr(void);
static void enable_intr_5000 (void);
static void disable_intr_5000 (void);
static void readmicrotime_5000 (struct timeval *);
static void readidrom_5000 (u_char *);
void news5000_init (void);
static void news5000_enable_intr(void);
static void news5000_disable_intr(void);
static void news5000_readmicrotime(struct timeval *);
static void news5000_readidrom(u_char *);
static u_int freerun_off;
@ -113,7 +111,8 @@ news5000_intr(status, cause, pc, ipending)
u_int stat = *(volatile u_int *)NEWS5000_APBUS_INTST;
printf("APbus error 0x%04x\n", stat & 0xffff);
if (stat & NEWS5000_APBUS_INT_DMAADDR) {
printf("DMA Address Error: slot=%x, addr=0x%08x\n",
printf("DMA Address Error: "
"slot=%x, addr=0x%08x\n",
*(volatile u_int *)NEWS5000_APBUS_DER_S,
*(volatile u_int *)NEWS5000_APBUS_DER_A);
}
@ -139,13 +138,13 @@ news5000_intr(status, cause, pc, ipending)
}
if (ipending & MIPS_INT_MASK_1) {
level1_intr();
news5000_level1_intr();
apbus_wbflush();
cause &= ~MIPS_INT_MASK_1;
}
if (ipending & MIPS_INT_MASK_0) {
level0_intr();
news5000_level0_intr();
apbus_wbflush();
cause &= ~MIPS_INT_MASK_0;
}
@ -155,7 +154,7 @@ news5000_intr(status, cause, pc, ipending)
static void
level1_intr(void)
news5000_level1_intr(void)
{
u_int int1stat;
@ -170,7 +169,7 @@ level1_intr(void)
}
static void
level0_intr(void)
news5000_level0_intr(void)
{
u_int int0stat;
@ -185,7 +184,7 @@ level0_intr(void)
}
static void
enable_intr_5000(void)
news5000_enable_intr(void)
{
/* INT0 and INT1 has been enabled at attach */
@ -200,8 +199,9 @@ enable_intr_5000(void)
}
static void
disable_intr_5000(void)
news5000_disable_intr(void)
{
*(volatile u_int *)NEWS5000_INTEN0 = 0;
*(volatile u_int *)NEWS5000_INTEN1 = 0;
*(volatile u_int *)NEWS5000_INTEN2 = 0;
@ -211,7 +211,7 @@ disable_intr_5000(void)
}
static void
readmicrotime_5000(tvp)
news5000_readmicrotime(tvp)
struct timeval *tvp;
{
u_int freerun;
@ -229,7 +229,7 @@ readmicrotime_5000(tvp)
}
static void
readidrom_5000(rom)
news5000_readidrom(rom)
u_char *rom;
{
u_int32_t *p = (void *)NEWS5000_IDROM;
@ -244,11 +244,12 @@ extern struct idrom idrom;
void
news5000_init(void)
{
enable_intr = enable_intr_5000;
disable_intr = disable_intr_5000;
readidrom_5000((u_char *)&idrom);
readmicrotime = readmicrotime_5000;
enable_intr = news5000_enable_intr;
disable_intr = news5000_disable_intr;
news5000_readidrom((u_char *)&idrom);
readmicrotime = news5000_readmicrotime;
hostid = idrom.id_serial;
/* XXX reset uPD72067 FDC to avoid spurious interrupts */