HD64461 UART module support.
This commit is contained in:
parent
106c0aee60
commit
054158f994
@ -1,4 +1,4 @@
|
||||
# $NetBSD: JORNADA690,v 1.6 2001/03/08 15:21:31 uch Exp $
|
||||
# $NetBSD: JORNADA690,v 1.7 2001/03/15 17:30:55 uch Exp $
|
||||
#
|
||||
# JORNADA690 uch's Jornada 690
|
||||
#
|
||||
@ -85,6 +85,7 @@ scif0 at shb? port 0xa4000008 irq 12
|
||||
|
||||
hd64461if* at shb? irq 4
|
||||
hd64461pcmcia* at hd64461if?
|
||||
com* at hd64461if?
|
||||
|
||||
# PCMCIA bus support
|
||||
pcmcia0 at hd64461pcmcia? controller 0 socket ? # I/O card, memory card
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: files.hpcsh,v 1.8 2001/02/24 20:17:45 uch Exp $
|
||||
# $NetBSD: files.hpcsh,v 1.9 2001/03/15 17:30:55 uch Exp $
|
||||
#
|
||||
maxpartitions 8
|
||||
|
||||
@ -6,6 +6,7 @@ maxusers 2 16 64
|
||||
|
||||
file arch/hpcsh/hpcsh/conf.c
|
||||
file arch/hpcsh/hpcsh/machdep.c
|
||||
file arch/hpcsh/hpcsh/console.c
|
||||
file arch/hpcsh/hpcsh/autoconf.c
|
||||
file arch/hpcsh/hpcsh/bus_space.c
|
||||
file arch/hpcsh/hpcsh/procfs_machdep.c procfs
|
||||
@ -63,12 +64,15 @@ file arch/hpcsh/dev/pfckbd.c pfckbd needs-flag
|
||||
define hd64461if {}
|
||||
device hd64461if: hd64461if
|
||||
attach hd64461if at shb
|
||||
file arch/hpcsh/dev/hd64461/hd64461.c hd64461if
|
||||
file arch/hpcsh/dev/hd64461/hd64461.c hd64461if needs-flag
|
||||
|
||||
device hd64461pcmcia: pcmciabus
|
||||
attach hd64461pcmcia at hd64461if
|
||||
file arch/hpcsh/dev/hd64461/hd64461pcmcia.c hd64461pcmcia
|
||||
|
||||
attach com at hd64461if with hd64461uart
|
||||
file arch/hpcsh/dev/hd64461/hd64461uart.c hd64461uart
|
||||
|
||||
# network devices MII bus
|
||||
include "dev/mii/files.mii"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hd64461pcmcia.c,v 1.2 2001/03/08 15:13:14 uch Exp $ */
|
||||
/* $NetBSD: hd64461pcmcia.c,v 1.3 2001/03/15 17:30:55 uch Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -233,6 +233,18 @@ static void set_bus_width(enum controller_channel, int);
|
||||
#ifdef DEBUG
|
||||
static void hd64461pcmcia_info(struct hd64461pcmcia_softc *);
|
||||
#endif
|
||||
/* fix SH3 Area[56] bug */
|
||||
static void fixup_sh3_pcmcia_area(bus_space_tag_t);
|
||||
#define _BUS_SPACE_ACCESS_HOOK() \
|
||||
{ \
|
||||
u_int8_t dummy __attribute__((__unused__)) = \
|
||||
*(volatile u_int8_t *)0xba000000; \
|
||||
}
|
||||
_BUS_SPACE_WRITE(_sh3_pcmcia_bug, 1, 8)
|
||||
_BUS_SPACE_WRITE_MULTI(_sh3_pcmcia_bug, 1, 8)
|
||||
_BUS_SPACE_WRITE_REGION(_sh3_pcmcia_bug, 1, 8)
|
||||
_BUS_SPACE_SET_MULTI(_sh3_pcmcia_bug, 1, 8)
|
||||
#undef _BUS_SPACE_ACCESS_HOOK
|
||||
|
||||
#define DELAY_MS(x) delay((x) * 1000)
|
||||
|
||||
@ -364,18 +376,21 @@ hd64461pcmcia_attach_channel(struct hd64461pcmcia_softc *sc,
|
||||
/* Attibute/Common memory extent */
|
||||
membase = (channel == CHANNEL_0)
|
||||
? HD64461_PCC0_MEMBASE : HD64461_PCC1_MEMBASE;
|
||||
ch->ch_memt = bus_space_create("PCMCIA attribute memory",
|
||||
|
||||
ch->ch_memt = bus_space_create(0, "PCMCIA attribute memory",
|
||||
membase, 0x01000000); /* 16MB */
|
||||
bus_space_alloc(ch->ch_memt, 0, 0x01000000, 0x01000000,
|
||||
bus_space_alloc(ch->ch_memt, 0, 0x00ffffff, 0x01000000,
|
||||
0x01000000, 0x01000000, 0, &ch->ch_membase_addr,
|
||||
&ch->ch_memh);
|
||||
fixup_sh3_pcmcia_area(ch->ch_memt);
|
||||
|
||||
/* Common memory space extent */
|
||||
ch->ch_memsize = 0x01000000;
|
||||
for (i = 0; i < MEMWIN_16M_MAX; i++) {
|
||||
ch->ch_cmemt[i] = bus_space_create("PCMCIA common memory",
|
||||
ch->ch_cmemt[i] = bus_space_create(0, "PCMCIA common memory",
|
||||
membase + 0x01000000,
|
||||
ch->ch_memsize);
|
||||
fixup_sh3_pcmcia_area(ch->ch_cmemt[i]);
|
||||
}
|
||||
|
||||
/* I/O port extent and interrupt staff */
|
||||
@ -384,10 +399,10 @@ hd64461pcmcia_attach_channel(struct hd64461pcmcia_softc *sc,
|
||||
if (channel == CHANNEL_0) {
|
||||
ch->ch_iobase = 0;
|
||||
ch->ch_iosize = HD64461_PCC0_IOSIZE;
|
||||
ch->ch_iot = bus_space_create("PCMCIA I/O port",
|
||||
ch->ch_iot = bus_space_create(0, "PCMCIA I/O port",
|
||||
HD64461_PCC0_IOBASE,
|
||||
ch->ch_iosize);
|
||||
|
||||
fixup_sh3_pcmcia_area(ch->ch_iot);
|
||||
|
||||
hd64461_intr_establish(HD64461_IRQ_PCC0, IST_LEVEL, IPL_TTY,
|
||||
hd64461pcmcia_channel0_intr, ch);
|
||||
@ -615,7 +630,7 @@ _chip_mem_map(pcmcia_chipset_handle_t pch, int kind, bus_addr_t card_addr,
|
||||
&cookie->wc_handle) != 0)
|
||||
goto bad;
|
||||
|
||||
// XXX bogus. bus_space_tag should be vtbl...
|
||||
// XXX bogus. check window per common memory access.
|
||||
memory_window_16(ch->ch_channel, window);
|
||||
*offsetp = ofs + 0x01000000; /* skip attribute area */
|
||||
cookie->wc_window = window;
|
||||
@ -664,7 +679,7 @@ _chip_io_alloc(pcmcia_chipset_handle_t pch, bus_addr_t start, bus_size_t size,
|
||||
DPRINTF("map %#lx+%#lx\n", start, size);
|
||||
} else {
|
||||
if (bus_space_alloc(ch->ch_iot, ch->ch_iobase,
|
||||
ch->ch_iobase + ch->ch_iosize,
|
||||
ch->ch_iobase + ch->ch_iosize - 1,
|
||||
size, align, 0, 0, &pcihp->addr,
|
||||
&pcihp->ioh)) {
|
||||
DPRINTF("couldn't allocate %#lx\n", size);
|
||||
@ -1026,6 +1041,17 @@ set_bus_width(enum controller_channel channel, int width)
|
||||
SHREG_BCR2 = r16;
|
||||
}
|
||||
|
||||
static void
|
||||
fixup_sh3_pcmcia_area(bus_space_tag_t t)
|
||||
{
|
||||
struct hpcsh_bus_space *hbs = (void *)t;
|
||||
|
||||
hbs->hbs_w_1 = _sh3_pcmcia_bug_write_1;
|
||||
hbs->hbs_wm_1 = _sh3_pcmcia_bug_write_multi_1;
|
||||
hbs->hbs_wr_1 = _sh3_pcmcia_bug_write_region_1;
|
||||
hbs->hbs_sm_1 = _sh3_pcmcia_bug_set_multi_1;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
static void
|
||||
hd64461pcmcia_info(struct hd64461pcmcia_softc *sc)
|
||||
@ -1207,4 +1233,3 @@ hd64461pcmcia_info(struct hd64461pcmcia_softc *sc)
|
||||
dbg_banner_end();
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
228
sys/arch/hpcsh/dev/hd64461/hd64461uart.c
Normal file
228
sys/arch/hpcsh/dev/hd64461/hd64461uart.c
Normal file
@ -0,0 +1,228 @@
|
||||
/* $NetBSD: hd64461uart.c,v 1.1 2001/03/15 17:30:56 uch Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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 <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <sys/termios.h>
|
||||
#include <dev/cons.h>
|
||||
#include <sys/conf.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/intr.h>
|
||||
|
||||
#include <dev/ic/comvar.h>
|
||||
#include <dev/ic/comreg.h>
|
||||
|
||||
#ifdef DEBUG
|
||||
#include <hpcsh/hpcsh/debug.h>
|
||||
#endif
|
||||
|
||||
#include <hpcsh/dev/hd64461/hd64461var.h>
|
||||
#include <hpcsh/dev/hd64461/hd64461reg.h>
|
||||
#include <hpcsh/dev/hd64461/hd64461intcvar.h>
|
||||
|
||||
#include <hpcsh/dev/hd64461/hd64461uartvar.h>
|
||||
|
||||
static struct hd64461uart_chip {
|
||||
struct hpcsh_bus_space __tag_body;
|
||||
bus_space_tag_t io_tag;
|
||||
int console;
|
||||
} hd64461uart_chip;
|
||||
|
||||
struct hd64461uart_softc {
|
||||
struct com_softc sc_com;
|
||||
|
||||
struct hd64461uart_chip *sc_chip;
|
||||
enum hd64461_module_id sc_module_id;
|
||||
};
|
||||
|
||||
/* boot console */
|
||||
cdev_decl(com);
|
||||
void comcnprobe(struct consdev *);
|
||||
void comcninit(struct consdev *);
|
||||
|
||||
static int hd64461uart_match(struct device *, struct cfdata *, void *);
|
||||
static void hd64461uart_attach(struct device *, struct device *, void *);
|
||||
|
||||
struct cfattach hd64461uart_ca = {
|
||||
sizeof(struct hd64461uart_softc), hd64461uart_match,
|
||||
hd64461uart_attach
|
||||
};
|
||||
|
||||
static void hd64461uart_init(void);
|
||||
static u_int8_t hd64461uart_read_1(void *, bus_space_handle_t, bus_size_t);
|
||||
static void hd64461uart_write_1(void *, bus_space_handle_t, bus_size_t,
|
||||
u_int8_t);
|
||||
|
||||
#ifdef DEBUG
|
||||
static void hd64461uart_info(struct hd64461uart_softc *);
|
||||
#endif
|
||||
|
||||
#define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
|
||||
#ifndef COMCN_SPEED
|
||||
#define COMCN_SPEED 19200
|
||||
#endif
|
||||
|
||||
void
|
||||
hd64461uart_cnattach()
|
||||
{
|
||||
hd64461uart_init();
|
||||
|
||||
comcnattach(hd64461uart_chip.io_tag, 0x0, COMCN_SPEED, COM_FREQ,
|
||||
CONMODE);
|
||||
}
|
||||
|
||||
void
|
||||
comcnprobe(struct consdev *cp)
|
||||
{
|
||||
int maj;
|
||||
|
||||
/* locate the major number */
|
||||
for (maj = 0; maj < nchrdev; maj++)
|
||||
if (cdevsw[maj].d_open == comopen)
|
||||
break;
|
||||
|
||||
/* Initialize required fields. */
|
||||
cp->cn_dev = makedev(maj, 0);
|
||||
cp->cn_pri = CN_NORMAL;
|
||||
}
|
||||
|
||||
void
|
||||
comcninit(struct consdev *cp)
|
||||
{
|
||||
hd64461uart_chip.console = 1;
|
||||
}
|
||||
|
||||
static int
|
||||
hd64461uart_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct hd64461_attach_args *ha = aux;
|
||||
|
||||
return (ha->ha_module_id == HD64461_MODULE_UART);
|
||||
}
|
||||
|
||||
static void
|
||||
hd64461uart_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct hd64461_attach_args *ha = aux;
|
||||
struct hd64461uart_softc *sc = (struct hd64461uart_softc *)self;
|
||||
struct com_softc *csc = &sc->sc_com;
|
||||
u_int16_t r16;
|
||||
|
||||
sc->sc_chip = &hd64461uart_chip;
|
||||
if (sc->sc_chip->console)
|
||||
printf(": console\n");
|
||||
|
||||
sc->sc_module_id = ha->ha_module_id;
|
||||
|
||||
hd64461uart_init();
|
||||
|
||||
csc->sc_iot = sc->sc_chip->io_tag;
|
||||
bus_space_map(csc->sc_iot, 0, 8, 0, &csc->sc_ioh);
|
||||
csc->sc_iobase = 0;
|
||||
csc->sc_frequency = COM_FREQ;
|
||||
|
||||
/* switch port to UART */
|
||||
|
||||
/* supply clock */
|
||||
r16 = hd64461_reg_read_2(HD64461_SYSSTBCR_REG16);
|
||||
r16 &= ~HD64461_SYSSTBCR_SURTSD;
|
||||
hd64461_reg_write_2(HD64461_SYSSTBCR_REG16, r16);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (bootverbose)
|
||||
hd64461uart_info(sc);
|
||||
#endif
|
||||
/* sanity check */
|
||||
if (!comprobe1(csc->sc_iot, csc->sc_ioh)) {
|
||||
printf(": device problem. don't attach.\n");
|
||||
|
||||
/* stop clock */
|
||||
r16 |= HD64461_SYSSTBCR_SURTSD;
|
||||
hd64461_reg_write_2(HD64461_SYSSTBCR_REG16, r16);
|
||||
return;
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
com_attach_subr(csc);
|
||||
|
||||
hd64461_intr_establish(HD64461_IRQ_UART, IST_LEVEL, IPL_TTY,
|
||||
comintr, self);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
hd64461uart_init()
|
||||
{
|
||||
if (hd64461uart_chip.io_tag)
|
||||
return;
|
||||
|
||||
hd64461uart_chip.io_tag = bus_space_create(
|
||||
&hd64461uart_chip.__tag_body, "HD64461 UART I/O",
|
||||
HD64461_UART_REGBASE, 0); /* no extent */
|
||||
|
||||
/* override bus_space_read_1, bus_space_write_1 */
|
||||
hd64461uart_chip.io_tag->hbs_r_1 = hd64461uart_read_1;
|
||||
hd64461uart_chip.io_tag->hbs_w_1 = hd64461uart_write_1;
|
||||
}
|
||||
|
||||
static u_int8_t
|
||||
hd64461uart_read_1(void *t, bus_space_handle_t h, bus_size_t ofs)
|
||||
{
|
||||
return *(volatile u_int8_t *)(h + (ofs << 1));
|
||||
}
|
||||
|
||||
static void
|
||||
hd64461uart_write_1(void *t, bus_space_handle_t h, bus_size_t ofs,
|
||||
u_int8_t val)
|
||||
{
|
||||
|
||||
*(volatile u_int8_t *)(h + (ofs << 1)) = val;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
static void
|
||||
hd64461uart_info(struct hd64461uart_softc *sc)
|
||||
{
|
||||
const char name[] = __FUNCTION__;
|
||||
|
||||
dbg_banner_start(name, sizeof name);
|
||||
dbg_banner_end();
|
||||
}
|
||||
#endif /* DEBUG */
|
39
sys/arch/hpcsh/dev/hd64461/hd64461uartvar.h
Normal file
39
sys/arch/hpcsh/dev/hd64461/hd64461uartvar.h
Normal file
@ -0,0 +1,39 @@
|
||||
/* $NetBSD: hd64461uartvar.h,v 1.1 2001/03/15 17:30:56 uch Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*/
|
||||
|
||||
void hd64461uart_cnattach(void);
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bus_space.c,v 1.2 2001/02/21 16:28:03 uch Exp $ */
|
||||
/* $NetBSD: bus_space.c,v 1.3 2001/03/15 17:30:56 uch Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -33,6 +33,7 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/malloc.h>
|
||||
@ -43,72 +44,179 @@
|
||||
#include <machine/bus.h>
|
||||
|
||||
#ifdef BUS_SPACE_DEBUG
|
||||
#define DPRINTF(arg) printf arg
|
||||
int bus_space_debug = 0;
|
||||
#define DPRINTF(fmt, args...) \
|
||||
if (bus_space_debug) \
|
||||
printf("%s: " fmt, __FUNCTION__ , ##args)
|
||||
#define DPRINTFN(n, arg) \
|
||||
if (bus_space_debug > (n)) \
|
||||
printf("%s: " fmt, __FUNCTION__ , ##args)
|
||||
#else
|
||||
#define DPRINTF(arg)
|
||||
#define DPRINTF(arg...) ((void)0)
|
||||
#define DPRINTFN(n, arg...) ((void)0)
|
||||
#endif
|
||||
|
||||
#define BUS_SPACE_TAG_MAX 16
|
||||
#define _BUS_SPACE_ACCESS_HOOK() ((void)0)
|
||||
_BUS_SPACE_READ(_bus_space, 1, 8)
|
||||
_BUS_SPACE_READ(_bus_space, 2, 16)
|
||||
_BUS_SPACE_READ(_bus_space, 4, 32)
|
||||
_BUS_SPACE_READ(_bus_space, 8, 64)
|
||||
_BUS_SPACE_READ_MULTI(_bus_space, 1, 8)
|
||||
_BUS_SPACE_READ_MULTI(_bus_space, 2, 16)
|
||||
_BUS_SPACE_READ_MULTI(_bus_space, 4, 32)
|
||||
_BUS_SPACE_READ_MULTI(_bus_space, 8, 64)
|
||||
_BUS_SPACE_READ_REGION(_bus_space, 1, 8)
|
||||
_BUS_SPACE_READ_REGION(_bus_space, 2, 16)
|
||||
_BUS_SPACE_READ_REGION(_bus_space, 4, 32)
|
||||
_BUS_SPACE_READ_REGION(_bus_space, 8, 64)
|
||||
_BUS_SPACE_WRITE(_bus_space, 1, 8)
|
||||
_BUS_SPACE_WRITE(_bus_space, 2, 16)
|
||||
_BUS_SPACE_WRITE(_bus_space, 4, 32)
|
||||
_BUS_SPACE_WRITE(_bus_space, 8, 64)
|
||||
_BUS_SPACE_WRITE_MULTI(_bus_space, 1, 8)
|
||||
_BUS_SPACE_WRITE_MULTI(_bus_space, 2, 16)
|
||||
_BUS_SPACE_WRITE_MULTI(_bus_space, 4, 32)
|
||||
_BUS_SPACE_WRITE_MULTI(_bus_space, 8, 64)
|
||||
_BUS_SPACE_WRITE_REGION(_bus_space, 1, 8)
|
||||
_BUS_SPACE_WRITE_REGION(_bus_space, 2, 16)
|
||||
_BUS_SPACE_WRITE_REGION(_bus_space, 4, 32)
|
||||
_BUS_SPACE_WRITE_REGION(_bus_space, 8, 64)
|
||||
_BUS_SPACE_SET_MULTI(_bus_space, 1, 8)
|
||||
_BUS_SPACE_SET_MULTI(_bus_space, 2, 16)
|
||||
_BUS_SPACE_SET_MULTI(_bus_space, 4, 32)
|
||||
_BUS_SPACE_SET_MULTI(_bus_space, 8, 64)
|
||||
_BUS_SPACE_COPY_REGION(_bus_space, 1, 8)
|
||||
_BUS_SPACE_COPY_REGION(_bus_space, 2, 16)
|
||||
_BUS_SPACE_COPY_REGION(_bus_space, 4, 32)
|
||||
_BUS_SPACE_COPY_REGION(_bus_space, 8, 64)
|
||||
#undef _BUS_SPACE_ACCESS_HOOK
|
||||
|
||||
static struct bus_space {
|
||||
vaddr_t t_base; /* extent base */
|
||||
vsize_t t_size; /* extent size */
|
||||
struct extent *t_extent;
|
||||
} bus_space[BUS_SPACE_TAG_MAX];
|
||||
static int bus_space_cnt;
|
||||
static int _bus_space_map(void *, bus_addr_t, bus_size_t, int,
|
||||
bus_space_handle_t *);
|
||||
static void _bus_space_unmap(void *, bus_space_handle_t, bus_size_t);
|
||||
static int _bus_space_subregion(void *, bus_space_handle_t, bus_size_t,
|
||||
bus_size_t, bus_space_handle_t *);
|
||||
static int _bus_space_alloc(void *, bus_addr_t, bus_addr_t, bus_size_t,
|
||||
bus_size_t, bus_size_t, int,
|
||||
bus_addr_t *, bus_space_handle_t *);
|
||||
static void _bus_space_free(void *, bus_space_handle_t, bus_size_t);
|
||||
static void *_bus_space_vaddr(void *, bus_space_handle_t);
|
||||
|
||||
#define CONTEXT_REF(x, t) struct bus_space *x = (struct bus_space *)(t)
|
||||
#define ANONYMOUS(x) (x == BUS_SPACE_TAG_ANONYMOUS)
|
||||
static struct hpcsh_bus_space __default_bus_space = {
|
||||
hbs_extent : 0,
|
||||
hbs_map : _bus_space_map,
|
||||
hbs_unmap : _bus_space_unmap,
|
||||
hbs_subregion : _bus_space_subregion,
|
||||
hbs_alloc : _bus_space_alloc,
|
||||
hbs_free : _bus_space_free,
|
||||
hbs_vaddr : _bus_space_vaddr,
|
||||
hbs_r_1 : _bus_space_read_1,
|
||||
hbs_r_2 : _bus_space_read_2,
|
||||
hbs_r_4 : _bus_space_read_4,
|
||||
hbs_r_8 : _bus_space_read_8,
|
||||
hbs_rm_1 : _bus_space_read_multi_1,
|
||||
hbs_rm_2 : _bus_space_read_multi_2,
|
||||
hbs_rm_4 : _bus_space_read_multi_4,
|
||||
hbs_rm_8 : _bus_space_read_multi_8,
|
||||
hbs_rr_1 : _bus_space_read_region_1,
|
||||
hbs_rr_2 : _bus_space_read_region_2,
|
||||
hbs_rr_4 : _bus_space_read_region_4,
|
||||
hbs_rr_8 : _bus_space_read_region_8,
|
||||
hbs_w_1 : _bus_space_write_1,
|
||||
hbs_w_2 : _bus_space_write_2,
|
||||
hbs_w_4 : _bus_space_write_4,
|
||||
hbs_w_8 : _bus_space_write_8,
|
||||
hbs_wm_1 : _bus_space_write_multi_1,
|
||||
hbs_wm_2 : _bus_space_write_multi_2,
|
||||
hbs_wm_4 : _bus_space_write_multi_4,
|
||||
hbs_wm_8 : _bus_space_write_multi_8,
|
||||
hbs_wr_1 : _bus_space_write_region_1,
|
||||
hbs_wr_2 : _bus_space_write_region_2,
|
||||
hbs_wr_4 : _bus_space_write_region_4,
|
||||
hbs_wr_8 : _bus_space_write_region_8,
|
||||
hbs_sm_1 : _bus_space_set_multi_1,
|
||||
hbs_sm_2 : _bus_space_set_multi_2,
|
||||
hbs_sm_4 : _bus_space_set_multi_4,
|
||||
hbs_sm_8 : _bus_space_set_multi_8,
|
||||
hbs_c_1 : _bus_space_copy_region_1,
|
||||
hbs_c_2 : _bus_space_copy_region_2,
|
||||
hbs_c_4 : _bus_space_copy_region_4,
|
||||
hbs_c_8 : _bus_space_copy_region_8
|
||||
};
|
||||
|
||||
/* create default bus_space_tag */
|
||||
bus_space_tag_t
|
||||
bus_space_create(const char *name, bus_addr_t addr, bus_size_t size)
|
||||
bus_space_create(struct hpcsh_bus_space *hbs, const char *name,
|
||||
bus_addr_t addr, bus_size_t size)
|
||||
{
|
||||
struct bus_space *t;
|
||||
if (hbs == 0)
|
||||
hbs = malloc(sizeof(*hbs), M_DEVBUF, M_NOWAIT);
|
||||
KASSERT(hbs);
|
||||
|
||||
KASSERT(bus_space_cnt < BUS_SPACE_TAG_MAX);
|
||||
memset(hbs, 0, sizeof(*hbs));
|
||||
|
||||
t = &bus_space[bus_space_cnt++];
|
||||
t->t_base = addr;
|
||||
t->t_size = size;
|
||||
t->t_extent = extent_create(name, t->t_base, t->t_base + t->t_size,
|
||||
/* set default method */
|
||||
*hbs = __default_bus_space;
|
||||
hbs->hbs_cookie = hbs;
|
||||
|
||||
/* set access region */
|
||||
if (size == 0) {
|
||||
hbs->hbs_base_addr = addr; /* no extent */
|
||||
} else {
|
||||
hbs->hbs_extent = extent_create(name, addr, addr + size - 1,
|
||||
M_DEVBUF, 0, 0, EX_NOWAIT);
|
||||
|
||||
if (!t->t_extent) {
|
||||
panic("bus_space_create: unable to create bus_space for"
|
||||
" 0x%08x-%#x\n", (unsigned)addr, (unsigned)size);
|
||||
if (hbs->hbs_extent == 0) {
|
||||
panic("%s:: unable to create bus_space for "
|
||||
"0x%08lx-%#lx\n", __FUNCTION__, addr, size);
|
||||
}
|
||||
}
|
||||
|
||||
return (bus_space_tag_t)t;
|
||||
return hbs;
|
||||
}
|
||||
|
||||
int
|
||||
bus_space_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags,
|
||||
void
|
||||
bus_space_destroy(bus_space_tag_t t)
|
||||
{
|
||||
struct hpcsh_bus_space *hbs = t;
|
||||
struct extent *ex = hbs->hbs_extent;
|
||||
|
||||
if (ex != 0)
|
||||
extent_destroy(ex);
|
||||
|
||||
free(t, M_DEVBUF);
|
||||
}
|
||||
|
||||
/* default bus_space tag */
|
||||
static int
|
||||
_bus_space_map(void *t, bus_addr_t bpa, bus_size_t size, int flags,
|
||||
bus_space_handle_t *bshp)
|
||||
{
|
||||
struct hpcsh_bus_space *hbs = t;
|
||||
struct extent *ex = hbs->hbs_extent;
|
||||
int error;
|
||||
CONTEXT_REF(_t, t);
|
||||
|
||||
if (ANONYMOUS(_t)) {
|
||||
*bshp = (bus_space_handle_t)bpa;
|
||||
if (ex == 0) {
|
||||
*bshp = (bus_space_handle_t)(bpa + hbs->hbs_base_addr);
|
||||
return (0);
|
||||
}
|
||||
|
||||
bpa += _t->t_base;
|
||||
error = extent_alloc_region(_t->t_extent, bpa, size,
|
||||
EX_NOWAIT | EX_MALLOCOK);
|
||||
if (error)
|
||||
bpa += ex->ex_start;
|
||||
error = extent_alloc_region(ex, bpa, size, EX_NOWAIT | EX_MALLOCOK);
|
||||
|
||||
if (error) {
|
||||
DPRINTF("failed.\n");
|
||||
return (error);
|
||||
}
|
||||
|
||||
*bshp = (bus_space_handle_t)bpa;
|
||||
|
||||
DPRINTF(("\tbus_space_map:%#x(%#x)+%#x\n", bpa,
|
||||
bpa - t->t_base, size));
|
||||
DPRINTF("success.\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
bus_space_subregion(bus_space_tag_t t, bus_space_handle_t bsh,
|
||||
static int
|
||||
_bus_space_subregion(void *t, bus_space_handle_t bsh,
|
||||
bus_size_t offset, bus_size_t size,
|
||||
bus_space_handle_t *nbshp)
|
||||
{
|
||||
@ -117,63 +225,73 @@ bus_space_subregion(bus_space_tag_t t, bus_space_handle_t bsh,
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
bus_space_alloc(bus_space_tag_t t, bus_addr_t rstart, bus_addr_t rend,
|
||||
static int
|
||||
_bus_space_alloc(void *t, bus_addr_t rstart, bus_addr_t rend,
|
||||
bus_size_t size, bus_size_t alignment, bus_size_t boundary,
|
||||
int flags, bus_addr_t *bpap, bus_space_handle_t *bshp)
|
||||
{
|
||||
u_long bpa;
|
||||
struct hpcsh_bus_space *hbs = t;
|
||||
struct extent *ex = hbs->hbs_extent;
|
||||
u_long bpa, base;
|
||||
int error;
|
||||
CONTEXT_REF(_t, t);
|
||||
|
||||
if (ANONYMOUS(_t)) {
|
||||
*bshp = *bpap = rstart;
|
||||
if (ex == 0) {
|
||||
*bshp = *bpap = rstart + hbs->hbs_base_addr;
|
||||
return (0);
|
||||
}
|
||||
|
||||
rstart += _t->t_base;
|
||||
rend += _t->t_base;
|
||||
error = extent_alloc_subregion(_t->t_extent, rstart, rend, size,
|
||||
base = ex->ex_start;
|
||||
|
||||
error = extent_alloc_subregion(ex, rstart + base, rend + base, size,
|
||||
alignment, boundary,
|
||||
EX_FAST | EX_NOWAIT | EX_MALLOCOK,
|
||||
&bpa);
|
||||
if (error)
|
||||
|
||||
if (error) {
|
||||
DPRINTF("failed.\n");
|
||||
return (error);
|
||||
}
|
||||
|
||||
*bshp = (bus_space_handle_t)bpa;
|
||||
|
||||
if (bpap)
|
||||
*bpap = bpa;
|
||||
|
||||
DPRINTF(("\tbus_space_alloc:%#x(%#x)+%#x\n", (unsigned)bpa,
|
||||
(unsigned)(bpa - t->t_base), size));
|
||||
DPRINTF("success.\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_free(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size)
|
||||
static void
|
||||
_bus_space_free(void *t, bus_space_handle_t bsh, bus_size_t size)
|
||||
{
|
||||
CONTEXT_REF(_t, t);
|
||||
struct hpcsh_bus_space *hbs = t;
|
||||
struct extent *ex = hbs->hbs_extent;
|
||||
|
||||
if (!ANONYMOUS(_t)) {
|
||||
bus_space_unmap(t, bsh, size);
|
||||
}
|
||||
if (ex != 0)
|
||||
_bus_space_unmap(t, bsh, size);
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size)
|
||||
static void
|
||||
_bus_space_unmap(void *t, bus_space_handle_t bsh, bus_size_t size)
|
||||
{
|
||||
struct hpcsh_bus_space *hbs = t;
|
||||
struct extent *ex = hbs->hbs_extent;
|
||||
int error;
|
||||
CONTEXT_REF(_t, t);
|
||||
|
||||
if (ANONYMOUS(_t))
|
||||
if (ex == 0)
|
||||
return;
|
||||
|
||||
error = extent_free(_t->t_extent, bsh, size, EX_NOWAIT);
|
||||
error = extent_free(ex, bsh, size, EX_NOWAIT);
|
||||
|
||||
if (error) {
|
||||
DPRINTF(("warning: %#x-%#x of %s space lost\n",
|
||||
bsh, bsh+size, t->t_name));
|
||||
DPRINTF("%#lx-%#lx of %s space lost\n", bsh, bsh + size,
|
||||
ex->ex_name);
|
||||
}
|
||||
}
|
||||
|
||||
void *
|
||||
_bus_space_vaddr(void *t, bus_space_handle_t h)
|
||||
{
|
||||
return (void *)h;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: conf.c,v 1.3 2001/02/09 19:54:11 uch Exp $ */
|
||||
/* $NetBSD: conf.c,v 1.4 2001/03/15 17:30:56 uch Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -136,6 +136,8 @@ cons_decl(com);
|
||||
cdev_decl(sci);
|
||||
#include "scif.h"
|
||||
cdev_decl(scif);
|
||||
#include "com.h"
|
||||
cdev_decl(com);
|
||||
|
||||
#include "biconsdev.h"
|
||||
cdev_decl(biconsdev);
|
||||
@ -166,7 +168,7 @@ struct cdevsw cdevsw[] =
|
||||
cdev_log_init(1,log), /* 5: /dev/klog */
|
||||
cdev_ptc_init(NPTY,ptc), /* 6: pseudo-tty master */
|
||||
cdev_tty_init(NPTY,pts), /* 7: pseudo-tty slave */
|
||||
cdev_notdef(), /* 8: (reserved) NS16550 compatible */
|
||||
cdev_tty_init(NCOM,com), /* 8: NS16550 compatible */
|
||||
cdev_notdef(), /* 9: (reserved) parallel printer*/
|
||||
cdev_disk_init(NWD, wd), /* 10: ST506/ESDI/IDE disk */
|
||||
cdev_notdef(), /* 11: (reserved) floppy diskette */
|
||||
@ -244,22 +246,6 @@ static int chrtoblktbl[] = {
|
||||
/* 40 */ NODEV,
|
||||
};
|
||||
|
||||
struct consdev constab[] = {
|
||||
#if NBICONSDEV > 0
|
||||
cons_init(bicons),
|
||||
#endif
|
||||
#if NSCI > 0
|
||||
cons_init(sci),
|
||||
#endif
|
||||
#if NSCIF > 0
|
||||
cons_init(scif),
|
||||
#endif
|
||||
#if NCOM > 0
|
||||
cons_init(com),
|
||||
#endif
|
||||
{ 0 },
|
||||
};
|
||||
|
||||
/*
|
||||
* Swapdev is a fake block device implemented in sw.c and only used
|
||||
* internally to get to swstrategy. It cannot be provided to the
|
||||
|
170
sys/arch/hpcsh/hpcsh/console.c
Normal file
170
sys/arch/hpcsh/hpcsh/console.c
Normal file
@ -0,0 +1,170 @@
|
||||
/* $NetBSD: console.c,v 1.1 2001/03/15 17:30:56 uch Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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 "biconsdev.h"
|
||||
#include "hpcfb.h"
|
||||
#include "pfckbd.h"
|
||||
#include "sci.h"
|
||||
#include "scif.h"
|
||||
#include "com.h"
|
||||
#include "hd64461if.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/conf.h> /* cdev_decl */
|
||||
#include <dev/cons.h> /* consdev */
|
||||
#include <dev/cons.h>
|
||||
|
||||
#include <machine/bootinfo.h>
|
||||
|
||||
#if NBICONSDEV > 0
|
||||
#include <dev/hpc/biconsvar.h>
|
||||
#include <dev/hpc/bicons.h>
|
||||
#define DPRINTF(arg) printf arg
|
||||
#else
|
||||
#define DPRINTF(arg)
|
||||
#endif
|
||||
|
||||
#if NHPCFB > 0
|
||||
#include <dev/wscons/wsdisplayvar.h>
|
||||
#include <dev/rasops/rasops.h>
|
||||
#include <dev/hpc/hpcfbvar.h>
|
||||
#endif
|
||||
#if NPFCKBD > 0
|
||||
#include <hpcsh/dev/pfckbdvar.h>
|
||||
#endif
|
||||
|
||||
#if NHD64461IF > 0 && NCOM > 0
|
||||
#include <hpcsh/dev/hd64461/hd64461uartvar.h>
|
||||
#endif
|
||||
|
||||
/* serial console */
|
||||
#define scicnpollc nullcnpollc
|
||||
cdev_decl(sci);
|
||||
cons_decl(sci);
|
||||
#define scifcnpollc nullcnpollc
|
||||
cdev_decl(scif);
|
||||
cons_decl(scif);
|
||||
cdev_decl(com);
|
||||
cons_decl(com);
|
||||
|
||||
/* builtin video console */
|
||||
#define biconscnpollc nullcnpollc
|
||||
cdev_decl(biconsdev);
|
||||
cons_decl(bicons);
|
||||
|
||||
struct consdev constab[] = {
|
||||
#if NBICONSDEV > 0
|
||||
cons_init(bicons),
|
||||
#endif
|
||||
#if NSCI > 0
|
||||
cons_init(sci),
|
||||
#endif
|
||||
#if NSCIF > 0
|
||||
cons_init(scif),
|
||||
#endif
|
||||
#if NCOM > 0
|
||||
cons_init(com),
|
||||
#endif
|
||||
{ 0 } /* terminator */
|
||||
};
|
||||
#define CN_SELECTED (CN_REMOTE + 1) /* highest priority */
|
||||
|
||||
static int initialized;
|
||||
|
||||
static void
|
||||
set_console(void (*probe_func)(struct consdev *))
|
||||
{
|
||||
struct consdev *cp;
|
||||
|
||||
for (cp = constab; cp->cn_probe; cp++) {
|
||||
if (cp->cn_probe == probe_func) {
|
||||
cp->cn_pri = CN_SELECTED;
|
||||
initialized = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
consinit()
|
||||
{
|
||||
struct consdev *cp;
|
||||
|
||||
if (initialized)
|
||||
return;
|
||||
|
||||
/* select console */
|
||||
for (cp = constab; cp->cn_probe; cp++)
|
||||
cp->cn_pri = CN_DEAD;
|
||||
|
||||
switch (bootinfo->bi_cnuse) {
|
||||
case BI_CNUSE_BUILTIN:
|
||||
#if NBICONSDEV > 0
|
||||
set_console(biconscnprobe);
|
||||
#endif
|
||||
break;
|
||||
case BI_CNUSE_SCI:
|
||||
#if NSCI > 0
|
||||
set_console(scicnprobe);
|
||||
#endif
|
||||
break;
|
||||
case BI_CNUSE_SCIF:
|
||||
#if NSCIF > 0
|
||||
set_console(scifcnprobe);
|
||||
#endif
|
||||
break;
|
||||
case BI_CNUSE_HD64461COM:
|
||||
#if NHD64461IF > 0 && NCOM > 0
|
||||
set_console(comcnprobe);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
if (initialized)
|
||||
cninit();
|
||||
|
||||
if (bootinfo->bi_cnuse == BI_CNUSE_BUILTIN) {
|
||||
#if NPFCKBD > 0
|
||||
pfckbd_cnattach();
|
||||
#endif
|
||||
#if NHPCFB > 0
|
||||
hpcfb_cnattach(0);
|
||||
#endif
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: machdep.c,v 1.5 2001/02/24 20:17:45 uch Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.6 2001/03/15 17:30:56 uch Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -32,14 +32,12 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#undef LOAD_ALL_MEMORY
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_syscall_debug.h"
|
||||
#include "fs_mfs.h"
|
||||
#include "fs_nfs.h"
|
||||
#include "biconsdev.h"
|
||||
#include "hpcfb.h"
|
||||
#include "pfckbd.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -48,15 +46,14 @@
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <sys/kcore.h>
|
||||
|
||||
#include <sys/msgbuf.h>
|
||||
#include <sys/boot_flag.h>
|
||||
|
||||
#include <dev/cons.h>
|
||||
#include <ufs/mfs/mfs_extern.h> /* mfs_initminiroot() */
|
||||
|
||||
#include <sys/boot_flag.h>
|
||||
#include <dev/cons.h> /* consdev */
|
||||
|
||||
#include <machine/bootinfo.h>
|
||||
#include <machine/platid.h>
|
||||
#include <machine/platid_mask.h>
|
||||
@ -65,22 +62,11 @@
|
||||
#include <sh3/intcreg.h>
|
||||
|
||||
#if NBICONSDEV > 0
|
||||
#include <dev/hpc/biconsvar.h>
|
||||
#include <dev/hpc/bicons.h>
|
||||
#define DPRINTF(arg) printf arg
|
||||
#else
|
||||
#define DPRINTF(arg)
|
||||
#endif
|
||||
|
||||
#if NHPCFB > 0
|
||||
#include <dev/wscons/wsdisplayvar.h>
|
||||
#include <dev/rasops/rasops.h>
|
||||
#include <dev/hpc/hpcfbvar.h>
|
||||
#endif
|
||||
#if NPFCKBD > 0
|
||||
#include <hpcsh/dev/pfckbdvar.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* D-RAM location (Windows CE machine specific)
|
||||
*
|
||||
@ -160,10 +146,7 @@ phys_ram_seg_t mem_clusters[VM_PHYSSEG_MAX];
|
||||
int physmem; /* in hpcsh port, page unit */
|
||||
|
||||
/* Console */
|
||||
#include <sys/conf.h> /* cdev_decl */
|
||||
#include <dev/cons.h> /* consdev */
|
||||
#define scicnpollc nullcnpollc
|
||||
#define scifcnpollc nullcnpollc
|
||||
extern void consinit(void);
|
||||
|
||||
void main(void);
|
||||
void machine_startup(int, char *[], struct bootinfo *);
|
||||
@ -201,12 +184,9 @@ machine_startup(int argc, char *argv[], struct bootinfo *bi)
|
||||
/* setup bootstrap options */
|
||||
makebootdev("wd0"); /* default boot device */
|
||||
boothowto = 0;
|
||||
for (i = 1; i < argc; i++) { // skip 1st arg (kernel name).
|
||||
for (i = 1; i < argc; i++) { /* skip 1st arg (kernel name). */
|
||||
char *cp = argv[i];
|
||||
switch (*cp) {
|
||||
case 'h':
|
||||
bootinfo->bi_cnuse |= BI_CNUSE_SERIAL;
|
||||
break;
|
||||
case 'b':
|
||||
/* boot device: -b=sd0 etc. */
|
||||
p = cp + 2;
|
||||
@ -224,6 +204,7 @@ machine_startup(int argc, char *argv[], struct bootinfo *bi)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MFS
|
||||
/*
|
||||
* Check to see if a mini-root was loaded into memory. It resides
|
||||
@ -440,7 +421,7 @@ haltsys:
|
||||
doshutdownhooks();
|
||||
|
||||
/* Finally, halt/reboot the system. */
|
||||
DPRINTF(("%s\n\n", howto & RB_HALT ? "halted." : "rebooting..."));
|
||||
printf("%s\n\n", howto & RB_HALT ? "halted." : "rebooting...");
|
||||
|
||||
goto *(u_int32_t *)0xa0000000;
|
||||
while (1)
|
||||
@ -482,7 +463,7 @@ mem_cluster_init(paddr_t addr)
|
||||
|
||||
/* search CS3 */
|
||||
__find_dram_shadow(addr, DRAM_BANK0_END);
|
||||
#if notyet //XXX bank 0 only
|
||||
#ifdef LOAD_ALL_MEMORY /* notyet */
|
||||
__find_dram_shadow(DRAM_BANK1_START, DRAM_BANK1_END);
|
||||
#endif
|
||||
DPRINTF(("mem_cluster_cnt = %d\n", mem_cluster_cnt));
|
||||
@ -515,7 +496,7 @@ mem_cluster_load()
|
||||
{
|
||||
paddr_t start, end;
|
||||
psize_t size;
|
||||
#if notyet
|
||||
#ifdef LOAD_ALL_MEMORY /* notyet */
|
||||
int i;
|
||||
|
||||
/* Cluster 0 is always the kernel, which doesn't get loaded. */
|
||||
@ -625,26 +606,3 @@ __find_dram_shadow(paddr_t start, paddr_t end)
|
||||
|
||||
mem_cluster_cnt++;
|
||||
}
|
||||
|
||||
void
|
||||
consinit()
|
||||
{
|
||||
static int initted;
|
||||
|
||||
if (initted)
|
||||
return;
|
||||
initted = 1;
|
||||
#if NBICONSDEV > 0
|
||||
if (!(bootinfo->bi_cnuse & BI_CNUSE_SERIAL))
|
||||
bicons_set_priority(CN_REMOTE + 1); /* set highest */
|
||||
#endif
|
||||
cninit();
|
||||
if (!(bootinfo->bi_cnuse & BI_CNUSE_SERIAL)) {
|
||||
#if NPFCKBD > 0
|
||||
pfckbd_cnattach();
|
||||
#endif
|
||||
#if NHPCFB > 0
|
||||
hpcfb_cnattach(0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: shb.c,v 1.3 2001/02/24 20:17:45 uch Exp $ */
|
||||
/* $NetBSD: shb.c,v 1.4 2001/03/15 17:30:56 uch Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994 Charles Hannum. All rights reserved.
|
||||
@ -97,8 +97,8 @@ shbattach(parent, self, aux)
|
||||
|
||||
printf("\n");
|
||||
|
||||
sc->sc_iot = BUS_SPACE_TAG_ANONYMOUS;
|
||||
sc->sc_memt = BUS_SPACE_TAG_ANONYMOUS;
|
||||
sc->sc_iot = 0;
|
||||
sc->sc_memt = 0;
|
||||
|
||||
TAILQ_INIT(&sc->sc_subdevs);
|
||||
config_search(shbsearch, self, NULL);
|
||||
|
@ -1,3 +1,8 @@
|
||||
/* $NetBSD: bootinfo.h,v 1.3 2001/02/07 15:29:22 uch Exp $ */
|
||||
/* $NetBSD: bootinfo.h,v 1.4 2001/03/15 17:30:56 uch Exp $ */
|
||||
|
||||
#include <hpc/hpc/bootinfo.h>
|
||||
|
||||
/* hpcsh specific goo */
|
||||
#define BI_CNUSE_SCI 2
|
||||
#define BI_CNUSE_SCIF 3
|
||||
#define BI_CNUSE_HD64461COM 4
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user