Initial commit of the prom interface code for VLSI RC7500 motherboards.

This commit is contained in:
mark 1996-08-29 22:35:41 +00:00
parent bda575c253
commit 97c857ef9c
6 changed files with 526 additions and 0 deletions

View File

@ -0,0 +1,101 @@
/* $NetBSD: rc7500_prom.c,v 1.1 1996/08/29 22:35:41 mark Exp $ */
/*
* Copyright (c) 1992, 1994, 1995 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
#include <sys/param.h>
#include <arm32/dev/rc7500_prom.h>
#include <dev/cons.h>
/* XXX this is to fake out the console routines, while booting. */
void promcnputc __P((dev_t, int));
int promcngetc __P((dev_t));
struct consdev promcons = { NULL, NULL, promcngetc, promcnputc,
nullcnpollc, makedev(23,0), 1 };
void
init_prom_interface()
{
/* XXX fake out the console routines, for now */
cn_tab = &promcons;
}
/*
* promcnputc:
*
* Remap char before passing off to prom.
*
* Prom only takes 32 bit addresses. Copy char somewhere prom can
* find it. This routine will stop working after pmap_rid_of_console
* is called in alpha_init. This is due to the hard coded address
* of the console area.
*/
void
promcnputc(dev, c)
dev_t dev;
int c;
{
prom_putchar(c);
}
/*
* promcngetc:
*
* Wait for the prom to get a real char and pass it back.
*/
int
promcngetc(dev)
dev_t dev;
{
int ret;
for (;;) {
ret = prom_getchar();
if (ret != -1)
return(ret);
}
}
/*
* promcnlookc:
*
* See if prom has a real char and pass it back.
*/
int
promcnlookc(dev, cp)
dev_t dev;
char *cp;
{
int ret;
ret = prom_getchar();
if (ret != -1) {
*cp = ret;
return 1;
} else
return 0;
}

View File

@ -0,0 +1,81 @@
/* $NetBSD: rc7500_prom.h,v 1.1 1996/08/29 22:35:45 mark Exp $ */
/*
* Copyright (c) 1996, Danny C Tsen.
* Copyright (c) 1996, VLSI Technology Inc. All Rights Reserved.
* Copyright (c) 1995 Michael L. Hitch
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Michael L. Hitch.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _PROM_H_
#define _PROM_H_
#ifndef _LOCORE
/*
* This is the data returned in PROM_GETENV.
*/
struct prom_id {
u_int ramsize;
u_int physmem_start;
u_int physmem_end;
u_int video_start;
u_int video_size;
u_int display_width;
u_int display_height;
u_int tlb; /* translation table base */
u_int tlbsize;
u_int ksize; /* kernel size */
u_int kstart; /* kernel start address */
char bootdev[32];
char bootfile[32];
char bootargs[32];
u_int bootdevnum;
};
#endif /* _LOCORE */
#define PROM_REBOOT 0x06
#define PROM_GETENV 0x07
#define PROM_PUTCHAR 0x08
#define PROM_PUTS 0x09
#define PROM_GETCHAR 0x0A
#define PROM_OPEN 0x0B
#define PROM_CLOSE 0x0C
#define PROM_READ 0x0D
#ifndef _LOCORE
extern int prom_putchar(int c);
extern void prom_puts(char *s);
extern int prom_getchar(void);
extern char *prom_getenv(void);
extern int prom_open(char *dev_name, u_int devnum);
extern int prom_close(int dev);
extern int prom_read(int dev, char *io);
extern void prom_reboot(void);
#endif /* _LOCORE */
#endif /* _PROM_H_ */

View File

