From owner-svn-src-projects@FreeBSD.ORG Thu Jun 28 19:27:55 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F701106566B; Thu, 28 Jun 2012 19:27:55 +0000 (UTC) (envelope-from cherry@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A00E8FC0C; Thu, 28 Jun 2012 19:27:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5SJRscM094296; Thu, 28 Jun 2012 19:27:54 GMT (envelope-from cherry@svn.freebsd.org) Received: (from cherry@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5SJRsUH094294; Thu, 28 Jun 2012 19:27:54 GMT (envelope-from cherry@svn.freebsd.org) Message-Id: <201206281927.q5SJRsUH094294@svn.freebsd.org> From: "Cherry G. Mathew" Date: Thu, 28 Jun 2012 19:27:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237724 - projects/amd64_xen_pv/sys/amd64/xen X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 19:27:55 -0000 Author: cherry Date: Thu Jun 28 19:27:54 2012 New Revision: 237724 URL: http://svn.freebsd.org/changeset/base/237724 Log: later initialisation code for the bootstrap vcpu, that depends on uma(9) and malloc(9) initialisation routines having been run. This happens during mi_startup() after SI_SUB_VM init hooks are run. Approved by: gibbs (implicit) Modified: projects/amd64_xen_pv/sys/amd64/xen/machdep.c Modified: projects/amd64_xen_pv/sys/amd64/xen/machdep.c ============================================================================== --- projects/amd64_xen_pv/sys/amd64/xen/machdep.c Thu Jun 28 19:19:38 2012 (r237723) +++ projects/amd64_xen_pv/sys/amd64/xen/machdep.c Thu Jun 28 19:27:54 2012 (r237724) @@ -56,10 +56,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -74,8 +76,13 @@ #include #include +#include +#include +#include +#include #include +#include #include #include #include @@ -110,6 +117,8 @@ vm_offset_t pa_index = 0; vm_paddr_t phys_avail[PHYSMAP_SIZE + 2]; vm_paddr_t dump_avail[PHYSMAP_SIZE + 2]; +struct kva_md_info kmi; + struct pcpu __pcpu[MAXCPU]; struct user_segment_descriptor gdt[512] @@ -124,11 +133,14 @@ void failsafe_callback(void); vm_paddr_t initxen(struct start_info *); -extern void identify_cpu(void); +extern void printcpuinfo(void); /* XXX header file */ +extern void identify_cpu(void); /* XXX header file */ +extern void panicifcpuunsupported(void); /* XXX header file */ static void get_fpcontext(struct thread *td, mcontext_t *mcp); static int set_fpcontext(struct thread *td, const mcontext_t *mcp, char *xfpustate, size_t xfpustate_len); + /* Expects a zero-ed page aligned page */ static void setup_gdt(struct user_segment_descriptor *thisgdt) @@ -577,6 +589,73 @@ cpu_idle_wakeup(int cpu) return (1); } +static void +cpu_startup(void *dummy) +{ + uintmax_t memsize; + + /* + * Good {morning,afternoon,evening,night}. + */ + startrtclock(); + + //printcpuinfo(); + //panicifcpuunsupported(); + +#ifdef PERFMON + perfmon_init(); +#endif + realmem = Maxmem; + + /* + * Display physical memory if SMBIOS reports reasonable amount. + */ + memsize = 0; + if (memsize < ptoa((uintmax_t)cnt.v_free_count)) + memsize = ptoa((uintmax_t)Maxmem); + printf("real memory = %ju (%ju MB)\n", memsize, memsize >> 20); + + /* + * Display any holes after the first chunk of extended memory. + */ + if (bootverbose) { + int indx; + + printf("Physical memory chunk(s):\n"); + for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) { + vm_paddr_t size; + + size = phys_avail[indx + 1] - phys_avail[indx]; + printf( + "0x%016jx - 0x%016jx, %ju bytes (%ju pages)\n", + (uintmax_t)phys_avail[indx], + (uintmax_t)phys_avail[indx + 1] - 1, + (uintmax_t)size, (uintmax_t)size / PAGE_SIZE); + } + } + + vm_ksubmap_init(&kmi); + + printf("avail memory = %ju (%ju MB)\n", + ptoa((uintmax_t)cnt.v_free_count), + ptoa((uintmax_t)cnt.v_free_count) / 1048576); + + /* + * Set up buffers, so they can be used to read disk labels. + */ + bufinit(); + vm_pager_bufferinit(); + + cpu_setregs(); + + /* + * Add BSP as an interrupt target. + */ + intr_add_cpu(0); +} + +SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL); + /* XXX: Unify with "native" machdep.c */ /* * Reset registers to default values on exec. @@ -588,6 +667,12 @@ exec_setregs(struct thread *td, struct i } void +cpu_setregs(void) +{ + /* XXX: */ +} + +void cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size) { @@ -1427,3 +1512,4 @@ freebsd4_sigreturn(struct thread *td, st return sys_sigreturn(td, (struct sigreturn_args *)uap); } #endif +