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)
This commit is contained in:
Marcel Moolenaar 2002-11-24 20:15:08 +00:00
parent 26cd294128
commit 53efb27fc5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=107206
2 changed files with 38 additions and 3 deletions

View File

@ -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.
*/

View File

@ -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);
/*