Adapt arc port to the new MI mips3 wired map functions.
Tested on NEC-RD94 with several PCI and jazzio devices.
This commit is contained in:
parent
74f4d162fb
commit
fdb3b14bb4
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bus_space_large.c,v 1.4 2005/01/22 07:35:33 tsutsui Exp $ */
|
||||
/* $NetBSD: bus_space_large.c,v 1.5 2005/11/05 09:50:50 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -51,11 +51,11 @@
|
|||
* - If requested region size >= ARC_THRESHOLD_TO_USE_WIRED_TLB,
|
||||
* and enough wired TLBs are still free.
|
||||
* In this case, the size of wired TLBs becomes always
|
||||
* ARC_WIRED_PAGE_SIZE (i.e. 16MB). (See wired_map.c for detail.)
|
||||
* MIPS3_WIRED_SIZE (i.e. 16MB). (See wired_map_machdep.c for detail.)
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus_space_large.c,v 1.4 2005/01/22 07:35:33 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus_space_large.c,v 1.5 2005/11/05 09:50:50 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -65,7 +65,7 @@ __KERNEL_RCSID(0, "$NetBSD: bus_space_large.c,v 1.4 2005/01/22 07:35:33 tsutsui
|
|||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <arc/arc/wired_map.h>
|
||||
#include <machine/wired_map.h>
|
||||
|
||||
static int arc_large_bus_space_compose_handle(bus_space_tag_t, bus_addr_t,
|
||||
bus_size_t, int, bus_space_handle_t *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: c_magnum.c,v 1.11 2005/10/30 05:27:14 tsutsui Exp $ */
|
||||
/* $NetBSD: c_magnum.c,v 1.12 2005/11/05 09:50:50 tsutsui Exp $ */
|
||||
/* $OpenBSD: machdep.c,v 1.36 1999/05/22 21:22:19 weingart Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -80,7 +80,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: c_magnum.c,v 1.11 2005/10/30 05:27:14 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: c_magnum.c,v 1.12 2005/11/05 09:50:50 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -91,13 +91,13 @@ __KERNEL_RCSID(0, "$NetBSD: c_magnum.c,v 1.11 2005/10/30 05:27:14 tsutsui Exp $"
|
|||
#include <machine/bus.h>
|
||||
#include <machine/pio.h>
|
||||
#include <machine/platform.h>
|
||||
#include <machine/wired_map.h>
|
||||
#include <mips/locore.h>
|
||||
#include <mips/pte.h>
|
||||
|
||||
#include <dev/isa/isavar.h>
|
||||
|
||||
#include <arc/arc/timervar.h>
|
||||
#include <arc/arc/wired_map.h>
|
||||
#include <arc/jazz/pica.h>
|
||||
#include <arc/jazz/jazziovar.h>
|
||||
#include <arc/jazz/timer_jazziovar.h>
|
||||
|
@ -266,10 +266,13 @@ c_magnum_init(void)
|
|||
/*
|
||||
* Initialize wired TLB for I/O space which is used on early stage
|
||||
*/
|
||||
arc_enter_wired(R4030_V_LOCAL_IO_BASE, R4030_P_LOCAL_IO_BASE,
|
||||
PICA_P_INT_SOURCE, MIPS3_PG_SIZE_256K);
|
||||
arc_enter_wired(PICA_V_ISA_IO, PICA_P_ISA_IO, PICA_P_ISA_MEM,
|
||||
MIPS3_PG_SIZE_16M);
|
||||
arc_wired_enter_page(R4030_V_LOCAL_IO_BASE, R4030_P_LOCAL_IO_BASE,
|
||||
R4030_S_LOCAL_IO_BASE);
|
||||
arc_wired_enter_page(PICA_V_INT_SOURCE, PICA_P_INT_SOURCE,
|
||||
R4030_S_LOCAL_IO_BASE);
|
||||
|
||||
arc_wired_enter_page(PICA_V_ISA_IO, PICA_P_ISA_IO, PICA_S_ISA_IO);
|
||||
arc_wired_enter_page(PICA_V_ISA_MEM, PICA_P_ISA_MEM, PICA_S_ISA_MEM);
|
||||
|
||||
/*
|
||||
* Initialize interrupt priority
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: c_nec_eisa.c,v 1.8 2005/01/22 07:35:33 tsutsui Exp $ */
|
||||
/* $NetBSD: c_nec_eisa.c,v 1.9 2005/11/05 09:50:50 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 2003 Izumi Tsutsui.
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: c_nec_eisa.c,v 1.8 2005/01/22 07:35:33 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: c_nec_eisa.c,v 1.9 2005/11/05 09:50:50 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -43,12 +43,12 @@ __KERNEL_RCSID(0, "$NetBSD: c_nec_eisa.c,v 1.8 2005/01/22 07:35:33 tsutsui Exp $
|
|||
#include <machine/autoconf.h>
|
||||
#include <machine/pio.h>
|
||||
#include <machine/platform.h>
|
||||
#include <machine/wired_map.h>
|
||||
#include <mips/pte.h>
|
||||
|
||||
#include <dev/isa/isavar.h>
|
||||
|
||||
#include <arc/arc/arcbios.h>
|
||||
#include <arc/arc/wired_map.h>
|
||||
#include <arc/jazz/pica.h>
|
||||
#include <arc/jazz/rd94.h>
|
||||
#include <arc/jazz/jazziovar.h>
|
||||
|
@ -170,10 +170,11 @@ c_nec_eisa_init(void)
|
|||
/*
|
||||
* Initialize wired TLB for I/O space which is used on early stage
|
||||
*/
|
||||
arc_enter_wired(RD94_V_LOCAL_IO_BASE, RD94_P_LOCAL_IO_BASE, 0,
|
||||
MIPS3_PG_SIZE_256K);
|
||||
arc_enter_wired(RD94_V_EISA_IO, RD94_P_EISA_IO, RD94_P_EISA_MEM,
|
||||
MIPS3_PG_SIZE_16M);
|
||||
arc_wired_enter_page(RD94_V_LOCAL_IO_BASE, RD94_P_LOCAL_IO_BASE,
|
||||
RD94_S_LOCAL_IO_BASE);
|
||||
|
||||
arc_wired_enter_page(RD94_V_EISA_IO, RD94_P_EISA_IO, RD94_S_EISA_IO);
|
||||
arc_wired_enter_page(RD94_V_EISA_MEM, RD94_P_EISA_MEM, RD94_S_EISA_MEM);
|
||||
|
||||
/*
|
||||
* Initialize interrupt priority
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: c_nec_pci.c,v 1.11 2005/06/03 12:30:53 tsutsui Exp $ */
|
||||
/* $NetBSD: c_nec_pci.c,v 1.12 2005/11/05 09:50:50 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 2000 Shuichiro URATA. All rights reserved.
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: c_nec_pci.c,v 1.11 2005/06/03 12:30:53 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: c_nec_pci.c,v 1.12 2005/11/05 09:50:50 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: c_nec_pci.c,v 1.11 2005/06/03 12:30:53 tsutsui Exp $
|
|||
#include <machine/bus.h>
|
||||
#include <machine/pio.h>
|
||||
#include <machine/platform.h>
|
||||
#include <machine/wired_map.h>
|
||||
#include <mips/pte.h>
|
||||
|
||||
#include <dev/clock_subr.h>
|
||||
|
@ -51,7 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: c_nec_pci.c,v 1.11 2005/06/03 12:30:53 tsutsui Exp $
|
|||
#include <dev/pci/pcivar.h>
|
||||
|
||||
#include <arc/arc/arcbios.h>
|
||||
#include <arc/arc/wired_map.h>
|
||||
#include <arc/jazz/pica.h>
|
||||
#include <arc/jazz/rd94.h>
|
||||
#include <arc/jazz/jazziovar.h>
|
||||
|
@ -218,10 +218,14 @@ c_nec_pci_init(void)
|
|||
/*
|
||||
* Initialize wired TLB for I/O space which is used on early stage
|
||||
*/
|
||||
arc_enter_wired(RD94_V_LOCAL_IO_BASE, RD94_P_LOCAL_IO_BASE, 0,
|
||||
MIPS3_PG_SIZE_256K);
|
||||
arc_enter_wired(RD94_V_PCI_IO, RD94_P_PCI_IO, RD94_P_PCI_MEM,
|
||||
MIPS3_PG_SIZE_16M);
|
||||
arc_wired_enter_page(RD94_V_LOCAL_IO_BASE, RD94_P_LOCAL_IO_BASE,
|
||||
RD94_S_LOCAL_IO_BASE);
|
||||
/*
|
||||
* allocate only 16M for PCM MEM space for now to save wired TLB entry;
|
||||
* Other regions will be allocalted by bus_space_large.c later.
|
||||
*/
|
||||
arc_wired_enter_page(RD94_V_PCI_IO, RD94_P_PCI_IO, RD94_S_PCI_IO);
|
||||
arc_wired_enter_page(RD94_V_PCI_MEM, RD94_P_PCI_MEM, RD94_S_PCI_IO);
|
||||
|
||||
/*
|
||||
* By default, reserve 32MB in KSEG2 for PCI memory space.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: locore_machdep.S,v 1.13 2005/10/01 02:05:19 tsutsui Exp $ */
|
||||
/* $NetBSD: locore_machdep.S,v 1.14 2005/11/05 09:50:50 tsutsui Exp $ */
|
||||
/* $OpenBSD: locore.S,v 1.12 1997/04/19 17:19:43 pefo Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -332,54 +332,3 @@ LEAF(mdbpanic)
|
|||
nop
|
||||
END(mdbpanic)
|
||||
#endif /* DEBUG */
|
||||
|
||||
.set mips3
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
*
|
||||
* mips3_TLBWriteIndexedVPS --
|
||||
*
|
||||
* Write the given entry into the TLB at the given index.
|
||||
* Pass full r4000 tlb info including variable page size mask.
|
||||
*
|
||||
* mips3_TLBWriteIndexed(unsigned int index, struct tlb *tlb)
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* TLB entry set.
|
||||
*
|
||||
*--------------------------------------------------------------------------
|
||||
*/
|
||||
LEAF(mips3_TLBWriteIndexedVPS)
|
||||
mfc0 v1, MIPS_COP_0_STATUS # Save the status register.
|
||||
mtc0 zero, MIPS_COP_0_STATUS # Disable interrupts
|
||||
nop
|
||||
lw a2, 8(a1)
|
||||
lw a3, 12(a1)
|
||||
mfc0 v0, MIPS_COP_0_TLB_PG_MASK # Save current PageMask.
|
||||
dmfc0 t0, MIPS_COP_0_TLB_HI # Save the current PID.
|
||||
|
||||
dmtc0 a2, MIPS_COP_0_TLB_LO0 # Set up EntryLo0.
|
||||
dmtc0 a3, MIPS_COP_0_TLB_LO1 # Set up EntryLo1.
|
||||
nop
|
||||
lw a2, 0(a1)
|
||||
lw a3, 4(a1)
|
||||
nop
|
||||
mtc0 a0, MIPS_COP_0_TLB_INDEX # Set the Index.
|
||||
mtc0 a2, MIPS_COP_0_TLB_PG_MASK # Set up PageMask.
|
||||
dmtc0 a3, MIPS_COP_0_TLB_HI # Set up EntryHi.
|
||||
nop
|
||||
tlbwi # Write the TLB
|
||||
nop
|
||||
nop
|
||||
nop # Delay for effect
|
||||
nop
|
||||
|
||||
dmtc0 t0, MIPS_COP_0_TLB_HI # Restore the PID.
|
||||
nop
|
||||
mtc0 v0, MIPS_COP_0_TLB_PG_MASK # Restore PageMask.
|
||||
j ra
|
||||
mtc0 v1, MIPS_COP_0_STATUS # Restore the status register
|
||||
END(mips3_TLBWriteIndexedVPS)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.91 2005/10/30 05:27:14 tsutsui Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.92 2005/11/05 09:50:50 tsutsui Exp $ */
|
||||
/* $OpenBSD: machdep.c,v 1.36 1999/05/22 21:22:19 weingart Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -78,7 +78,7 @@
|
|||
/* from: Utah Hdr: machdep.c 1.63 91/04/24 */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.91 2005/10/30 05:27:14 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.92 2005/11/05 09:50:50 tsutsui Exp $");
|
||||
|
||||
#include "fs_mfs.h"
|
||||
#include "opt_ddb.h"
|
||||
|
@ -121,6 +121,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.91 2005/10/30 05:27:14 tsutsui Exp $")
|
|||
#include <machine/trap.h>
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/platform.h>
|
||||
#include <machine/wired_map.h>
|
||||
#include <mips/pte.h>
|
||||
#include <mips/locore.h>
|
||||
#include <mips/cpuregs.h>
|
||||
|
@ -138,7 +139,6 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.91 2005/10/30 05:27:14 tsutsui Exp $")
|
|||
|
||||
#include <arc/arc/arcbios.h>
|
||||
#include <arc/arc/timervar.h>
|
||||
#include <arc/arc/wired_map.h>
|
||||
|
||||
#include "ksyms.h"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: p_dti_tyne.c,v 1.9 2005/06/03 12:30:53 tsutsui Exp $ */
|
||||
/* $NetBSD: p_dti_tyne.c,v 1.10 2005/11/05 09:50:50 tsutsui Exp $ */
|
||||
/* $OpenBSD: machdep.c,v 1.36 1999/05/22 21:22:19 weingart Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -76,7 +76,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: p_dti_tyne.c,v 1.9 2005/06/03 12:30:53 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: p_dti_tyne.c,v 1.10 2005/11/05 09:50:50 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -87,13 +87,13 @@ __KERNEL_RCSID(0, "$NetBSD: p_dti_tyne.c,v 1.9 2005/06/03 12:30:53 tsutsui Exp $
|
|||
#include <machine/bus.h>
|
||||
#include <machine/pio.h>
|
||||
#include <machine/platform.h>
|
||||
#include <machine/wired_map.h>
|
||||
#include <mips/pte.h>
|
||||
|
||||
#include <dev/isa/isareg.h>
|
||||
#include <dev/isa/isavar.h>
|
||||
#include <dev/ic/i8042reg.h>
|
||||
|
||||
#include <arc/arc/wired_map.h>
|
||||
#include <arc/dti/desktech.h>
|
||||
|
||||
void arc_sysreset(bus_addr_t, bus_size_t);
|
||||
|
@ -276,10 +276,13 @@ p_dti_tyne_init(void)
|
|||
/*
|
||||
* Initialize wired TLB for I/O space which is used on early stage
|
||||
*/
|
||||
arc_enter_wired(TYNE_V_BOUNCE, TYNE_P_BOUNCE, 0, MIPS3_PG_SIZE_256K);
|
||||
arc_enter_wired(TYNE_V_ISA_IO, TYNE_P_ISA_IO, 0, MIPS3_PG_SIZE_1M);
|
||||
arc_enter_wired(TYNE_V_ISA_MEM, TYNE_P_ISA_MEM, 0, MIPS3_PG_SIZE_1M);
|
||||
arc_enter_wired(0xe3000000, 0xfff00000, 0, MIPS3_PG_SIZE_4K);
|
||||
arc_wired_enter_page(TYNE_V_BOUNCE, TYNE_P_BOUNCE, TYNE_S_BOUNCE);
|
||||
|
||||
arc_wired_enter_page(TYNE_V_ISA_IO, TYNE_P_ISA_IO, TYNE_S_ISA_IO);
|
||||
arc_wired_enter_page(TYNE_V_ISA_MEM, TYNE_P_ISA_MEM, TYNE_S_ISA_MEM);
|
||||
|
||||
arc_wired_enter_page(0xe3000000, 0xfff00000,
|
||||
MIPS3_PG_SIZE_MASK_TO_SIZE(MIPS3_PG_SIZE_4K));
|
||||
|
||||
/*
|
||||
* Initialize interrupt priority
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wired_map.c,v 1.9 2005/10/10 02:14:43 tsutsui Exp $ */
|
||||
/* $NetBSD: wired_map_machdep.c,v 1.1 2005/11/05 09:50:50 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 2000 Shuichiro URATA. All rights reserved.
|
||||
|
@ -27,137 +27,125 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: wired_map.c,v 1.9 2005/10/10 02:14:43 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: wired_map_machdep.c,v 1.1 2005/11/05 09:50:50 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/extent.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/wired_map.h>
|
||||
#include <machine/vmparam.h>
|
||||
#include <mips/locore.h>
|
||||
#include <mips/pte.h>
|
||||
#include <arc/arc/wired_map.h>
|
||||
|
||||
#define VA_FREE_START 0xe0000000 /* XXX */
|
||||
|
||||
#define ARC_TLB_WIRED_ENTRIES 8 /* upper limit */
|
||||
#define ARC_WIRED_PG_MASK MIPS3_PG_SIZE_16M
|
||||
#define ARC_WIRED_PAGE_SIZE MIPS3_PG_SIZE_MASK_TO_SIZE(ARC_WIRED_PG_MASK)
|
||||
#define ARC_WIRED_ENTRY_SIZE (ARC_WIRED_PAGE_SIZE * 2)
|
||||
#define ARC_WIRED_ENTRY_OFFMASK (ARC_WIRED_ENTRY_SIZE - 1)
|
||||
|
||||
static struct wired_map_entry {
|
||||
paddr_t pa0;
|
||||
paddr_t pa1;
|
||||
vsize_t size;
|
||||
vaddr_t va;
|
||||
} wired_map[ARC_TLB_WIRED_ENTRIES];
|
||||
|
||||
boolean_t arc_wired_map_paddr_entry(paddr_t pa, vaddr_t *vap, vsize_t *sizep);
|
||||
boolean_t arc_wired_map_vaddr_entry(vaddr_t va, paddr_t *pap, vsize_t *sizep);
|
||||
|
||||
static int nwired;
|
||||
static vaddr_t va_free;
|
||||
static struct extent *arc_wired_map_ex;
|
||||
static long wired_map_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)];
|
||||
|
||||
void
|
||||
arc_init_wired_map(void)
|
||||
{
|
||||
|
||||
nwired = 0;
|
||||
va_free = VA_FREE_START;
|
||||
mips3_nwired_page = 0;
|
||||
arc_wired_map_ex = extent_create("wired_map",
|
||||
VM_MIN_WIRED_MAP_ADDRESS, VM_MAX_WIRED_MAP_ADDRESS, M_DEVBUF,
|
||||
(void *)wired_map_ex_storage, sizeof(wired_map_ex_storage),
|
||||
EX_NOWAIT);
|
||||
if (arc_wired_map_ex == NULL)
|
||||
panic("arc_init_wired_map: can't create extent");
|
||||
}
|
||||
|
||||
void
|
||||
arc_enter_wired(vaddr_t va, paddr_t pa0, paddr_t pa1, uint32_t pg_size)
|
||||
arc_wired_enter_page(vaddr_t va, paddr_t pa, vaddr_t pg_size)
|
||||
{
|
||||
struct tlb tlb;
|
||||
int error;
|
||||
|
||||
if (nwired >= ARC_TLB_WIRED_ENTRIES)
|
||||
panic("arc_enter_wired: wired entry exausted");
|
||||
KASSERT((va & (pg_size - 1)) == 0);
|
||||
|
||||
wired_map[nwired].va = va;
|
||||
wired_map[nwired].pa0 = pa0;
|
||||
wired_map[nwired].pa1 = pa1;
|
||||
wired_map[nwired].size = MIPS3_PG_SIZE_MASK_TO_SIZE(pg_size);
|
||||
|
||||
/* Allocate new wired entry */
|
||||
mips3_cp0_wired_write(MIPS3_TLB_WIRED_UPAGES + nwired + 1);
|
||||
|
||||
/* Map to it */
|
||||
tlb.tlb_mask = pg_size;
|
||||
tlb.tlb_hi = mips3_vad_to_vpn(va);
|
||||
if (pa0 == 0)
|
||||
tlb.tlb_lo0 = MIPS3_PG_G;
|
||||
else
|
||||
tlb.tlb_lo0 = mips3_paddr_to_tlbpfn(pa0) | \
|
||||
MIPS3_PG_IOPAGE(PMAP_CCA_FOR_PA(pa0));
|
||||
if (pa1 == 0)
|
||||
tlb.tlb_lo1 = MIPS3_PG_G;
|
||||
else
|
||||
tlb.tlb_lo1 = mips3_paddr_to_tlbpfn(pa1) | \
|
||||
MIPS3_PG_IOPAGE(PMAP_CCA_FOR_PA(pa1));
|
||||
mips3_TLBWriteIndexedVPS(MIPS3_TLB_WIRED_UPAGES + nwired, &tlb);
|
||||
|
||||
if (va_free < va + wired_map[nwired].size * 2) {
|
||||
va_free = va + wired_map[nwired].size * 2;
|
||||
if (va < VM_MIN_WIRED_MAP_ADDRESS ||
|
||||
va + pg_size > VM_MAX_WIRED_MAP_ADDRESS) {
|
||||
#ifdef DIAGNOSTIC
|
||||
printf("arc_wired_enter_page: invalid va range.\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
nwired++;
|
||||
error = extent_alloc_region(arc_wired_map_ex, va, pg_size, EX_NOWAIT);
|
||||
if (error) {
|
||||
#ifdef DIAGNOSTIC
|
||||
printf("arc_wired_enter_page: cannot allocate region.\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
mips3_wired_enter_page(va, pa, pg_size);
|
||||
}
|
||||
|
||||
boolean_t
|
||||
arc_wired_map_paddr_entry(paddr_t pa, vaddr_t *vap, vsize_t *sizep)
|
||||
{
|
||||
int n = nwired;
|
||||
struct wired_map_entry *entry = wired_map;
|
||||
vsize_t size;
|
||||
int n;
|
||||
struct wired_map_entry *entry;
|
||||
|
||||
for (; --n >= 0; entry++) {
|
||||
n = mips3_nwired_page;
|
||||
for (entry = mips3_wired_map; --n >= 0; entry++) {
|
||||
size = MIPS3_PG_SIZE_MASK_TO_SIZE(entry->pgmask);
|
||||
if (entry->pa0 != 0 &&
|
||||
pa >= entry->pa0 && pa < entry->pa0 + entry->size) {
|
||||
pa >= entry->pa0 && pa < entry->pa0 + size) {
|
||||
*vap = entry->va;
|
||||
*sizep = entry->size;
|
||||
return 1;
|
||||
*sizep = size;
|
||||
return TRUE;
|
||||
}
|
||||
if (entry->pa1 != 0 &&
|
||||
pa >= entry->pa1 && pa < entry->pa1 + entry->size) {
|
||||
*vap = entry->va + entry->size;
|
||||
*sizep = entry->size;
|
||||
return 1;
|
||||
pa >= entry->pa1 && pa < entry->pa1 + size) {
|
||||
*vap = entry->va + size;
|
||||
*sizep = size;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* XXX: Using tlbp makes this easier... */
|
||||
boolean_t
|
||||
arc_wired_map_vaddr_entry(vaddr_t va, paddr_t *pap, vsize_t *sizep)
|
||||
{
|
||||
int n = nwired;
|
||||
struct wired_map_entry *entry = wired_map;
|
||||
vsize_t size;
|
||||
int n;
|
||||
struct wired_map_entry *entry;
|
||||
|
||||
for (; --n >= 0; entry++) {
|
||||
if (va >= entry->va && va < entry->va + entry->size * 2) {
|
||||
paddr_t pa = (va < entry->va + entry->size)
|
||||
? entry->pa0 : entry->pa1;
|
||||
n = mips3_nwired_page;
|
||||
for (entry = mips3_wired_map; --n >= 0; entry++) {
|
||||
size = MIPS3_PG_SIZE_MASK_TO_SIZE(entry->pgmask);
|
||||
if (va >= entry->va && va < entry->va + size * 2) {
|
||||
paddr_t pa = (va < entry->va + size)
|
||||
? entry->pa0 : entry->pa1;
|
||||
|
||||
if (pa != 0) {
|
||||
*pap = pa;
|
||||
*sizep = entry->size;
|
||||
return 1;
|
||||
*sizep = size;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
vaddr_t
|
||||
arc_contiguously_wired_mapped(paddr_t pa, int size)
|
||||
arc_contiguously_wired_mapped(paddr_t pa, vsize_t size)
|
||||
{
|
||||
paddr_t p;
|
||||
vaddr_t rva, va;
|
||||
vsize_t vsize, offset;
|
||||
|
||||
if (!arc_wired_map_paddr_entry(pa, &rva, &vsize))
|
||||
return (0); /* not wired mapped */
|
||||
return 0; /* not wired mapped */
|
||||
/* XXX: same physical address may be wired mapped more than once */
|
||||
offset = (vsize_t)pa & (vsize - 1);
|
||||
pa -= offset;
|
||||
|
@ -177,37 +165,40 @@ arc_contiguously_wired_mapped(paddr_t pa, int size)
|
|||
|
||||
/* Allocate new wired entries */
|
||||
vaddr_t
|
||||
arc_map_wired(paddr_t pa, int size)
|
||||
arc_map_wired(paddr_t pa, vsize_t size)
|
||||
{
|
||||
vaddr_t va, rva;
|
||||
vaddr_t va;
|
||||
vsize_t off;
|
||||
int error;
|
||||
|
||||
/* XXX: may be already partially wired mapped */
|
||||
|
||||
off = pa & ARC_WIRED_ENTRY_OFFMASK;
|
||||
rva = (va_free + ARC_WIRED_ENTRY_OFFMASK) & ~ARC_WIRED_ENTRY_OFFMASK;
|
||||
pa &= ~(paddr_t)ARC_WIRED_ENTRY_OFFMASK;
|
||||
va = rva;
|
||||
off = pa & MIPS3_WIRED_OFFMASK;
|
||||
pa &= ~(paddr_t)MIPS3_WIRED_OFFMASK;
|
||||
size += off;
|
||||
|
||||
if ((size + ARC_WIRED_ENTRY_SIZE - 1) / ARC_WIRED_ENTRY_SIZE >
|
||||
ARC_TLB_WIRED_ENTRIES - nwired) {
|
||||
if ((size + MIPS3_WIRED_ENTRY_SIZE(MIPS3_WIRED_SIZE) - 1) /
|
||||
MIPS3_WIRED_ENTRY_SIZE(MIPS3_WIRED_SIZE) >
|
||||
MIPS3_NWIRED_ENTRY - mips3_nwired_page) {
|
||||
#ifdef DIAGNOSTIC
|
||||
printf("arc_map_wired(0x%llx, 0x%lx): %d is not enough\n",
|
||||
pa + off, size - off, ARC_TLB_WIRED_ENTRIES - nwired);
|
||||
pa + off, size - off,
|
||||
MIPS3_NWIRED_ENTRY - mips3_nwired_page);
|
||||
#endif
|
||||
return 0; /* free wired TLB is not enough */
|
||||
}
|
||||
|
||||
while (size > 0) {
|
||||
arc_enter_wired(va, pa, pa + ARC_WIRED_PAGE_SIZE,
|
||||
ARC_WIRED_PG_MASK);
|
||||
pa += ARC_WIRED_ENTRY_SIZE;
|
||||
va += ARC_WIRED_ENTRY_SIZE;
|
||||
size -= ARC_WIRED_ENTRY_SIZE;
|
||||
error = extent_alloc(arc_wired_map_ex, size, MIPS3_WIRED_SIZE,
|
||||
0, EX_NOWAIT, &va);
|
||||
if (error) {
|
||||
#ifdef DIAGNOSTIC
|
||||
printf("arc_map_wired: can't allocate region\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
mips3_wired_enter_region(va, pa, MIPS3_WIRED_SIZE);
|
||||
|
||||
return rva + off;
|
||||
return va + off;
|
||||
}
|
||||
|
||||
boolean_t
|
||||
|
@ -218,8 +209,8 @@ arc_wired_map_extract(vaddr_t va, paddr_t *pap)
|
|||
|
||||
if (arc_wired_map_vaddr_entry(va, &pa, &size)) {
|
||||
*pap = pa + (va & (size - 1));
|
||||
return 1;
|
||||
return TRUE;
|
||||
} else {
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files.arc,v 1.51 2004/07/08 22:07:47 drochner Exp $
|
||||
# $NetBSD: files.arc,v 1.52 2005/11/05 09:50:51 tsutsui Exp $
|
||||
# $OpenBSD: files.arc,v 1.21 1999/09/11 10:20:20 niklas Exp $
|
||||
#
|
||||
# maxpartitions must be first item in files.${ARCH}
|
||||
|
@ -75,7 +75,7 @@ file arch/arc/arc/bus_space.c
|
|||
file arch/arc/arc/bus_space_sparse.c
|
||||
file arch/arc/arc/bus_space_large.c
|
||||
file arch/arc/arc/bus_dma.c
|
||||
file arch/arc/arc/wired_map.c
|
||||
file arch/arc/arc/wired_map_machdep.c
|
||||
|
||||
file arch/arc/arc/arcbios.c
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: std.arc,v 1.18 2005/09/17 09:44:06 yamt Exp $
|
||||
# $NetBSD: std.arc,v 1.19 2005/11/05 09:50:51 tsutsui Exp $
|
||||
# standard arc info
|
||||
|
||||
machine arc mips
|
||||
|
@ -12,6 +12,9 @@ cpu* at mainbus0
|
|||
#options MIPS1 # R2000/R3000 support
|
||||
options MIPS3 # R4000/R4400 support
|
||||
|
||||
# arc port use wired map for device space
|
||||
options ENABLE_MIPS3_WIRED_MAP
|
||||
|
||||
# Standard (non-optional) system "options"
|
||||
|
||||
# Standard exec-package options
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cpu.h,v 1.18 2005/01/22 07:35:34 tsutsui Exp $ */
|
||||
/* $NetBSD: cpu.h,v 1.19 2005/11/05 09:50:51 tsutsui Exp $ */
|
||||
/* $OpenBSD: cpu.h,v 1.9 1998/01/28 13:46:10 pefo Exp $ */
|
||||
|
||||
#ifndef _ARC_CPU_H_
|
||||
|
@ -20,9 +20,4 @@
|
|||
|
||||
#define INT_MASK_REAL_DEV MIPS3_HARD_INT_MASK /* XXX */
|
||||
|
||||
#ifndef _LOCORE
|
||||
struct tlb;
|
||||
extern void mips3_TLBWriteIndexedVPS(u_int index, struct tlb *tlb);
|
||||
#endif /* ! _LOCORE */
|
||||
|
||||
#endif /* _ARC_CPU_H_ */
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
/* $NetBSD: vmparam.h,v 1.7 2002/12/10 05:14:26 thorpej Exp $ */
|
||||
/* $NetBSD: vmparam.h,v 1.8 2005/11/05 09:50:51 tsutsui Exp $ */
|
||||
/* $OpenBSD: vmparam.h,v 1.3 1997/04/19 17:19:59 pefo Exp $ */
|
||||
/* NetBSD: vmparam.h,v 1.5 1994/10/26 21:10:10 cgd Exp */
|
||||
|
||||
#include <mips/vmparam.h>
|
||||
|
||||
/* VA 0xe0000000-0xffffffff is used for wired_map TLB entries. */
|
||||
#undef VM_MAX_KERNEL_ADDRESS
|
||||
#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xDFFFF000)
|
||||
|
||||
#define VM_MIN_WIRED_MAP_ADDRESS ((vaddr_t)0xE0000000)
|
||||
#define VM_MAX_WIRED_MAP_ADDRESS ((vaddr_t)0xFFFFC000)
|
||||
|
||||
/*
|
||||
* Maximum number of contigous physical memory segment.
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wired_map.h,v 1.2 2005/01/22 07:35:33 tsutsui Exp $ */
|
||||
/* $NetBSD: wired_map.h,v 1.1 2005/11/05 09:50:51 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 2000 Shuichiro URATA. All rights reserved.
|
||||
|
@ -26,12 +26,17 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef ARC_THRESHOLD_TO_USE_WIRED_TLB /* tunable */
|
||||
#define ARC_THRESHOLD_TO_USE_WIRED_TLB (256*1024)
|
||||
#define MIPS3_NWIRED_ENTRY 8
|
||||
#define MIPS3_WIRED_SIZE MIPS3_PG_SIZE_MASK_TO_SIZE(MIPS3_PG_SIZE_16M)
|
||||
|
||||
#ifndef ARC_THRESHOLD_TO_USE_WIRED_TLB /* tunable */
|
||||
#define ARC_THRESHOLD_TO_USE_WIRED_TLB (256 * 1024)
|
||||
#endif
|
||||
|
||||
#include <mips/wired_map.h>
|
||||
|
||||
void arc_init_wired_map(void);
|
||||
void arc_enter_wired(vaddr_t va, paddr_t pa0, paddr_t pa1, uint32_t pg_size);
|
||||
vaddr_t arc_contiguously_wired_mapped(paddr_t pa, int size);
|
||||
vaddr_t arc_map_wired(paddr_t pa, int size);
|
||||
boolean_t arc_wired_map_extract(vaddr_t va, paddr_t *pap);
|
||||
void arc_wired_enter_page(vaddr_t, paddr_t, vsize_t);
|
||||
vaddr_t arc_contiguously_wired_mapped(paddr_t, vsize_t);
|
||||
vaddr_t arc_map_wired(paddr_t, vsize_t);
|
||||
boolean_t arc_wired_map_extract(vaddr_t, paddr_t *);
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pccons_jazzio.c,v 1.5 2005/01/22 07:35:34 tsutsui Exp $ */
|
||||
/* $NetBSD: pccons_jazzio.c,v 1.6 2005/11/05 09:50:51 tsutsui Exp $ */
|
||||
/* NetBSD: vga_isa.c,v 1.4 2000/08/14 20:14:51 thorpej Exp */
|
||||
|
||||
/*
|
||||
|
@ -29,7 +29,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pccons_jazzio.c,v 1.5 2005/01/22 07:35:34 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pccons_jazzio.c,v 1.6 2005/11/05 09:50:51 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -38,10 +38,10 @@ __KERNEL_RCSID(0, "$NetBSD: pccons_jazzio.c,v 1.5 2005/01/22 07:35:34 tsutsui Ex
|
|||
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/wired_map.h>
|
||||
|
||||
#include <mips/pte.h>
|
||||
|
||||
#include <arc/arc/wired_map.h>
|
||||
#include <arc/dev/pcconsvar.h>
|
||||
#include <arc/jazz/jazziovar.h>
|
||||
#include <arc/jazz/pica.h>
|
||||
|
@ -97,19 +97,30 @@ pccons_jazzio_init_tag(char *name, bus_space_tag_t *iotp,
|
|||
PICA_P_LOCAL_VIDEO, PICA_V_LOCAL_VIDEO,
|
||||
0, PICA_S_LOCAL_VIDEO);
|
||||
|
||||
arc_enter_wired(PICA_V_LOCAL_VIDEO_CTRL,
|
||||
arc_wired_enter_page(
|
||||
PICA_V_LOCAL_VIDEO_CTRL,
|
||||
PICA_P_LOCAL_VIDEO_CTRL,
|
||||
PICA_P_LOCAL_VIDEO_CTRL + PICA_S_LOCAL_VIDEO_CTRL/2,
|
||||
MIPS3_PG_SIZE_1M);
|
||||
arc_enter_wired(PICA_V_LOCAL_VIDEO,
|
||||
PICA_S_LOCAL_VIDEO_CTRL / 2);
|
||||
arc_wired_enter_page(
|
||||
PICA_V_LOCAL_VIDEO_CTRL + PICA_S_LOCAL_VIDEO_CTRL / 2,
|
||||
PICA_P_LOCAL_VIDEO_CTRL + PICA_S_LOCAL_VIDEO_CTRL / 2,
|
||||
PICA_S_LOCAL_VIDEO_CTRL / 2);
|
||||
|
||||
arc_wired_enter_page(PICA_V_LOCAL_VIDEO,
|
||||
PICA_P_LOCAL_VIDEO,
|
||||
PICA_P_LOCAL_VIDEO + PICA_S_LOCAL_VIDEO/2,
|
||||
MIPS3_PG_SIZE_4M);
|
||||
PICA_S_LOCAL_VIDEO / 2);
|
||||
arc_wired_enter_page(
|
||||
PICA_V_LOCAL_VIDEO + PICA_S_LOCAL_VIDEO / 2,
|
||||
PICA_P_LOCAL_VIDEO + PICA_S_LOCAL_VIDEO / 2,
|
||||
PICA_S_LOCAL_VIDEO / 2);
|
||||
#if 0
|
||||
arc_enter_wired(PICA_V_EXTND_VIDEO_CTRL,
|
||||
arc_wired_enter_page(PICA_V_EXTND_VIDEO_CTRL,
|
||||
PICA_P_EXTND_VIDEO_CTRL,
|
||||
PICA_P_EXTND_VIDEO_CTRL + PICA_S_EXTND_VIDEO_CTRL/2,
|
||||
MIPS3_PG_SIZE_1M);
|
||||
PICA_S_EXTND_VIDEO_CTRL / 2);
|
||||
arc_wired_enter_page(
|
||||
PICA_V_EXTND_VIDEO_CTRL + PICA_S_EXTND_VIDEO_CTRL / 2,
|
||||
PICA_P_EXTND_VIDEO_CTRL + PICA_S_EXTND_VIDEO_CTRL / 2,
|
||||
PICA_S_EXTND_VIDEO_CTRL / 2);
|
||||
#endif
|
||||
}
|
||||
*iotp = &vga_io;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vga_jazzio.c,v 1.12 2005/06/03 12:30:53 tsutsui Exp $ */
|
||||
/* $NetBSD: vga_jazzio.c,v 1.13 2005/11/05 09:50:51 tsutsui Exp $ */
|
||||
/* NetBSD: vga_isa.c,v 1.3 1998/06/12 18:45:48 drochner Exp */
|
||||
|
||||
/*
|
||||
|
@ -29,7 +29,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vga_jazzio.c,v 1.12 2005/06/03 12:30:53 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vga_jazzio.c,v 1.13 2005/11/05 09:50:51 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -40,6 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: vga_jazzio.c,v 1.12 2005/06/03 12:30:53 tsutsui Exp
|
|||
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/wired_map.h>
|
||||
|
||||
#include <mips/pte.h>
|
||||
|
||||
|
@ -48,7 +49,6 @@ __KERNEL_RCSID(0, "$NetBSD: vga_jazzio.c,v 1.12 2005/06/03 12:30:53 tsutsui Exp
|
|||
#include <dev/ic/vgareg.h>
|
||||
#include <dev/ic/vgavar.h>
|
||||
|
||||
#include <arc/arc/wired_map.h>
|
||||
#include <arc/jazz/jazziovar.h>
|
||||
#include <arc/jazz/pica.h>
|
||||
#include <arc/jazz/vga_jazziovar.h>
|
||||
|
@ -91,19 +91,29 @@ vga_jazzio_init_tag(const char *name, bus_space_tag_t *iotp,
|
|||
PICA_P_LOCAL_VIDEO, PICA_V_LOCAL_VIDEO,
|
||||
0, PICA_S_LOCAL_VIDEO);
|
||||
|
||||
arc_enter_wired(PICA_V_LOCAL_VIDEO_CTRL,
|
||||
arc_wired_enter_page(PICA_V_LOCAL_VIDEO_CTRL,
|
||||
PICA_P_LOCAL_VIDEO_CTRL,
|
||||
PICA_S_LOCAL_VIDEO_CTRL / 2);
|
||||
arc_wired_enter_page(
|
||||
PICA_V_LOCAL_VIDEO_CTRL + PICA_S_LOCAL_VIDEO_CTRL/2,
|
||||
PICA_P_LOCAL_VIDEO_CTRL + PICA_S_LOCAL_VIDEO_CTRL/2,
|
||||
MIPS3_PG_SIZE_1M);
|
||||
arc_enter_wired(PICA_V_LOCAL_VIDEO,
|
||||
PICA_S_LOCAL_VIDEO_CTRL / 2);
|
||||
|
||||
arc_wired_enter_page(PICA_V_LOCAL_VIDEO,
|
||||
PICA_P_LOCAL_VIDEO,
|
||||
PICA_P_LOCAL_VIDEO + PICA_S_LOCAL_VIDEO/2,
|
||||
MIPS3_PG_SIZE_4M);
|
||||
PICA_S_LOCAL_VIDEO / 2);
|
||||
arc_wired_enter_page(
|
||||
PICA_V_LOCAL_VIDEO + PICA_S_LOCAL_VIDEO / 2,
|
||||
PICA_P_LOCAL_VIDEO + PICA_S_LOCAL_VIDEO / 2,
|
||||
PICA_S_LOCAL_VIDEO / 2);
|
||||
#if 0
|
||||
arc_enter_wired(PICA_V_EXTND_VIDEO_CTRL,
|
||||
arc_wired_enter_page(PICA_V_EXTND_VIDEO_CTRL,
|
||||
PICA_P_EXTND_VIDEO_CTRL,
|
||||
PICA_P_EXTND_VIDEO_CTRL + PICA_S_EXTND_VIDEO_CTRL/2,
|
||||
MIPS3_PG_SIZE_1M);
|
||||
PICA_S_EXTND_VIDEO_CTRL / 2);
|
||||
arc_wired_enter_page(
|
||||
PICA_V_EXTND_VIDEO_CTRL + PICA_S_EXTND_VIDEO_CTRL / 2,
|
||||
PICA_P_EXTND_VIDEO_CTRL + PICA_S_EXTND_VIDEO_CTRL / 2,
|
||||
PICA_S_EXTND_VIDEO_CTRL / 2);
|
||||
#endif
|
||||
}
|
||||
*iotp = &vga_io;
|
||||
|
|
Loading…
Reference in New Issue