EV64260 now gets to single user prompt using COM1 (2nd uart) as console
with PPCBOOT as firmware. XXX PCI devices are not found.
This commit is contained in:
parent
08ea2a499c
commit
f5110f7988
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: EV64260,v 1.1 2003/03/05 22:08:24 matt Exp $
|
||||
# $NetBSD: EV64260,v 1.2 2003/03/16 07:07:17 matt Exp $
|
||||
#
|
||||
# MVP -- Motorola's Multiprocessing Verification Platform
|
||||
#
|
||||
|
@ -14,11 +14,12 @@ maxusers 32
|
|||
#options UVMHIST_PRINT
|
||||
|
||||
# Discovery options
|
||||
options ALTIVEC
|
||||
options GT_MPP_INTERRUPTS=0x2c600000
|
||||
#options GT_MPP_WATCHDOG=0x00000000
|
||||
options MPSC_CONSOLE
|
||||
options GT_MPP_WATCHDOG=0x03000000
|
||||
#options MPSC_CONSOLE
|
||||
options GT_MPSC_DEFAULT_BAUD_RATE=9600
|
||||
options GT_BASE=0x14000000
|
||||
options GT_BASE=0xF8000000
|
||||
|
||||
# Options for necessary to use MD
|
||||
#options MEMORY_DISK_HOOKS
|
||||
|
@ -46,11 +47,10 @@ options SYSVSHM # System V shared memory
|
|||
#options DEBUG # expensive debugging checks/support
|
||||
options DDB # in-kernel debugger
|
||||
options DDB_HISTORY_SIZE=512 # enable history editing in DDB
|
||||
options TRAP_PANICWAIT
|
||||
options SYMTAB_SPACE=300000 # size for embedded symbol table
|
||||
|
||||
#makeoptions DEFCOPTS="-g" # compile full symbol table
|
||||
#makeoptions DEBUG="-g"
|
||||
makeoptions DEBUG="-g"
|
||||
|
||||
# Compatibility options
|
||||
#options COMPAT_09 # NetBSD 0.9,
|
||||
|
@ -120,7 +120,7 @@ options PCIVERBOSE # verbose PCI device autoconfig messages
|
|||
options MIIVERBOSE # verbose PHY autoconfig messages
|
||||
#options PCI_CONFIG_DUMP # verbosely dump PCI config space
|
||||
#options SCSIVERBOSE # human readable SCSI error messages
|
||||
options PCI_NETBSD_CONFIGURE # Do not rely on BIOS/whatever to configure PCI devices
|
||||
#options PCI_NETBSD_CONFIGURE # Do not rely on BIOS/whatever to configure PCI devices
|
||||
#options PCI_CONFIGURE_VERBOSE # Show PCI config information
|
||||
|
||||
# wscons options
|
||||
|
@ -147,15 +147,20 @@ gtpci1 at gt0 unit 1 # 64-bit, 66MHz
|
|||
|
||||
pci* at gtpci?
|
||||
|
||||
# 16550s off CS2
|
||||
obio2 at gt0 unit 2 # Chip Select 2
|
||||
com0 at obio2 offset 0x0020 size 8 irq 85
|
||||
com1 at obio2 offset 0x0000 size 8 irq 86
|
||||
|
||||
# UARTs
|
||||
gtmpsc0 at gt0 unit 0 # Serial #0
|
||||
#gtmpsc1 at gt0 unit 1 # Serial #1
|
||||
gtmpsc1 at gt0 unit 1 # Serial #1
|
||||
|
||||
# Ethernet and PHY
|
||||
gfe0 at gt0 unit 0 # Ethernet #0
|
||||
gfe1 at gt0 unit 1 # Ethernet #1
|
||||
gfe2 at gt0 unit 2 # Ethernet #2
|
||||
#acphy* at mii? phy ?
|
||||
gfe0 at gt0 unit 0 flags 1 # Ethernet #0 (RMMI)
|
||||
gfe1 at gt0 unit 1 flags 1 # Ethernet #1 (RMMI)
|
||||
gfe2 at gt0 unit 2 flags 1 # Ethernet #2 (RMMI)
|
||||
acphy* at mii? phy ?
|
||||
|
||||
# PCI devices
|
||||
ppb* at pci? dev ? function ? # PCI-PCI bridges
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
# $NetBSD: Makefile.ev64260.inc,v 1.1 2003/03/05 22:08:24 matt Exp $
|
||||
# $NetBSD: Makefile.ev64260.inc,v 1.2 2003/03/16 07:07:17 matt Exp $
|
||||
|
||||
TEXTADDR?= 100000
|
||||
MKIMG?= ${THISPPC}/compile/walnut-mkimg.sh
|
||||
|
||||
TEXTADDR?= 300000
|
||||
|
||||
SYSTEM_FIRST_OBJ= ${BOARDTYPE}_locore.o
|
||||
SYSTEM_FIRST_SFILE= ${THISPPC}/${BOARDTYPE}/${BOARDTYPE}_locore.S
|
||||
|
@ -10,3 +12,8 @@ SYSTEM_LD_TAIL_EXTRA+=; \
|
|||
echo "${DBSYM} $@ || true"; \
|
||||
${DBSYM} $@ || true
|
||||
.endif
|
||||
|
||||
SYSTEM_LD_TAIL_EXTRA+=; \
|
||||
echo ${MKIMG} netbsd netbsd.img ; \
|
||||
OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; export OBJDUMP OBJCOPY; \
|
||||
${MKIMG} $@ $@.img
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# $NetBSD: files.ev64260,v 1.1 2003/03/05 22:08:25 matt Exp $
|
||||
# $NetBSD: files.ev64260,v 1.2 2003/03/16 07:07:17 matt Exp $
|
||||
#
|
||||
# Marvell (Galileo) "EV64260" evaluation board's specific configuration info
|
||||
#
|
||||
file dev/cninit.c
|
||||
#file dev/cninit.c
|
||||
|
||||
file arch/evbppc/ev64260/autoconf.c
|
||||
file arch/evbppc/ev64260/bus_space.c
|
||||
#file arch/evbppc/ev64260/bus_space.c
|
||||
file arch/evbppc/ev64260/clock.c
|
||||
file arch/evbppc/ev64260/machdep.c
|
||||
#file arch/evbppc/ev64260/pci_machdep.c
|
||||
|
@ -13,6 +13,7 @@ file arch/evbppc/ev64260/machdep.c
|
|||
#file arch/powerpc/marvell/bus_dma.c
|
||||
file arch/powerpc/marvell/extintr.c
|
||||
file arch/powerpc/powerpc/bus_dma.c
|
||||
file arch/powerpc/powerpc/bus_space.c
|
||||
|
||||
include "dev/marvell/files.discovery"
|
||||
|
||||
|
@ -52,6 +53,10 @@ file arch/evbppc/ev64260/gt_mainbus.c gt
|
|||
device cpu
|
||||
attach cpu at mainbus
|
||||
|
||||
# com port
|
||||
attach com at obio with com_obio
|
||||
file arch/evbppc/ev64260/com_obio.c com_obio
|
||||
|
||||
#
|
||||
# PCI-only drivers
|
||||
# XXX MUST BE INCLUDED BEFORE files.isa, as long as files.isa attaches
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: majors.evbppc,v 1.5 2003/03/13 17:02:53 matt Exp $
|
||||
# $NetBSD: majors.evbppc,v 1.6 2003/03/16 07:07:18 matt Exp $
|
||||
#
|
||||
# Device majors for evbppc
|
||||
# (When possible, make entries the same as macppc)
|
||||
|
@ -14,7 +14,7 @@ device-major swap char 6 block 1
|
|||
|
||||
device-major bpf char 10 bpfilter
|
||||
device-major tun char 11 tun
|
||||
#device-major gtmpsc char 12 gtmpsc
|
||||
device-major gtmpsc char 12 gtmpsc
|
||||
device-major sd char 13 block 4 sd
|
||||
device-major st char 14 block 5 st
|
||||
device-major cd char 15 block 6 cd
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: std.ev64260,v 1.1 2003/03/05 22:08:25 matt Exp $
|
||||
# $NetBSD: std.ev64260,v 1.2 2003/03/16 07:07:18 matt Exp $
|
||||
#
|
||||
# standard, required NetBSD/evbppc 'options'
|
||||
|
||||
|
@ -11,7 +11,7 @@ makeoptions PPCDIR="oea" # Tell Makefile.powerpc what dir to use
|
|||
options EXEC_ELF32 # exec ELF binaries
|
||||
options EXEC_SCRIPT # exec #! scripts
|
||||
|
||||
makeoptions TEXTADDR=0x120000
|
||||
makeoptions TEXTADDR=0x3000
|
||||
makeoptions NEED_SREC=yes
|
||||
makeoptions BOARDTYPE="ev64260"
|
||||
options INTSTK=16384
|
||||
|
|
|
@ -1,238 +0,0 @@
|
|||
/* $NetBSD: bus_space.c,v 1.4 2003/03/07 18:24:00 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Charles M. Hannum and by Jason R. Thorpe of the Numerical Aerospace
|
||||
* Simulation Facility, NASA Ames Research Center.
|
||||
*
|
||||
* 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/kernel.h>
|
||||
#include <sys/extent.h>
|
||||
#include <sys/mbuf.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
static paddr_t memio_mmap(bus_space_tag_t, bus_addr_t, off_t, int, int);
|
||||
static int memio_map(bus_space_tag_t, bus_addr_t, bus_size_t, int,
|
||||
bus_space_handle_t *);
|
||||
static void memio_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t);
|
||||
static int memio_alloc(bus_space_tag_t, 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 memio_free(bus_space_tag_t, bus_space_handle_t, bus_size_t);
|
||||
|
||||
struct powerpc_bus_space gt_pci0_mem_bs_tag = {
|
||||
_BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_MEM_TYPE,
|
||||
0x00000000, 0x81000000, 0x89000000,
|
||||
NULL,
|
||||
memio_mmap, memio_map, memio_unmap, memio_alloc, memio_free
|
||||
};
|
||||
struct powerpc_bus_space gt_pci0_io_bs_tag = {
|
||||
_BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_IO_TYPE,
|
||||
0x80000000, 0x00000000, 0x00800000,
|
||||
NULL,
|
||||
memio_mmap, memio_map, memio_unmap, memio_alloc, memio_free
|
||||
};
|
||||
struct powerpc_bus_space gt_pci1_mem_bs_tag = {
|
||||
_BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_MEM_TYPE,
|
||||
0x00000000, 0x89000000, 0x90000000,
|
||||
NULL,
|
||||
memio_mmap, memio_map, memio_unmap, memio_alloc, memio_free
|
||||
};
|
||||
struct powerpc_bus_space gt_pci1_io_bs_tag = {
|
||||
_BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_IO_TYPE,
|
||||
0x88000000, 0x00000000, 0x00800000,
|
||||
NULL,
|
||||
memio_mmap, memio_map, memio_unmap, memio_alloc, memio_free
|
||||
};
|
||||
struct powerpc_bus_space gt_mem_bs_tag = {
|
||||
_BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_MEM_TYPE,
|
||||
0x00000000, 0x00000000, 0x00010000,
|
||||
NULL,
|
||||
memio_mmap, memio_map, memio_unmap, memio_alloc, memio_free
|
||||
};
|
||||
|
||||
static char ex_storage[5][EXTENT_FIXED_STORAGE_SIZE(8)]
|
||||
__attribute__((aligned(8)));
|
||||
|
||||
static int extent_flags;
|
||||
|
||||
void
|
||||
bus_space_init(void)
|
||||
{
|
||||
int error;
|
||||
|
||||
gt_pci0_mem_bs_tag.pbs_extent = extent_create("pci0-mem",
|
||||
gt_pci0_mem_bs_tag.pbs_base,
|
||||
gt_pci0_mem_bs_tag.pbs_limit-1,
|
||||
M_DEVBUF,
|
||||
ex_storage[0], sizeof(ex_storage[0]),
|
||||
EX_NOCOALESCE|EX_NOWAIT);
|
||||
|
||||
gt_pci0_io_bs_tag.pbs_extent = extent_create("pci0-ioport",
|
||||
gt_pci0_io_bs_tag.pbs_base,
|
||||
gt_pci0_io_bs_tag.pbs_limit-1,
|
||||
M_DEVBUF,
|
||||
ex_storage[1], sizeof(ex_storage[1]),
|
||||
EX_NOCOALESCE|EX_NOWAIT);
|
||||
error = extent_alloc_region(gt_pci0_io_bs_tag.pbs_extent,
|
||||
0x10000, 0x7F0000, EX_NOWAIT);
|
||||
if (error)
|
||||
panic("gt_bus_space_init: can't block out reserved "
|
||||
"I/O space 0x10000-0x7fffff: error=%d\n", error);
|
||||
|
||||
gt_pci1_mem_bs_tag.pbs_extent = extent_create("pci1-iomem",
|
||||
gt_pci1_mem_bs_tag.pbs_base,
|
||||
gt_pci1_mem_bs_tag.pbs_limit-1,
|
||||
M_DEVBUF,
|
||||
ex_storage[2], sizeof(ex_storage[2]),
|
||||
EX_NOCOALESCE|EX_NOWAIT);
|
||||
|
||||
gt_pci1_io_bs_tag.pbs_extent = extent_create("pci1-ioport",
|
||||
gt_pci1_io_bs_tag.pbs_base,
|
||||
gt_pci1_io_bs_tag.pbs_limit-1,
|
||||
M_DEVBUF,
|
||||
ex_storage[3], sizeof(ex_storage[3]),
|
||||
EX_NOCOALESCE|EX_NOWAIT);
|
||||
error = extent_alloc_region(gt_pci1_io_bs_tag.pbs_extent,
|
||||
0x10000, 0x7F0000, EX_NOWAIT);
|
||||
if (error)
|
||||
panic("gt_bus_space_init: can't block out reserved "
|
||||
"I/O space 0x10000-0x7fffff: error=%d\n", error);
|
||||
|
||||
gt_mem_bs_tag.pbs_extent = extent_create("gtmem",
|
||||
gt_mem_bs_tag.pbs_base,
|
||||
gt_mem_bs_tag.pbs_limit-1,
|
||||
M_DEVBUF,
|
||||
ex_storage[4], sizeof(ex_storage[4]),
|
||||
EX_NOCOALESCE|EX_NOWAIT);
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_mallocok(void)
|
||||
{
|
||||
extent_flags = EX_MALLOCOK;
|
||||
}
|
||||
|
||||
paddr_t
|
||||
memio_mmap(bus_space_tag_t t, bus_addr_t bpa, off_t offset, int prot, int flags)
|
||||
{
|
||||
return (trunc_page(bpa + offset));
|
||||
}
|
||||
|
||||
int
|
||||
memio_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags,
|
||||
bus_space_handle_t *bshp)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (bpa + size > t->pbs_limit)
|
||||
return (EINVAL);
|
||||
|
||||
/*
|
||||
* Can't map I/O space as linear.
|
||||
*/
|
||||
if ((flags & BUS_SPACE_MAP_LINEAR) &&
|
||||
(t->pbs_flags & _BUS_SPACE_IO_TYPE))
|
||||
return (EOPNOTSUPP);
|
||||
|
||||
/*
|
||||
* Before we go any further, let's make sure that this
|
||||
* region is available.
|
||||
*/
|
||||
error = extent_alloc_region(t->pbs_extent, bpa, size,
|
||||
EX_NOWAIT | extent_flags);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
*bshp = t->pbs_offset + bpa;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
memio_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size)
|
||||
{
|
||||
bus_addr_t bpa = bsh - t->pbs_offset;
|
||||
|
||||
if (extent_free(t->pbs_extent, bpa, size, EX_NOWAIT | extent_flags)) {
|
||||
printf("memio_unmap: %s 0x%lx, size 0x%lx\n",
|
||||
(t->pbs_flags & _BUS_SPACE_IO_TYPE) ? "port" : "mem",
|
||||
(unsigned long)bpa, (unsigned long)size);
|
||||
printf("memio_unmap: can't free region\n");
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
memio_alloc(bus_space_tag_t 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;
|
||||
int error;
|
||||
|
||||
if (rstart + size > t->pbs_limit)
|
||||
return (EINVAL);
|
||||
|
||||
/*
|
||||
* Can't map I/O space as linear.
|
||||
*/
|
||||
if ((flags & BUS_SPACE_MAP_LINEAR) &&
|
||||
(t->pbs_flags & _BUS_SPACE_IO_TYPE))
|
||||
return (EOPNOTSUPP);
|
||||
|
||||
if (rstart < t->pbs_extent->ex_start || rend > t->pbs_extent->ex_end)
|
||||
panic("memio_alloc: bad region start/end");
|
||||
|
||||
error = extent_alloc_subregion(t->pbs_extent, rstart, rend, size,
|
||||
alignment, boundary, EX_FAST | EX_NOWAIT | extent_flags, &bpa);
|
||||
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
*bpap = bpa;
|
||||
*bshp = t->pbs_offset + bpa;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
memio_free(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size)
|
||||
{
|
||||
/* memio_unmap() does all that we need to do. */
|
||||
memio_unmap(t, bsh, size);
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: clock.c,v 1.1 2003/03/05 22:08:26 matt Exp $ */
|
||||
/* $NetBSD: clock.c,v 1.2 2003/03/16 07:07:19 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
|
@ -240,6 +240,12 @@ decr_intr(struct clockframe *frame)
|
|||
clockframe = frame;
|
||||
#endif
|
||||
|
||||
{
|
||||
extern int softclock_ticks;
|
||||
if (++softclock_ticks > 3 * hz)
|
||||
cpu_Debugger();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Based on the actual time delay since the last decrementer reload,
|
||||
|
@ -338,7 +344,7 @@ calc_delayconst()
|
|||
ns_per_tick = 1000000000 / ticks_per_sec;
|
||||
ticks_per_intr = ticks_per_sec / hz;
|
||||
curcpu()->ci_lasttb = mftb();
|
||||
asm volatile ("mtdec %0" :: "r"(ticks_per_intr));
|
||||
__asm __volatile ("mtdec %0" :: "r"(ticks_per_intr));
|
||||
extintr_restore(omsr);
|
||||
}
|
||||
|
||||
|
@ -418,7 +424,7 @@ clock_stop_time(struct stop_time *stp)
|
|||
return;
|
||||
|
||||
stp->st_msr = extintr_disable();
|
||||
asm volatile ("mfdec %0" : "=r"(stp->st_decr));
|
||||
__asm __volatile ("mfdec %0" : "=r"(stp->st_decr));
|
||||
stp->st_tb = mftb();
|
||||
stp->st_state = STS_STOPPED;
|
||||
}
|
||||
|
@ -440,7 +446,7 @@ clock_restart_time(struct stop_time *stp)
|
|||
}
|
||||
stp->st_state = 0;
|
||||
mttb(stp->st_tb);
|
||||
asm volatile ("mtdec %0" :: "r"(stp->st_decr));
|
||||
__asm __volatile ("mtdec %0" :: "r"(stp->st_decr));
|
||||
extintr_restore(stp->st_msr);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,162 @@
|
|||
/* $NetBSD: com_obio.c,v 1.1 2003/03/16 07:07:19 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Charles M. Hannum.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
* 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 University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)com.c 7.5 (Berkeley) 5/16/91
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/termios.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/intr.h>
|
||||
|
||||
#include <dev/ic/comreg.h>
|
||||
#include <dev/ic/comvar.h>
|
||||
|
||||
#include <dev/marvell/gtvar.h>
|
||||
|
||||
struct com_obio_softc {
|
||||
struct com_softc osc_com; /* real "com" softc */
|
||||
|
||||
/* OBIO-specific goo. */
|
||||
};
|
||||
|
||||
static int com_obio_match (struct device *, struct cfdata *, void *);
|
||||
static void com_obio_attach (struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(com_obio, sizeof(struct com_obio_softc),
|
||||
com_obio_match, com_obio_attach, NULL, NULL);
|
||||
|
||||
int
|
||||
com_obio_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct obio_attach_args *oa = aux;
|
||||
bus_space_handle_t ioh;
|
||||
int rv = 0;
|
||||
|
||||
if (oa->oa_offset == OBIO_UNK_OFFSET ||
|
||||
oa->oa_size == OBIO_UNK_SIZE)
|
||||
return (0);
|
||||
|
||||
if (com_is_console(oa->oa_memt, oa->oa_offset, NULL)) {
|
||||
rv = 1;
|
||||
} else {
|
||||
if (bus_space_map(oa->oa_memt, oa->oa_offset,
|
||||
oa->oa_size, 0, &ioh))
|
||||
return (0);
|
||||
rv = comprobe1(oa->oa_memt, ioh);
|
||||
bus_space_unmap(oa->oa_memt, ioh, oa->oa_size);
|
||||
}
|
||||
|
||||
return (rv);
|
||||
}
|
||||
|
||||
void
|
||||
com_obio_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct com_obio_softc *osc = (void *)self;
|
||||
struct com_softc *sc = &osc->osc_com;
|
||||
struct obio_attach_args *oa = aux;
|
||||
|
||||
/*
|
||||
* We're living on an obio that looks like an sbus slot.
|
||||
*/
|
||||
sc->sc_iot = oa->oa_memt;
|
||||
sc->sc_iobase = oa->oa_offset;
|
||||
sc->sc_frequency = COM_FREQ*2;
|
||||
|
||||
if (!com_is_console(sc->sc_iot, sc->sc_iobase, &sc->sc_ioh) &&
|
||||
bus_space_map(sc->sc_iot, sc->sc_iobase, oa->oa_size,
|
||||
0, &sc->sc_ioh) != 0) {
|
||||
printf(": can't map registers\n");
|
||||
return;
|
||||
}
|
||||
|
||||
com_attach_subr(sc);
|
||||
|
||||
if (oa->oa_irq >= 0) {
|
||||
intr_establish(oa->oa_irq, IST_EDGE, IPL_SERIAL, comintr, sc);
|
||||
printf("%s: interrupting at %s\n",
|
||||
sc->sc_dev.dv_xname, intr_string(oa->oa_irq));
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ev64260_locore.S,v 1.1 2003/03/05 22:08:26 matt Exp $ */
|
||||
/* $NetBSD: ev64260_locore.S,v 1.2 2003/03/16 07:07:19 matt Exp $ */
|
||||
/* $OpenBSD: locore.S,v 1.4 1997/01/26 09:06:38 rahnds Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -50,6 +50,7 @@
|
|||
#include <machine/asm.h>
|
||||
|
||||
#include <powerpc/spr.h>
|
||||
#include <powerpc/oea/bat.h>
|
||||
#include <powerpc/oea/hid.h>
|
||||
|
||||
/*
|
||||
|
@ -111,14 +112,33 @@ __start:
|
|||
eieio; sync
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Make sure that .bss is zeroed.
|
||||
*/
|
||||
li 0,0
|
||||
lis 8,edata@ha
|
||||
addi 8,8,edata@l
|
||||
lis 9,end@ha
|
||||
addi 9,9,end@l
|
||||
5: cmpw 0,8,9 /* edata & end are >= word aligned */
|
||||
bge 6f
|
||||
stw 0,0(8)
|
||||
addi 8,8,4
|
||||
b 5b
|
||||
6:
|
||||
|
||||
li 0,0
|
||||
mtmsr 0 /* Disable FPU/MMU/exceptions */
|
||||
sync ; isync
|
||||
|
||||
#if 1
|
||||
/* Enable data and instruction caches */
|
||||
mfspr 8,SPR_HID0
|
||||
ori 8, 8, (HID0_ICE | HID0_DCE)@l
|
||||
li 0,HID0_DLOCK
|
||||
ori 8,8,(HID0_ICE | HID0_DCE)@l
|
||||
andc 8,8,0
|
||||
mtspr SPR_HID0,8
|
||||
#endif
|
||||
|
||||
/* compute end of kernel memory */
|
||||
lis 8,_C_LABEL(end)@ha
|
||||
|
@ -137,7 +157,6 @@ __start:
|
|||
|
||||
lis 3,__start@ha
|
||||
addi 3,3,__start@l
|
||||
|
||||
li 5,0
|
||||
li 6,0
|
||||
|
||||
|
@ -202,3 +221,8 @@ _C_LABEL(return_to_dink):
|
|||
* Include common trap / execption code
|
||||
*/
|
||||
#include <powerpc/powerpc/trap_subr.S>
|
||||
|
||||
/*
|
||||
* Include PIO routines
|
||||
*/
|
||||
#include <powerpc/powerpc/pio_subr.S>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: gt_mainbus.c,v 1.3 2003/03/07 18:24:01 matt Exp $ */
|
||||
/* $NetBSD: gt_mainbus.c,v 1.4 2003/03/16 07:07:19 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Wasabi Systems, Inc.
|
||||
|
@ -83,17 +83,18 @@ static void gt_attach(struct device *, struct device *, void *);
|
|||
CFATTACH_DECL(gt, sizeof(struct gt_softc), gt_match, gt_attach, NULL, NULL);
|
||||
|
||||
extern struct cfdriver gt_cd;
|
||||
extern bus_space_handle_t gt_memh;
|
||||
|
||||
static int gt_found;
|
||||
|
||||
vaddr_t gtbase = 0x14000000; /* default address */
|
||||
vaddr_t gtbase = 0xf8000000; /* default address */
|
||||
|
||||
int
|
||||
gt_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
const char *busname = aux;
|
||||
const char **busname = aux;
|
||||
|
||||
if (strcmp(busname, gt_cd.cd_name) != 0)
|
||||
if (strcmp(*busname, gt_cd.cd_name) != 0)
|
||||
return 0;
|
||||
|
||||
if (gt_found)
|
||||
|
@ -107,7 +108,6 @@ gt_attach(struct device *parent, struct device *self, void *aux)
|
|||
{
|
||||
struct gt_softc *gt = (struct gt_softc *) self;
|
||||
|
||||
gt->gt_vbase = GT_BASE;
|
||||
gt->gt_dmat = >_bus_dma_tag;
|
||||
gt->gt_memt = >_mem_bs_tag;
|
||||
gt->gt_pci0_memt = >_pci0_io_bs_tag;
|
||||
|
@ -115,12 +115,8 @@ gt_attach(struct device *parent, struct device *self, void *aux)
|
|||
gt->gt_pci1_memt = >_pci1_io_bs_tag;
|
||||
gt->gt_pci1_iot = >_pci1_mem_bs_tag;
|
||||
|
||||
gt_attach_common(gt);
|
||||
}
|
||||
gt->gt_memh = gt_memh;
|
||||
|
||||
void
|
||||
gt_setup(struct device *gt)
|
||||
{
|
||||
#if 1
|
||||
GT_DecodeAddr_SET(gt, GT_PCI0_IO_Low_Decode,
|
||||
gt_pci0_io_bs_tag.pbs_offset + gt_pci0_io_bs_tag.pbs_base);
|
||||
|
@ -142,12 +138,15 @@ gt_setup(struct device *gt)
|
|||
GT_DecodeAddr_SET(gt, GT_PCI1_Mem0_High_Decode,
|
||||
gt_pci1_mem_bs_tag.pbs_offset + gt_pci1_mem_bs_tag.pbs_limit - 1);
|
||||
#endif
|
||||
|
||||
gt_attach_common(gt);
|
||||
}
|
||||
|
||||
void
|
||||
gtpci_config_bus(struct pci_chipset *pc, int busno)
|
||||
{
|
||||
#ifdef PCI_NETBSD_CONFIGURE
|
||||
struct gtpci_chipset *gtpc = (struct gtpci_chipset *)pc;
|
||||
struct extent *ioext, *memext;
|
||||
uint32_t data;
|
||||
pcitag_t tag;
|
||||
|
@ -180,20 +179,20 @@ gtpci_config_bus(struct pci_chipset *pc, int busno)
|
|||
extent_destroy(ioext);
|
||||
extent_destroy(memext);
|
||||
|
||||
gtpci_write(pc, PCI_BASE_ADDR_REGISTERS_ENABLE(pc->pc_md.mdpc_busno),
|
||||
gtpci_write(gtpc, PCI_BASE_ADDR_REGISTERS_ENABLE(gtpc->gtpc_busno),
|
||||
0xffffffff);
|
||||
|
||||
tag = gtpci_make_tag(pc, 0, 0, 0);
|
||||
data = gtpci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
|
||||
gtpci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, 0);
|
||||
gtpci_conf_write(pc, tag, 0x10, 0x00000000);
|
||||
gtpci_write(pc, PCI_SCS0_BAR_SIZE(busno), 0x0fffffff);
|
||||
gtpci_write(gtpc, PCI_SCS0_BAR_SIZE(busno), 0x0fffffff);
|
||||
gtpci_conf_write(pc, tag, 0x14, 0x04000000);
|
||||
gtpci_write(pc, PCI_SCS1_BAR_SIZE(busno), 0x03ffffff);
|
||||
gtpci_write(gtpc, PCI_SCS1_BAR_SIZE(busno), 0x03ffffff);
|
||||
gtpci_conf_write(pc, tag, 0x18, 0x10000000);
|
||||
gtpci_write(pc, PCI_SCS2_BAR_SIZE(busno), 0x0fffffff);
|
||||
gtpci_write(gtpc, PCI_SCS2_BAR_SIZE(busno), 0x0fffffff);
|
||||
gtpci_conf_write(pc, tag, 0x1c, 0x0c000000);
|
||||
gtpci_write(pc, PCI_SCS3_BAR_SIZE(busno), 0x03ffffff);
|
||||
gtpci_write(gtpc, PCI_SCS3_BAR_SIZE(busno), 0x03ffffff);
|
||||
gtpci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, data);
|
||||
|
||||
#if 0
|
||||
|
@ -201,28 +200,28 @@ gtpci_config_bus(struct pci_chipset *pc, int busno)
|
|||
data = gtpci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
|
||||
gtpci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, 0);
|
||||
gtpci_conf_write(pc, tag, 0x10, 0xfff00000);
|
||||
gtpci_write(pc, PCI_CS0_BAR_SIZE(busno), 0x00000000);
|
||||
gtpci_write(gtpc, PCI_CS0_BAR_SIZE(busno), 0x00000000);
|
||||
gtpci_conf_write(pc, tag, 0x14, 0xfff00000);
|
||||
gtpci_write(pc, PCI_CS1_BAR_SIZE(busno), 0x00000000);
|
||||
gtpci_write(gtpc, PCI_CS1_BAR_SIZE(busno), 0x00000000);
|
||||
gtpci_conf_write(pc, tag, 0x18, 0xfff00000);
|
||||
gtpci_write(pc, PCI_CS2_BAR_SIZE(busno), 0x00000000);
|
||||
gtpci_write(gtpc, PCI_CS2_BAR_SIZE(busno), 0x00000000);
|
||||
gtpci_conf_write(pc, tag, 0x1c, 0xfff00000);
|
||||
gtpci_write(pc, PCI_CS3_BAR_SIZE(busno), 0x00000000);
|
||||
gtpci_write(gtpc, PCI_CS3_BAR_SIZE(busno), 0x00000000);
|
||||
gtpci_conf_write(pc, tag, 0x20, 0xfff00000);
|
||||
gtpci_write(pc, PCI_BOOTCS_BAR_SIZE(busno), 0x00000000);
|
||||
gtpci_write(gtpc, PCI_BOOTCS_BAR_SIZE(busno), 0x00000000);
|
||||
gtpci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, data);
|
||||
|
||||
tag = gtpci_make_tag(pc, 0, 0, 2);
|
||||
data = gtpci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
|
||||
gtpci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, 0);
|
||||
gtpci_conf_write(pc, tag, 0x10, 0xfff00000);
|
||||
gtpci_write(pc, PCI_P2P_MEM0_BAR_SIZE(busno), 0x00000000);
|
||||
gtpci_write(gtpc, PCI_P2P_MEM0_BAR_SIZE(busno), 0x00000000);
|
||||
gtpci_conf_write(pc, tag, 0x14, 0xfff00000);
|
||||
gtpci_write(pc, PCI_P2P_MEM1_BAR_SIZE(busno), 0x00000000);
|
||||
gtpci_write(gtpc, PCI_P2P_MEM1_BAR_SIZE(busno), 0x00000000);
|
||||
gtpci_conf_write(pc, tag, 0x18, 0xfff00000);
|
||||
gtpci_write(pc, PCI_P2P_IO_BAR_SIZE(busno), 0x00000000);
|
||||
gtpci_write(gtpc, PCI_P2P_IO_BAR_SIZE(busno), 0x00000000);
|
||||
gtpci_conf_write(pc, tag, 0x1c, 0xfff00000);
|
||||
gtpci_write(pc, PCI_CPU_BAR_SIZE(busno), 0x00000000);
|
||||
gtpci_write(gtpc, PCI_CPU_BAR_SIZE(busno), 0x00000000);
|
||||
gtpci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, data);
|
||||
|
||||
for (i=4; i<8; i++) {
|
||||
|
@ -271,7 +270,7 @@ gtpci_config_bus(struct pci_chipset *pc, int busno)
|
|||
data = ~(PCI_BARE_SCS0En | /* PCI_BARE_SCS1En | */ \
|
||||
PCI_BARE_SCS2En | /* PCI_BARE_SCS3En | */ \
|
||||
PCI_BARE_IntMemEn | PCI_BARE_IntIOEn);
|
||||
gtpci_write(pc, PCI_BASE_ADDR_REGISTERS_ENABLE(pc->pc_md.mdpc_busno), data);
|
||||
gtpci_write(gtpc, PCI_BASE_ADDR_REGISTERS_ENABLE(gtpc->gtpc_busno), data);
|
||||
#endif /* PCI_NETBSD_CONFIGURE */
|
||||
}
|
||||
|
||||
|
@ -280,6 +279,11 @@ gtpci_md_conf_interrupt(pci_chipset_tag_t pc, int bus, int dev, int pin,
|
|||
int swiz, int *iline)
|
||||
{
|
||||
#ifdef PCI_NETBSD_CONFIGURE
|
||||
struct gtpci_chipset *gtpc = (struct gtpci_chipset *)pc;
|
||||
if (gtpc->gtpc_busno == 0)
|
||||
*iline = IRQ_GPP_BASE + 27;
|
||||
else
|
||||
*iline = IRQ_GPP_BASE + 29;
|
||||
#endif /* PCI_NETBSD_CONFIGURE */
|
||||
}
|
||||
|
||||
|
@ -300,7 +304,7 @@ gtpci_md_conf_hook(pci_chipset_tag_t pc, int bus, int dev, int func,
|
|||
if (bus == 0 && dev == 0)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
return PCI_CONF_MAP_MEM|PCI_CONF_ENABLE_MEM;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.3 2003/03/07 18:24:01 matt Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.4 2003/03/16 07:07:19 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
|
@ -49,6 +49,7 @@
|
|||
#include <sys/msgbuf.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/extent.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
|
@ -106,30 +107,61 @@ void isa_intr_init(void);
|
|||
*/
|
||||
extern struct user *proc0paddr;
|
||||
|
||||
struct bat battable[16];
|
||||
|
||||
#define PMONMEMREGIONS 32
|
||||
struct mem_region physmemr[PMONMEMREGIONS], availmemr[PMONMEMREGIONS];
|
||||
|
||||
char *bootpath;
|
||||
|
||||
paddr_t msgbuf_paddr;
|
||||
vaddr_t msgbuf_vaddr;
|
||||
|
||||
paddr_t avail_end; /* XXX temporary */
|
||||
|
||||
void initppc(u_int, u_int, u_int, void *); /* Called from locore */
|
||||
void strayintr(int);
|
||||
int lcsplx(int);
|
||||
void gt_bus_space_init(void);
|
||||
extern void return_to_dink(int);
|
||||
|
||||
struct powerpc_bus_space gt_pci0_mem_bs_tag = {
|
||||
_BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_MEM_TYPE,
|
||||
0x00000000, 0x00000000, 0x00000000,
|
||||
};
|
||||
struct powerpc_bus_space gt_pci0_io_bs_tag = {
|
||||
_BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_IO_TYPE,
|
||||
0x00000000, 0x00000000, 0x00000000,
|
||||
};
|
||||
struct powerpc_bus_space gt_pci1_mem_bs_tag = {
|
||||
_BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_MEM_TYPE,
|
||||
0x00000000, 0x00000000, 0x00000000,
|
||||
};
|
||||
struct powerpc_bus_space gt_pci1_io_bs_tag = {
|
||||
_BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_IO_TYPE,
|
||||
0x00000000, 0x00000000, 0x00000000,
|
||||
};
|
||||
struct powerpc_bus_space gt_obio2_bs_tag = {
|
||||
_BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_MEM_TYPE|2,
|
||||
0x00000000, 0x00000000, 0x00000000,
|
||||
};
|
||||
struct powerpc_bus_space gt_mem_bs_tag = {
|
||||
_BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_MEM_TYPE,
|
||||
GT_BASE, 0x00000000, 0x00010000,
|
||||
};
|
||||
|
||||
bus_space_handle_t gt_memh;
|
||||
|
||||
bus_space_tag_t obio_bs_tags[5] = {
|
||||
NULL, NULL, >_obio2_bs_tag, NULL, NULL
|
||||
};
|
||||
|
||||
static char ex_storage[6][EXTENT_FIXED_STORAGE_SIZE(8)]
|
||||
__attribute__((aligned(8)));
|
||||
|
||||
#if 0
|
||||
cons_decl(gtmpsc);
|
||||
|
||||
struct consdev constab[] = {
|
||||
cons_init_halt(gtmpsc),
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
extern void return_to_dink(int);
|
||||
#endif
|
||||
|
||||
void
|
||||
initppc(startkernel, endkernel, args, btinfo)
|
||||
|
@ -139,32 +171,6 @@ initppc(startkernel, endkernel, args, btinfo)
|
|||
#ifdef DDB
|
||||
extern void *startsym, *endsym;
|
||||
#endif
|
||||
extern vaddr_t gtbase;
|
||||
volatile u_int32_t *gt = (volatile u_int32_t *) gtbase;
|
||||
|
||||
#if 1
|
||||
{
|
||||
extern unsigned char edata[], end[];
|
||||
struct cpu_info tmp = cpu_info[0];
|
||||
memset(edata, 0, end - edata);
|
||||
cpu_info[0] = tmp;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Relocate Discovery to desired address.
|
||||
*/
|
||||
if (gtbase != GT_BASE) {
|
||||
u_int32_t v = inlrb(gt + GT_Internal_Decode);
|
||||
outlrb(gt + GT_Internal_Decode,
|
||||
(GT_BASE >> 20) | (v & ~0xffff));
|
||||
gtbase = GT_BASE;
|
||||
}
|
||||
{
|
||||
extern struct powerpc_bus_space gt_mem_bs_tag;
|
||||
gt_mem_bs_tag.pbs_base = GT_BASE;
|
||||
gt_mem_bs_tag.pbs_limit = GT_BASE + 4096;
|
||||
}
|
||||
|
||||
/*
|
||||
* Hardcode 32MB for now--we should probe for this or get it
|
||||
|
@ -174,7 +180,7 @@ initppc(startkernel, endkernel, args, btinfo)
|
|||
{ /* XXX AKB */
|
||||
u_int32_t physmemsize;
|
||||
|
||||
physmemsize = 64 * 1024 * 1024;
|
||||
physmemsize = 92 * 1024 * 1024;
|
||||
physmemr[0].start = 0;
|
||||
physmemr[0].size = physmemsize;
|
||||
physmemr[1].size = 0;
|
||||
|
@ -199,17 +205,12 @@ initppc(startkernel, endkernel, args, btinfo)
|
|||
calc_delayconst();
|
||||
}
|
||||
|
||||
/*
|
||||
* boothowto
|
||||
*/
|
||||
boothowto = RB_SINGLE;
|
||||
|
||||
bus_space_init();
|
||||
|
||||
oea_batinit(0x80000000, BAT_BL_256M, 0xf0000000, BAT_BL_256M);
|
||||
oea_batinit(0xf0000000, BAT_BL_256M);
|
||||
oea_init((void (*)(void))ext_intr);
|
||||
|
||||
cninit();
|
||||
gt_bus_space_init();
|
||||
|
||||
consinit();
|
||||
|
||||
#if (NISA > 0)
|
||||
isa_intr_init();
|
||||
|
@ -277,7 +278,13 @@ cpu_startup()
|
|||
void
|
||||
consinit()
|
||||
{
|
||||
#if 1
|
||||
/* PPCBOOT using COM1 @ 57600 */
|
||||
comcnattach(>_obio2_bs_tag, 0, 57600, COM_FREQ*2,
|
||||
(TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8);
|
||||
#else
|
||||
cninit();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (NPCKBC > 0) && (NPCKBD == 0)
|
||||
|
@ -383,3 +390,171 @@ gtget_macaddr(struct gt_softc *gt, int macno, char *enaddr)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
gt_bus_space_init(void)
|
||||
{
|
||||
bus_space_tag_t gt_memt = >_mem_bs_tag;
|
||||
uint32_t datal, datah;
|
||||
int error;
|
||||
|
||||
error = bus_space_init(>_mem_bs_tag, "gtmem",
|
||||
ex_storage[1], sizeof(ex_storage[0]));
|
||||
|
||||
|
||||
error = bus_space_map(gt_memt, 0, 4096, 0, >_memh);
|
||||
|
||||
datal = bus_space_read_4(gt_memt, gt_memh, GT_CS2_Low_Decode);
|
||||
datah = bus_space_read_4(gt_memt, gt_memh, GT_CS2_High_Decode);
|
||||
gt_obio2_bs_tag.pbs_offset = GT_LowAddr_GET(datal);
|
||||
gt_obio2_bs_tag.pbs_limit = GT_HighAddr_GET(datah) + 1 -
|
||||
gt_obio2_bs_tag.pbs_offset;
|
||||
|
||||
error = bus_space_init(>_obio2_bs_tag, "obio2",
|
||||
ex_storage[1], sizeof(ex_storage[1]));
|
||||
|
||||
datal = bus_space_read_4(gt_memt, gt_memh, GT_PCI0_Mem0_Low_Decode);
|
||||
datah = bus_space_read_4(gt_memt, gt_memh, GT_PCI0_Mem0_High_Decode);
|
||||
gt_pci0_mem_bs_tag.pbs_base = GT_LowAddr_GET(datal);
|
||||
gt_pci0_mem_bs_tag.pbs_limit = GT_HighAddr_GET(datah) + 1;
|
||||
|
||||
error = bus_space_init(>_pci0_mem_bs_tag, "pci0-mem",
|
||||
ex_storage[2], sizeof(ex_storage[2]));
|
||||
|
||||
datal = bus_space_read_4(gt_memt, gt_memh, GT_PCI0_IO_Low_Decode);
|
||||
datah = bus_space_read_4(gt_memt, gt_memh, GT_PCI0_IO_High_Decode);
|
||||
gt_pci0_io_bs_tag.pbs_base = GT_LowAddr_GET(datal);
|
||||
gt_pci0_io_bs_tag.pbs_limit = GT_HighAddr_GET(datah) + 1 -
|
||||
gt_pci0_io_bs_tag.pbs_offset;
|
||||
|
||||
error = bus_space_init(>_pci0_io_bs_tag, "pci0-ioport",
|
||||
ex_storage[3], sizeof(ex_storage[3]));
|
||||
|
||||
#if 0
|
||||
error = extent_alloc_region(gt_pci0_io_bs_tag.pbs_extent,
|
||||
0x10000, 0x7F0000, EX_NOWAIT);
|
||||
if (error)
|
||||
panic("gt_bus_space_init: can't block out reserved "
|
||||
"I/O space 0x10000-0x7fffff: error=%d\n", error);
|
||||
#endif
|
||||
|
||||
datal = bus_space_read_4(gt_memt, gt_memh, GT_PCI1_Mem0_Low_Decode);
|
||||
datah = bus_space_read_4(gt_memt, gt_memh, GT_PCI1_Mem0_High_Decode);
|
||||
gt_pci1_mem_bs_tag.pbs_base = GT_LowAddr_GET(datal);
|
||||
gt_pci1_mem_bs_tag.pbs_limit = GT_HighAddr_GET(datah) + 1;
|
||||
|
||||
error = bus_space_init(>_pci1_mem_bs_tag, "pci1-mem",
|
||||
ex_storage[4], sizeof(ex_storage[4]));
|
||||
|
||||
datal = bus_space_read_4(gt_memt, gt_memh, GT_PCI1_IO_Low_Decode);
|
||||
datah = bus_space_read_4(gt_memt, gt_memh, GT_PCI1_IO_High_Decode);
|
||||
gt_pci1_io_bs_tag.pbs_base = GT_LowAddr_GET(datal);
|
||||
gt_pci1_io_bs_tag.pbs_limit = GT_HighAddr_GET(datah) + 1;
|
||||
|
||||
error = bus_space_init(>_pci1_io_bs_tag, "pci1-ioport",
|
||||
ex_storage[5], sizeof(ex_storage[5]));
|
||||
|
||||
#if 0
|
||||
error = extent_alloc_region(gt_pci1_io_bs_tag.pbs_extent,
|
||||
0x10000, 0x7F0000, EX_NOWAIT);
|
||||
if (error)
|
||||
panic("gt_bus_space_init: can't block out reserved "
|
||||
"I/O space 0x10000-0x7fffff: error=%d\n", error);
|
||||
#endif
|
||||
}
|
||||
#if 1
|
||||
#define ISSET(t, f) ((t) & (f))
|
||||
|
||||
#define KCOM_BASE 0xfd000000 /* XXX COM1 */
|
||||
#define KCOM_REGSIZE 0x00001000 /* XXX */
|
||||
|
||||
unsigned char *kcombase = (unsigned char *)KCOM_BASE;
|
||||
|
||||
void kcomcninit(struct consdev *);
|
||||
int kcomcngetc(dev_t);
|
||||
void kcomcnpollc(dev_t, int);
|
||||
void kcomcnputc(dev_t, int);
|
||||
|
||||
static unsigned char kcom_reg_read(int);
|
||||
static void kcom_reg_write(int, unsigned char);
|
||||
|
||||
/*
|
||||
* The following functions are polled getc and putc routines,
|
||||
* the core of the "kludge" in the Kludge Com driver :-)
|
||||
*/
|
||||
|
||||
static inline unsigned char
|
||||
kcom_reg_read(int off)
|
||||
{
|
||||
unsigned char rv;
|
||||
|
||||
__asm __volatile ("eieio; lbzx %0,%1,%2; eieio;"
|
||||
: "=r"(rv) : "b"(off << 2), "r"(kcombase));
|
||||
return rv;
|
||||
}
|
||||
|
||||
static __inline void
|
||||
kcom_reg_write(int off, unsigned char val)
|
||||
{
|
||||
__asm __volatile ("eieio; stbx %0,%1,%2; eieio;"
|
||||
:: "r"(val), "b"(off << 2), "r"(kcombase));
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
kcomcninit(struct consdev *cd)
|
||||
{
|
||||
kcom_reg_write(com_ier, 0);
|
||||
kcom_reg_write(com_mcr, MCR_RTS|MCR_DTR);
|
||||
}
|
||||
|
||||
int
|
||||
kcomcngetc(dev_t dev)
|
||||
{
|
||||
u_char stat, c;
|
||||
|
||||
/* block until a character becomes available */
|
||||
while (!ISSET(stat = kcom_reg_read(com_lsr), LSR_RXRDY))
|
||||
;
|
||||
|
||||
c = kcom_reg_read(com_data);
|
||||
stat = kcom_reg_read(com_iir);
|
||||
return (int)c;
|
||||
}
|
||||
|
||||
void
|
||||
kcomcnputc(dev_t dev, int c)
|
||||
{
|
||||
int timo;
|
||||
|
||||
/* wait for any pending transmission to finish */
|
||||
timo = 150000;
|
||||
while ((!ISSET(kcom_reg_read(com_lsr), LSR_TXRDY)) && --timo)
|
||||
continue;
|
||||
|
||||
kcom_reg_write(com_data, c);
|
||||
|
||||
/* wait for this transmission to complete */
|
||||
timo = 150000;
|
||||
while ((!ISSET(kcom_reg_read(com_lsr), LSR_TXRDY)) && --timo)
|
||||
continue;
|
||||
}
|
||||
|
||||
void
|
||||
kcomcnpollc(dev_t dev, int on)
|
||||
{
|
||||
}
|
||||
|
||||
struct consdev consdev_kcom = {
|
||||
NULL,
|
||||
kcomcninit,
|
||||
kcomcngetc,
|
||||
kcomcnputc,
|
||||
kcomcnpollc,
|
||||
NULL,
|
||||
};
|
||||
|
||||
#if 1
|
||||
struct consdev *cn_tab = &consdev_kcom;
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mainbus.c,v 1.2 2003/03/07 18:24:01 matt Exp $ */
|
||||
/* $NetBSD: mainbus.c,v 1.3 2003/03/16 07:07:19 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
|
||||
|
@ -70,7 +70,8 @@ mainbus_cfprint(void *aux, const char *pnp)
|
|||
struct mainbus_attach_args *mba = aux;
|
||||
|
||||
if (pnp)
|
||||
printf("%s at %s", mba->mba_busname, pnp);
|
||||
aprint_normal("%s at %s", mba->mba_busname, pnp);
|
||||
aprint_normal(" unit %d", mba->mba_unit);
|
||||
return (UNCONF);
|
||||
}
|
||||
|
||||
|
@ -116,7 +117,7 @@ mainbus_attach(struct device *parent, struct device *self, void *aux)
|
|||
* Now try to configure the Discovery
|
||||
*/
|
||||
mba.mba_busname = "gt";
|
||||
mba.mba_unit = 1;
|
||||
mba.mba_unit = 0;
|
||||
config_found(self, &mba, mainbus_cfprint);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bus.h,v 1.3 2003/03/07 18:24:03 matt Exp $ */
|
||||
/* $NetBSD: bus.h,v 1.4 2003/03/16 07:07:19 matt Exp $ */
|
||||
|
||||
/*
|
||||
* This is a total hack to workaround the fact that we have
|
||||
|
@ -16,8 +16,5 @@
|
|||
#define PHYS_TO_BUS_MEM(t, addr) (addr) /* XXX */
|
||||
#define BUS_MEM_TO_PHYS(t, addr) (addr) /* XXX */
|
||||
|
||||
void bus_space_init(void);
|
||||
void bus_space_mallocok(void);
|
||||
|
||||
#include <powerpc/bus.h>
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue