From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 20:28:14 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D9A441065670; Thu, 28 Oct 2010 20:28:13 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 403538FC20; Thu, 28 Oct 2010 20:28:12 +0000 (UTC) Received: by qwg8 with SMTP id 8so301832qwg.13 for ; Thu, 28 Oct 2010 13:28:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=aB0md5GdOD4Wvi92m/KZ41c66stnlBM6MK7RMI83plI=; b=q+7ZaPgyhxYbFr/bCZ8nT7aTSDZGJ8Na8wxKrUa5fmlr9YUIQEXGsIka+gqu2WJf5T eLkmvpFhq5wNNlSfnt66i1vDlM1XXPlL5dt/MHrr966u7m9bO1Z5dQGO5a/mzd9H3WGW urB5JoOtWsjD8R5S36pnGOOZt7uMlmvvqERRI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=HpDLfNwriUFEzBNlmNdD9cfdykxorbJcHR/IJf2YIS3DA17MTf0dSeV/C83lVqFj+I ppZsPLMFIQz4SSyMnaUTZhNiknDSNdNg9+YF+lnFMx7ZBXHf8P2L/pDFrSaJdgjjxkKw 9cQMeQ5QZC2E564XdGKwE/CzosQcZsCt1rjKk= MIME-Version: 1.0 Received: by 10.229.184.68 with SMTP id cj4mr10725871qcb.48.1288297692198; Thu, 28 Oct 2010 13:28:12 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.237.9 with HTTP; Thu, 28 Oct 2010 13:28:12 -0700 (PDT) In-Reply-To: <201010281411.40423.jhb@freebsd.org> References: <201010281631.o9SGVdtZ014923@svn.freebsd.org> <201010281257.05481.jhb@freebsd.org> <201010281411.40423.jhb@freebsd.org> Date: Thu, 28 Oct 2010 22:28:12 +0200 X-Google-Sender-Auth: SXHMdAtITRrUCaoPVZw-iLX7vMU Message-ID: From: Attilio Rao To: John Baldwin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214457 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 20:28:14 -0000 2010/10/28 John Baldwin : > On Thursday, October 28, 2010 1:21:34 pm Attilio Rao wrote: >> 2010/10/28 John Baldwin : >> > On Thursday, October 28, 2010 12:31:39 pm Attilio Rao wrote: >> >> Author: attilio >> >> Date: Thu Oct 28 16:31:39 2010 >> >> New Revision: 214457 >> >> URL: http://svn.freebsd.org/changeset/base/214457 >> >> >> >> Log: >> >> =C2=A0 Merge nexus.c from amd64 and i386 to x86 subtree. >> >> >> >> =C2=A0 Sponsored by: =C2=A0 =C2=A0 =C2=A0 Sandvine Incorporated >> >> =C2=A0 Tested by: =C2=A0gianni >> >> >> > >> > It would be better to merge these two routines. =C2=A0The loader now p= asses the >> > smap to i386 kernels as well, so ram_attach() should probably be chang= ed to >> > try the amd64 approach first and if that fails fall back to using the >> > phys_avail[] array instead. >> >> What do you think about this patch?: >> Index: nexus.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- nexus.c =C2=A0 =C2=A0 (revision 214457) >> +++ nexus.c =C2=A0 =C2=A0 (working copy) >> @@ -52,9 +52,7 @@ >> =C2=A0#include >> =C2=A0#include >> =C2=A0#include >> -#ifdef __amd64__ >> =C2=A0#include >> -#endif >> =C2=A0#include >> =C2=A0#include >> =C2=A0#include >> @@ -67,12 +65,10 @@ >> =C2=A0#include >> =C2=A0#include >> >> -#ifdef __amd64__ >> =C2=A0#include >> -#include >> -#endif >> =C2=A0#include >> =C2=A0#include >> +#include >> >> =C2=A0#ifdef DEV_APIC >> =C2=A0#include "pcib_if.h" >> @@ -89,11 +85,13 @@ >> =C2=A0#include >> >> =C2=A0#ifdef __amd64__ >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_IO =C2=A0 =C2=A0 =C2= =A0 AMD64_BUS_SPACE_IO >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_MEM =C2=A0 =C2=A0 =C2= =A0AMD64_BUS_SPACE_MEM >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_IO =C2=A0 =C2=A0 =C2= =A0 =C2=A0AMD64_BUS_SPACE_IO >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_MEM =C2=A0 =C2=A0 =C2= =A0 AMD64_BUS_SPACE_MEM >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0ELF_KERN_STR =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0"elf64 kernel" >> =C2=A0#else >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_IO =C2=A0 =C2=A0 =C2= =A0 I386_BUS_SPACE_IO >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_MEM =C2=A0 =C2=A0 =C2= =A0I386_BUS_SPACE_MEM >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_IO =C2=A0 =C2=A0 =C2= =A0 =C2=A0I386_BUS_SPACE_IO >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_MEM =C2=A0 =C2=A0 =C2= =A0 I386_BUS_SPACE_MEM >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0ELF_KERN_STR =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0"elf32 kernel" >> =C2=A0#endif >> @@ -701,16 +699,11 @@ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 panic("ram_attach: resource %d failed to attach", rid); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rid++; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 } >> - =C2=A0 =C2=A0 =C2=A0 return (0); >> -} >> -#else >> -static int >> -ram_attach(device_t dev) >> -{ >> - =C2=A0 =C2=A0 =C2=A0 struct resource *res; >> - =C2=A0 =C2=A0 =C2=A0 vm_paddr_t *p; >> - =C2=A0 =C2=A0 =C2=A0 int error, i, rid; >> >> + =C2=A0 =C2=A0 =C2=A0 /* If at least one smap attached, return. */ >> + =C2=A0 =C2=A0 =C2=A0 if (rid !=3D 0) >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (0); >> + > > Perhaps this instead: > > =C2=A0 =C2=A0 =C2=A0 =C2=A0/* If we found an SMAP, return. */ > =C2=A0 =C2=A0 =C2=A0 =C2=A0if (smapbase !=3D NULL) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (0); No, I don't think this check is right, smapbase will always be !=3D NULL (otherwise the code panics). Attilio --=20 Peace can only be achieved by understanding - A. Einstein