@ -0,0 +1,81 @@
/* $NetBSD: rc7500_promsys.s,v 1.1 1996/08/29 22:35:46 mark Exp $ */
/*
* Copyright (c) 1996, Danny C Tsen.
* Copyright (c) 1996, VLSI Technology Inc. All Rights Reserved.
* Copyright (c) 1995 Michael L. Hitch
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Michael L. Hitch.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
sp .req r13
lr .req r14
pc .req r15
ENTRY(prom_reboot)
stmdb sp!, {lr}
SWI 0x06
ldmia sp!, {pc}
ENTRY(prom_getenv)
stmdb sp!, {lr}
SWI 0x07
ldmia sp!, {pc}
ENTRY(prom_putchar)
stmdb sp!, {lr}
SWI 0x08
ldmia sp!, {pc}
ENTRY(prom_puts)
stmdb sp!, {r0, lr}
SWI 0x09
ldmia sp!, {r0, pc}
ENTRY(prom_getchar)
stmdb sp!, {lr}
SWI 0x0A
ldmia sp!, {pc}
ENTRY(prom_open)
stmdb sp!, {lr}
SWI 0x0B
ldmia sp!, {pc}
ENTRY(prom_close)
stmdb sp!, {lr}
SWI 0x0C
ldmia sp!, {pc}
ENTRY(prom_read)
stmdb sp!, {lr}
SWI 0x0D
ldmia sp!, {pc}

View File

@ -0,0 +1,101 @@
/* $NetBSD: rc7500_prom.c,v 1.1 1996/08/29 22:35:41 mark Exp $ */
/*
* Copyright (c) 1992, 1994, 1995 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
#include <sys/param.h>
#include <arm32/dev/rc7500_prom.h>
#include <dev/cons.h>
/* XXX this is to fake out the console routines, while booting. */
void promcnputc __P((dev_t, int));
int promcngetc __P((dev_t));
struct consdev promcons = { NULL, NULL, promcngetc, promcnputc,
nullcnpollc, makedev(23,0), 1 };
void
init_prom_interface()
{
/* XXX fake out the console routines, for now */
cn_tab = &promcons;
}
/*
* promcnputc:
*
* Remap char before passing off to prom.
*
* Prom only takes 32 bit addresses. Copy char somewhere prom can
* find it. This routine will stop working after pmap_rid_of_console
* is called in alpha_init. This is due to the hard coded address
* of the console area.
*/
void
promcnputc(dev, c)
dev_t dev;
int c;
{
prom_putchar(c);
}
/*
* promcngetc:
*
* Wait for the prom to get a real char and pass it back.
*/
int
promcngetc(dev)
dev_t dev;
{
int ret;
for (;;) {
ret = prom_getchar();
if (ret != -1)
return(ret);
}
}
/*
* promcnlookc:
*
* See if prom has a real char and pass it back.
*/
int
promcnlookc(dev, cp)
dev_t dev;
char *cp;
{
int ret;
ret = prom_getchar();
if (ret != -1) {
*cp = ret;
return 1;
} else
return 0;
}

View File

@ -0,0 +1,81 @@
/* $NetBSD: rc7500_prom.h,v 1.1 1996/08/29 22:35:45 mark Exp $ */
/*
* Copyright (c) 1996, Danny C Tsen.
* Copyright (c) 1996, VLSI Technology Inc. All Rights Reserved.
* Copyright (c) 1995 Michael L. Hitch
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Michael L. Hitch.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _PROM_H_
#define _PROM_H_
#ifndef _LOCORE
/*
* This is the data returned in PROM_GETENV.
*/
struct prom_id {
u_int ramsize;
u_int physmem_start;
u_int physmem_end;
u_int video_start;
u_int video_size;
u_int display_width;
u_int display_height;
u_int tlb; /* translation table base */
u_int tlbsize;
u_int ksize; /* kernel size */
u_int kstart; /* kernel start address */
char bootdev[32];
char bootfile[32];
char bootargs[32];
u_int bootdevnum;
};
#endif /* _LOCORE */
#define PROM_REBOOT 0x06
#define PROM_GETENV 0x07
#define PROM_PUTCHAR 0x08
#define PROM_PUTS 0x09
#define PROM_GETCHAR 0x0A
#define PROM_OPEN 0x0B
#define PROM_CLOSE 0x0C
#define PROM_READ 0x0D
#ifndef _LOCORE
extern int prom_putchar(int c);
extern void prom_puts(char *s);
extern int prom_getchar(void);
extern char *prom_getenv(void);
extern int prom_open(char *dev_name, u_int devnum);
extern int prom_close(int dev);
extern int prom_read(int dev, char *io);
extern void prom_reboot(void);
#endif /* _LOCORE */
#endif /* _PROM_H_ */

View File

@ -0,0 +1,81 @@
/* $NetBSD: rc7500_promsys.S,v 1.1 1996/08/29 22:35:46 mark Exp $ */
/*
* Copyright (c) 1996, Danny C Tsen.
* Copyright (c) 1996, VLSI Technology Inc. All Rights Reserved.
* Copyright (c) 1995 Michael L. Hitch
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Michael L. Hitch.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
sp .req r13
lr .req r14
pc .req r15
ENTRY(prom_reboot)
stmdb sp!, {lr}
SWI 0x06
ldmia sp!, {pc}
ENTRY(prom_getenv)
stmdb sp!, {lr}
SWI 0x07
ldmia sp!, {pc}
ENTRY(prom_putchar)
stmdb sp!, {lr}
SWI 0x08
ldmia sp!, {pc}
ENTRY(prom_puts)
stmdb sp!, {r0, lr}
SWI 0x09
ldmia sp!, {r0, pc}
ENTRY(prom_getchar)
stmdb sp!, {lr}
SWI 0x0A
ldmia sp!, {pc}
ENTRY(prom_open)
stmdb sp!, {lr}
SWI 0x0B
ldmia sp!, {pc}
ENTRY(prom_close)
stmdb sp!, {lr}
SWI 0x0C
ldmia sp!, {pc}
ENTRY(prom_read)
stmdb sp!, {lr}
SWI 0x0D
ldmia sp!, {pc}