Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Nov 2002 15:31:17 -0800 (PST)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 21433 for review
Message-ID:  <200211232331.gANNVHxi006390@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200211232331.gANNVHxi006390>