Implement pmap_devmap on hpcarm to map I/O registers that are used
in early start-up stage. Change the virtual address for UART #3 to the physical address in the configuration files. While here, implement the sa11x0_bs_unmap function. Reviewed by Toru Nishimura (on port-arm).
This commit is contained in:
parent
08db232b12
commit
a62a67d37c
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: sa11x0_com.c,v 1.30 2006/03/26 04:42:50 thorpej Exp $ */
|
/* $NetBSD: sa11x0_com.c,v 1.31 2006/04/11 15:08:10 peter Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1998, 1999, 2001 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998, 1999, 2001 The NetBSD Foundation, Inc.
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: sa11x0_com.c,v 1.30 2006/03/26 04:42:50 thorpej Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: sa11x0_com.c,v 1.31 2006/04/11 15:08:10 peter Exp $");
|
||||||
|
|
||||||
#include "opt_com.h"
|
#include "opt_com.h"
|
||||||
#include "opt_ddb.h"
|
#include "opt_ddb.h"
|
||||||
|
@ -1518,7 +1518,7 @@ sacomcninit(struct consdev *cp)
|
||||||
{
|
{
|
||||||
if (cp == NULL) {
|
if (cp == NULL) {
|
||||||
/* XXX cp == NULL means that MMU is disabled. */
|
/* XXX cp == NULL means that MMU is disabled. */
|
||||||
sacomconsioh = SACOM3_HW_BASE;
|
sacomconsioh = SACOM3_BASE;
|
||||||
sacomconstag = &sa11x0_bs_tag;
|
sacomconstag = &sa11x0_bs_tag;
|
||||||
cn_tab = &sacomcons;
|
cn_tab = &sacomcons;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: sa11x0_io.c,v 1.15 2006/03/04 17:22:06 peter Exp $ */
|
/* $NetBSD: sa11x0_io.c,v 1.16 2006/04/11 15:08:10 peter Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997 Mark Brinicombe.
|
* Copyright (c) 1997 Mark Brinicombe.
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: sa11x0_io.c,v 1.15 2006/03/04 17:22:06 peter Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: sa11x0_io.c,v 1.16 2006/04/11 15:08:10 peter Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
|
@ -145,14 +145,13 @@ sa11x0_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int cacheable,
|
||||||
u_long startpa, endpa, pa;
|
u_long startpa, endpa, pa;
|
||||||
vaddr_t va;
|
vaddr_t va;
|
||||||
pt_entry_t *pte;
|
pt_entry_t *pte;
|
||||||
|
const struct pmap_devmap *pd;
|
||||||
|
|
||||||
#ifdef hpcarm
|
if ((pd = pmap_devmap_find_pa(bpa, size)) != NULL) {
|
||||||
if ((u_long)bpa > (u_long)KERNEL_BASE) {
|
/* Device was statically mapped. */
|
||||||
/* XXX This is a temporary hack to aid transition. */
|
*bshp = pd->pd_va + (bpa - pd->pd_pa);
|
||||||
*bshp = bpa;
|
return 0;
|
||||||
return(0);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
startpa = trunc_page(bpa);
|
startpa = trunc_page(bpa);
|
||||||
endpa = round_page(bpa + size);
|
endpa = round_page(bpa + size);
|
||||||
|
@ -190,9 +189,20 @@ sa11x0_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend, bus_size_t size,
|
||||||
void
|
void
|
||||||
sa11x0_bs_unmap(void *t, bus_space_handle_t bsh, bus_size_t size)
|
sa11x0_bs_unmap(void *t, bus_space_handle_t bsh, bus_size_t size)
|
||||||
{
|
{
|
||||||
/*
|
vaddr_t va, endva;
|
||||||
* Temporary implementation
|
|
||||||
*/
|
if (pmap_devmap_find_va(bsh, size) != NULL) {
|
||||||
|
/* Device was statically mapped; nothing to do. */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
va = trunc_page(bsh);
|
||||||
|
endva = round_page(bsh + size);
|
||||||
|
|
||||||
|
pmap_kremove(va, endva - va);
|
||||||
|
pmap_update(pmap_kernel());
|
||||||
|
|
||||||
|
uvm_km_free(kernel_map, va, endva - va, UVM_KMF_VAONLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: sa11x0_reg.h,v 1.4 2002/07/19 18:26:56 ichiro Exp $ */
|
/* $NetBSD: sa11x0_reg.h,v 1.5 2006/04/11 15:08:10 peter Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2001 The NetBSD Foundation, Inc. All rights reserved.
|
* Copyright (c) 2001 The NetBSD Foundation, Inc. All rights reserved.
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
#define SAPPC_BASE 0x90060000 /* Peripheral Pin Controller */
|
#define SAPPC_BASE 0x90060000 /* Peripheral Pin Controller */
|
||||||
#define SAUDC_BASE 0x80000000 /* USB Device Controller*/
|
#define SAUDC_BASE 0x80000000 /* USB Device Controller*/
|
||||||
#define SACOM1_BASE 0x80010000 /* GPCLK/UART 1 */
|
#define SACOM1_BASE 0x80010000 /* GPCLK/UART 1 */
|
||||||
#define SACOM3_HW_BASE 0x80050000 /* UART 3 */
|
#define SACOM3_BASE 0x80050000 /* UART 3 */
|
||||||
#define SAMCP_BASE 0x80060000 /* MCP Controller */
|
#define SAMCP_BASE 0x80060000 /* MCP Controller */
|
||||||
#define SASSP_BASE 0x80070000 /* Synchronous serial port */
|
#define SASSP_BASE 0x80070000 /* Synchronous serial port */
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
#define SALCD_BASE 0xB0100000 /* LCD */
|
#define SALCD_BASE 0xB0100000 /* LCD */
|
||||||
|
|
||||||
/* Register base virtual addresses mapped by initarm() */
|
/* Register base virtual addresses mapped by initarm() */
|
||||||
#define SACOM3_BASE 0xd000d000
|
#define SACOM3_VBASE 0xd000d000
|
||||||
|
|
||||||
/* Interrupt controller registers */
|
/* Interrupt controller registers */
|
||||||
#define SAIPIC_NPORTS 9
|
#define SAIPIC_NPORTS 9
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $NetBSD: IPAQ,v 1.46 2006/03/28 20:58:40 pavel Exp $
|
# $NetBSD: IPAQ,v 1.47 2006/04/11 15:08:10 peter Exp $
|
||||||
#
|
#
|
||||||
# iPAQ H3600 -- Windows-CE based PDA
|
# iPAQ H3600 -- Windows-CE based PDA
|
||||||
#
|
#
|
||||||
|
@ -138,7 +138,7 @@ saip0 at mainbus?
|
||||||
|
|
||||||
# Serial
|
# Serial
|
||||||
options CONSPEED=19200
|
options CONSPEED=19200
|
||||||
sacom* at saip? addr 0xd000d000 size 0x24 intr 17
|
sacom* at saip? addr 0x80050000 size 0x24 intr 17
|
||||||
|
|
||||||
# OS Timer
|
# OS Timer
|
||||||
saost* at saip? addr 0x90000000 size 0x20
|
saost* at saip? addr 0x90000000 size 0x20
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $NetBSD: JORNADA720,v 1.57 2006/03/28 20:58:40 pavel Exp $
|
# $NetBSD: JORNADA720,v 1.58 2006/04/11 15:08:10 peter Exp $
|
||||||
#
|
#
|
||||||
# JORNADA -- Windows-CE based jornada 720
|
# JORNADA -- Windows-CE based jornada 720
|
||||||
#
|
#
|
||||||
|
@ -7,7 +7,7 @@ include "arch/hpcarm/conf/std.hpcarm"
|
||||||
|
|
||||||
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||||
|
|
||||||
#ident "GENERIC-$Revision: 1.57 $"
|
#ident "GENERIC-$Revision: 1.58 $"
|
||||||
|
|
||||||
# estimated number of users
|
# estimated number of users
|
||||||
maxusers 32
|
maxusers 32
|
||||||
|
@ -144,7 +144,7 @@ saip0 at mainbus?
|
||||||
|
|
||||||
# Serial
|
# Serial
|
||||||
options CONSPEED=19200
|
options CONSPEED=19200
|
||||||
sacom* at saip? addr 0xd000d000 size 0x24 intr 17
|
sacom* at saip? addr 0x80050000 size 0x24 intr 17
|
||||||
|
|
||||||
# OS Timer
|
# OS Timer
|
||||||
saost* at saip? addr 0x90000000 size 0x20
|
saost* at saip? addr 0x90000000 size 0x20
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $NetBSD: JORNADA820,v 1.4 2006/02/05 05:01:50 cube Exp $
|
# $NetBSD: JORNADA820,v 1.5 2006/04/11 15:08:10 peter Exp $
|
||||||
#
|
#
|
||||||
# JORNADA -- Windows-CE based jornada 820
|
# JORNADA -- Windows-CE based jornada 820
|
||||||
#
|
#
|
||||||
|
@ -7,7 +7,7 @@ include "arch/hpcarm/conf/std.hpcarm"
|
||||||
|
|
||||||
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||||
|
|
||||||
#ident "GENERIC-$Revision: 1.4 $"
|
#ident "GENERIC-$Revision: 1.5 $"
|
||||||
|
|
||||||
# estimated number of users
|
# estimated number of users
|
||||||
maxusers 32
|
maxusers 32
|
||||||
|
@ -140,9 +140,8 @@ cpu0 at mainbus?
|
||||||
saip0 at mainbus?
|
saip0 at mainbus?
|
||||||
|
|
||||||
# Serial
|
# Serial
|
||||||
# ??? virtual address?????
|
|
||||||
options CONSPEED=19200
|
options CONSPEED=19200
|
||||||
sacom* at saip? addr 0xd000d000 size 0x24 intr 17
|
sacom* at saip? addr 0x80050000 size 0x24 intr 17
|
||||||
|
|
||||||
|
|
||||||
#OS Timer
|
#OS Timer
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: hpc_machdep.c,v 1.78 2006/02/27 11:34:35 peter Exp $ */
|
/* $NetBSD: hpc_machdep.c,v 1.79 2006/04/11 15:08:10 peter Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994-1998 Mark Brinicombe.
|
* Copyright (c) 1994-1998 Mark Brinicombe.
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: hpc_machdep.c,v 1.78 2006/02/27 11:34:35 peter Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: hpc_machdep.c,v 1.79 2006/04/11 15:08:10 peter Exp $");
|
||||||
|
|
||||||
#include "opt_ddb.h"
|
#include "opt_ddb.h"
|
||||||
#include "opt_pmap_debug.h"
|
#include "opt_pmap_debug.h"
|
||||||
|
@ -282,6 +282,23 @@ cpu_reboot(int howto, char *bootstr)
|
||||||
#define DRAM_PAGES 8192
|
#define DRAM_PAGES 8192
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Static device mappings. These peripheral registers are mapped at
|
||||||
|
* fixed virtual addresses very early in initarm() so that we can use
|
||||||
|
* them while booting the kernel and stay at the same address
|
||||||
|
* throughout whole kernel's life time.
|
||||||
|
*/
|
||||||
|
static const struct pmap_devmap sa11x0_devmap[] = {
|
||||||
|
/* Physical/virtual address for UART #3. */
|
||||||
|
{
|
||||||
|
SACOM3_VBASE,
|
||||||
|
SACOM3_BASE,
|
||||||
|
0x24,
|
||||||
|
VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE
|
||||||
|
},
|
||||||
|
{ 0, 0, 0, 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initial entry point on startup. This gets called before main() is
|
* Initial entry point on startup. This gets called before main() is
|
||||||
* entered.
|
* entered.
|
||||||
|
@ -587,10 +604,8 @@ initarm(int argc, char **argv, struct bootinfo *bi)
|
||||||
pmap_map_entry(l1pagetable, vector_page, systempage.pv_pa,
|
pmap_map_entry(l1pagetable, vector_page, systempage.pv_pa,
|
||||||
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
|
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
|
||||||
|
|
||||||
/* Map any I/O modules here, as we don't have real bus_space_map() */
|
/* Map the statically mapped devices. */
|
||||||
printf("mapping IO...");
|
pmap_devmap_bootstrap(l1pagetable, sa11x0_devmap);
|
||||||
pmap_map_entry(l1pagetable, SACOM3_BASE, SACOM3_HW_BASE,
|
|
||||||
VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE);
|
|
||||||
|
|
||||||
pmap_map_chunk(l1pagetable, sa1_cache_clean_addr, 0xe0000000,
|
pmap_map_chunk(l1pagetable, sa1_cache_clean_addr, 0xe0000000,
|
||||||
CPU_SA110_CACHE_CLEAN_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
|
CPU_SA110_CACHE_CLEAN_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
|
||||||
|
|
Loading…
Reference in New Issue