Updating to be like i386 version.

This commit is contained in:
phil 1995-06-18 07:13:46 +00:00
parent 6664ae1ddd
commit 8142065452
3 changed files with 79 additions and 19 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: endian.h,v 1.7 1994/10/26 08:24:25 cgd Exp $ */
/* $NetBSD: endian.h,v 1.8 1995/06/18 07:13:46 phil Exp $ */
/*
* Copyright (c) 1987, 1991 Regents of the University of California.
@ -35,8 +35,8 @@
* @(#)endian.h 7.8 (Berkeley) 4/3/91
*/
#ifndef _MACHINE_ENDIAN_H_
#define _MACHINE_ENDIAN_H_
#ifndef _PC532_ENDIAN_H_
#define _PC532_ENDIAN_H_
/*
* Define the order of 32-bit words in 64-bit words.
@ -67,20 +67,45 @@ __END_DECLS
#ifdef __GNUC__
#define __byte_swap_long(x) \
#define __byte_swap_long_variable(x) \
({ register unsigned long __x = (x); \
__asm ("rotw 8,%1; rotd 16,%1; rotw 8,%1" \
: "=r" (__x) \
: "0" (__x)); \
__x; })
#define __byte_swap_word(x) \
#define __byte_swap_word_variable(x) \
({ register unsigned short __x = (x); \
__asm ("rotw 8,%1" \
: "=r" (__x) \
: "0" (__x)); \
__x; })
#ifdef __OPTIMIZE__
#define __byte_swap_long_constant(x) \
((((x) & 0xff000000) >> 24) | \
(((x) & 0x00ff0000) >> 8) | \
(((x) & 0x0000ff00) << 8) | \
(((x) & 0x000000ff) << 24))
#define __byte_swap_word_constant(x) \
((((x) & 0xff00) >> 8) | \
(((x) & 0x00ff) << 8))
#define __byte_swap_long(x) \
(__builtin_constant_p((x)) ? \
__byte_swap_long_constant(x) : __byte_swap_long_variable(x))
#define __byte_swap_word(x) \
(__builtin_constant_p((x)) ? \
__byte_swap_word_constant(x) : __byte_swap_word_variable(x))
#else /* __OPTIMIZE__ */
#define __byte_swap_long(x) __byte_swap_long_variable(x)
#define __byte_swap_word(x) __byte_swap_word_variable(x)
#endif /* __OPTIMIZE__ */
#define ntohl(x) __byte_swap_long(x)
#define ntohs(x) __byte_swap_word(x)
#define htonl(x) __byte_swap_long(x)
@ -99,4 +124,4 @@ __END_DECLS
#endif /* _POSIX_SOURCE */
#endif /* _MACHINE_ENDIAN_H_ */
#endif /* _PC532_ENDIAN_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: icu.h,v 1.3 1995/05/16 07:30:41 phil Exp $ */
/* $NetBSD: icu.h,v 1.4 1995/06/18 07:13:48 phil Exp $ */
/*
* Copyright (c) 1993 Philip A. Nelson.
@ -35,6 +35,9 @@
/* icu.h: defines for use with the ns32532 icu. */
#ifndef _MACHINE_ICU_H_
#define _MACHINE_ICU_H_
/* We don't use vector interrupts, but make it right anyway */
#define VEC_ICU 0x10
@ -68,19 +71,30 @@
#define LCCV 28
#define HCCV 30
/* Byte and Word access to ICU registers
*/
#define ICUB(n) *((unsigned char *)(ICU_ADR + n))
#define ICUW(n) *((unsigned short *)(ICU_ADR + n))
#ifndef LOCORE
/* Interrupt trigger modes
*/
enum {HIGH_LEVEL, LOW_LEVEL, RAISING_EDGE, FALLING_EDGE} int_modes;
#endif /* !LOCORE */
/* Hardware interrupt request lines.
*/
#define IR_CLK 2 /* highest priority */
#define IR_SCSI0 5 /* Adaptec 6250 */
#define IR_SCSI1 4 /* NCR DP8490 */
#define IR_TTY0 13
#define IR_TTY0RDY 12
#define IR_TTY1 11
#define IR_TTY1RDY 10
#define IR_TTY2 9
#define IR_TTY2RDY 8
#define IR_TTY3 7
/* SCSI controllers */
#define AIC6250 0
#define DP8490 1
#define IR_TTY3RDY 6
/* edge polarity
* 0 0 falling edge
@ -94,3 +108,27 @@
#define ints_off bicpsrw PSR_I
#define ints_on bispsrw PSR_I
/* SCSI controllers */
#define AIC6250 0
#define DP8490 1
#define ICU_SCSI_BIT 0x80
#ifndef LOCORE
/*
* Select a SCSI controller.
*/
static __inline int
scsi_select_ctlr(int ctlr)
{
int old;
old = (ICUB(PDAT) & ICU_SCSI_BIT) == 0;
if (ctlr == DP8490)
ICUB(PDAT) &= ~ICU_SCSI_BIT; /* select = 0 for 8490 */
else
ICUB(PDAT) |= ICU_SCSI_BIT; /* select = 1 for AIC6250 */
return(old);
}
#endif /* !LOCORE */
#endif /* _MACHINE_ICU_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: psl.h,v 1.7 1995/05/16 07:30:42 phil Exp $ */
/* $NetBSD: psl.h,v 1.8 1995/06/18 07:13:50 phil Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -69,9 +69,6 @@
#ifdef _KERNEL
#include <machine/icu.h>
enum {HIGH_LEVEL, LOW_LEVEL, RAISING_EDGE, FALLING_EDGE} int_modes;
#define ICU(n) *((unsigned short *)(ICU_ADR + n))
struct iv {
void (*iv_vec)();
void *iv_arg;
@ -104,13 +101,13 @@ extern struct iv ivt[];
#define intr_disable(ir) do { \
di(); \
ICU(IMSK) = Cur_pl | (idisabled |= (1 << ir)); \
ICUW(IMSK) = Cur_pl | (idisabled |= (1 << ir)); \
ei(); \
} while(0)
#define intr_enable(ir) do { \
di(); \
ICU(IMSK) = Cur_pl | (idisabled &= ~(1 << ir)); \
ICUW(IMSK) = Cur_pl | (idisabled &= ~(1 << ir)); \
ei(); \
} while(0)
@ -124,7 +121,7 @@ splraise(register int ncpl)
di();
ocpl = Cur_pl;
ncpl |= ocpl;
ICU(IMSK) = ncpl | idisabled;
ICUW(IMSK) = ncpl | idisabled;
Cur_pl = ncpl;
ei();
return(ocpl);
@ -146,7 +143,7 @@ splx(register int ncpl)
register int ocpl;
di();
ocpl = Cur_pl;
ICU(IMSK) = ncpl | idisabled;
ICUW(IMSK) = ncpl | idisabled;
Cur_pl = ncpl;
ei();
if (ncpl == imask[IPL_ZERO])