Module Name: src Committed By: cliff Date: Mon Apr 12 22:02:52 UTC 2010
Modified Files: src/sys/arch/evbmips/rmixl [matt-nb5-mips64]: machdep.c Log Message: - include "rmixl_pcix.h" and "rmixl_pcie.h" to get the config flags - include rmixl_pcixvar.h to get proto for rmixl_physaddr_init_pcix() - calls to rmixl_physaddr_init_pcix() and rmixl_physaddr_init_pcie() depend on the config flags - eliminate vm_clusters[], just use mem_clusters[] for everything - add mem_cluster_maxaddr to track highest RAM addr, used to check PCI-X Host BARs; calculate his value just before calling mips_page_physload() i.e. once mem_clusters[] is stable. To generate a diff of this commit: cvs rdiff -u -r1.1.2.27 -r1.1.2.28 src/sys/arch/evbmips/rmixl/machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/evbmips/rmixl/machdep.c diff -u src/sys/arch/evbmips/rmixl/machdep.c:1.1.2.27 src/sys/arch/evbmips/rmixl/machdep.c:1.1.2.28 --- src/sys/arch/evbmips/rmixl/machdep.c:1.1.2.27 Mon Mar 29 23:40:58 2010 +++ src/sys/arch/evbmips/rmixl/machdep.c Mon Apr 12 22:02:52 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.1.2.27 2010/03/29 23:40:58 cliff Exp $ */ +/* $NetBSD: machdep.c,v 1.1.2.28 2010/04/12 22:02:52 cliff Exp $ */ /* * Copyright 2001, 2002 Wasabi Systems, Inc. @@ -112,7 +112,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.1.2.27 2010/03/29 23:40:58 cliff Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.1.2.28 2010/04/12 22:02:52 cliff Exp $"); #define __INTR_PRIVATE @@ -120,6 +120,8 @@ #include "opt_com.h" #include "opt_execfmt.h" #include "opt_memsize.h" +#include "rmixl_pcix.h" +#include "rmixl_pcie.h" #include <sys/param.h> #include <sys/systm.h> @@ -167,6 +169,7 @@ #include <mips/rmi/rmixl_firmware.h> #include <mips/rmi/rmixl_comvar.h> #include <mips/rmi/rmixl_pcievar.h> +#include <mips/rmi/rmixl_pcixvar.h> #ifdef MACHDEP_DEBUG int machdep_debug=MACHDEP_DEBUG; @@ -241,6 +244,7 @@ phys_ram_seg_t mem_clusters[VM_PHYSSEG_MAX]; +u_quad_t mem_cluster_maxaddr; u_int mem_cluster_cnt; @@ -278,9 +282,7 @@ struct rmixl_config *rcp = &rmixl_configuration; void *kernend; uint64_t memsize; - u_int vm_cluster_cnt; uint32_t r; - phys_ram_seg_t vm_clusters[VM_PHYSSEG_MAX]; extern char edata[], end[]; #ifndef MULTIPROCESSOR @@ -397,41 +399,45 @@ /* * Reserve pages from the VM system. - * to maintain mem_clusters[] as a map of raw ram, - * copy into temporary table vm_clusters[] - * work on that and use it to feed vm_physload() */ - KASSERT(sizeof(mem_clusters) == sizeof(vm_clusters)); - memcpy(&vm_clusters, &mem_clusters, sizeof(vm_clusters)); - vm_cluster_cnt = mem_cluster_cnt; /* reserve 0..start..kernend pages */ - vm_cluster_cnt = ram_seg_resv(vm_clusters, vm_cluster_cnt, + mem_cluster_cnt = ram_seg_resv(mem_clusters, mem_cluster_cnt, 0, round_page(MIPS_KSEG0_TO_PHYS(kernend))); /* reserve reset exception vector page */ /* should never be in our clusters anyway... */ - vm_cluster_cnt = ram_seg_resv(vm_clusters, vm_cluster_cnt, + mem_cluster_cnt = ram_seg_resv(mem_clusters, mem_cluster_cnt, 0x1FC00000, 0x1FC00000+NBPG); #ifdef MULTIPROCEESOR /* reserve the cpu_wakeup_info area */ - vm_cluster_cnt = ram_seg_resv(vm_clusters, vm_cluster_cnt, + mem_cluster_cnt = ram_seg_resv(mem_clusters, mem_cluster_cnt, (u_quad_t)trunc_page(rcp->rc_cpu_wakeup_info), (u_quad_t)round_page(rcp->rc_cpu_wakeup_end)); #endif #ifdef MEMLIMIT /* reserve everything >= MEMLIMIT */ - vm_cluster_cnt = ram_seg_resv(vm_clusters, vm_cluster_cnt, + mem_cluster_cnt = ram_seg_resv(mem_clusters, mem_cluster_cnt, (u_quad_t)MEMLIMIT, (u_quad_t)~0); #endif + /* get maximum RAM address from the VM clusters */ + mem_cluster_maxaddr = 0; + for (u_int i=0; i < mem_cluster_cnt; i++) { + u_quad_t tmp = round_page( + mem_clusters[i].start + mem_clusters[i].size); + if (tmp > mem_cluster_maxaddr) + mem_cluster_maxaddr = tmp; + } + DPRINTF(("mem_cluster_maxaddr %#"PRIx64"\n", mem_cluster_maxaddr)); + /* - * Load vm_clusters[] into the VM system. + * Load mem_clusters[] into the VM system. */ mips_page_physload(MIPS_KSEG0_START, (vaddr_t) kernend, - vm_clusters, vm_cluster_cnt, NULL, 0); + mem_clusters, mem_cluster_cnt, NULL, 0); /* * Initialize error message buffer (at end of core). @@ -614,10 +620,14 @@ */ switch(cpu_rmixl_chip_type(mips_options.mips_cpu)) { case CIDFL_RMI_TYPE_XLR: - /* XXX TBD */ +#if NRMIXL_PCIX + rmixl_physaddr_init_pcix(ext); +#endif break; case CIDFL_RMI_TYPE_XLS: +#if NRMIXL_PCIE rmixl_physaddr_init_pcie(ext); +#endif break; case CIDFL_RMI_TYPE_XLP: /* XXX TBD */