diff options
author | marcel <marcel@FreeBSD.org> | 2002-11-24 20:15:08 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2002-11-24 20:15:08 +0000 |
commit | 923bcb0860f02fab9cc26fecdbcffc17a9d9a7ec (patch) | |
tree | 0174721c766567860a3054975c75bd180c9a2328 /sys/ia64 | |
parent | 3f1e360689c0c8121460a2e8043c6e572491d526 (diff) | |
download | FreeBSD-src-923bcb0860f02fab9cc26fecdbcffc17a9d9a7ec.zip FreeBSD-src-923bcb0860f02fab9cc26fecdbcffc17a9d9a7ec.tar.gz |
MFp4:
Add function map_port_space() to map the memory mapped I/O port
range as uncacheable virtual memory and call it prior to probing
for a console. This removes the dependency on the loader to have
done this for us. Note that this change does not include doing
the same for APs.
Approved by: re (blanket)
Diffstat (limited to 'sys/ia64')
-rw-r--r-- | sys/ia64/ia64/machdep.c | 40 | ||||
-rw-r--r-- | sys/ia64/include/cpu.h | 1 |
2 files changed, 38 insertions, 3 deletions
diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c index 3bb9e34..02ab39d 100644 --- a/sys/ia64/ia64/machdep.c +++ b/sys/ia64/ia64/machdep.c @@ -305,6 +305,38 @@ map_pal_code(void) __asm __volatile("mov psr.l=%0;; srlz.i;;" :: "r" (psr)); } +void +map_port_space(void) +{ + struct ia64_pte pte; + u_int64_t psr; + + /* XXX we should fail hard if there's no I/O port space. */ + if (ia64_port_base == 0) + return; + + bzero(&pte, sizeof(pte)); + pte.pte_p = 1; + pte.pte_ma = PTE_MA_UC; + pte.pte_a = 1; + pte.pte_d = 1; + pte.pte_pl = PTE_PL_KERN; + pte.pte_ar = PTE_AR_RWX; + pte.pte_ppn = ia64_port_base >> 12; + + __asm __volatile("mov %0=psr;;" : "=r" (psr)); + __asm __volatile("rsm psr.ic|psr.i;; srlz.i;;"); + __asm __volatile("mov cr.ifa=%0" :: + "r"(IA64_PHYS_TO_RR6(ia64_port_base))); + /* XXX We should use the size from the memory descriptor. */ + __asm __volatile("mov cr.itir=%0" :: "r"(24 << 2)); + __asm __volatile("srlz.i;;"); + __asm __volatile("itr.i itr[%0]=%1;;" :: + "r"(1), "r"(*(u_int64_t*)&pte)); + __asm __volatile("srlz.i;;"); + __asm __volatile("mov psr.l=%0;; srlz.i;;" :: "r" (psr)); +} + static void calculate_frequencies(void) { @@ -412,6 +444,11 @@ ia64_init(u_int64_t arg1, u_int64_t arg2) ia64_pal_base = mdp->PhysicalStart; } + /* Map the memory mapped I/O Port space */ + KASSERT(ia64_port_base != 0, + ("%s: no I/O port memory region", __func__)); + map_port_space(); + metadata_missing = 0; if (bootinfo.bi_modulep) preload_metadata = (caddr_t)bootinfo.bi_modulep; @@ -422,9 +459,6 @@ ia64_init(u_int64_t arg1, u_int64_t arg2) else kern_envp = (caddr_t)bootinfo.bi_envp; - KASSERT(ia64_port_base != 0, - ("%s: no I/O memory region", __func__)); - /* * Look at arguments passed to us and compute boothowto. */ diff --git a/sys/ia64/include/cpu.h b/sys/ia64/include/cpu.h index 92e2cce..324b035 100644 --- a/sys/ia64/include/cpu.h +++ b/sys/ia64/include/cpu.h @@ -136,6 +136,7 @@ void trap(int vector, int imm, struct trapframe *framep); void ia64_probe_sapics(void); int ia64_count_cpus(void); void map_pal_code(void); +void map_port_space(void); void cpu_mp_add(uint, uint, uint); /* |