From owner-p4-projects Sat Nov 23 15:34:42 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id CC18B37B404; Sat, 23 Nov 2002 15:34:38 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7BCDA37B401 for ; Sat, 23 Nov 2002 15:34:38 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1A8CE43E4A for ; Sat, 23 Nov 2002 15:34:38 -0800 (PST) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id gANNVHmV006393 for ; Sat, 23 Nov 2002 15:31:17 -0800 (PST) (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id gANNVHxi006390 for perforce@freebsd.org; Sat, 23 Nov 2002 15:31:17 -0800 (PST) Date: Sat, 23 Nov 2002 15:31:17 -0800 (PST) Message-Id: <200211232331.gANNVHxi006390@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar Subject: PERFORCE change 21433 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://perforce.freebsd.org/chv.cgi?CH=21433 Change 21433 by marcel@marcel_nfs on 2002/11/23 15:30:49 Explicitly map the I/O port space. We depended on the loader to have mapped the I/O space. Remove this dependency. While here, don't map the I/O port space with a page size of 256M. Instead use 16M. This is only slightly better because it matches the size of the I/O space in the memory descriptor on the machines seen so far. It's not perfect, because it's still a hardcoding. Affected files ... .. //depot/projects/ia64/sys/ia64/ia64/machdep.c#54 edit .. //depot/projects/ia64/sys/ia64/include/cpu.h#8 edit Differences ... ==== //depot/projects/ia64/sys/ia64/ia64/machdep.c#54 (text+ko) ==== @@ -305,6 +305,38 @@ __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_RR7(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_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 @@ 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. */ ==== //depot/projects/ia64/sys/ia64/include/cpu.h#8 (text+ko) ==== @@ -136,6 +136,7 @@ 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); /* To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message