From owner-freebsd-arm@FreeBSD.ORG Thu Oct 8 14:18:56 2009 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ABAAF106566B for ; Thu, 8 Oct 2009 14:18:56 +0000 (UTC) (envelope-from gballet@gmail.com) Received: from mail-ew0-f218.google.com (mail-ew0-f218.google.com [209.85.219.218]) by mx1.freebsd.org (Postfix) with ESMTP id 44A168FC0A for ; Thu, 8 Oct 2009 14:18:55 +0000 (UTC) Received: by ewy18 with SMTP id 18so135561ewy.43 for ; Thu, 08 Oct 2009 07:18:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=hYR9WzTkBN+88dT0q4AkbIraZYl6/0lo6LKNnAvAQfU=; b=Pqq9PqDx2wB1yG2c/hJmN96gioyhzvz7aiSRsV8zqjmRxPD/A2gL68ZqIAKwPdC2q7 jQ+3zhn/w8HidAk0ZYkr/HNkl+AsQaKs9qj54VhoLLKEbpD1E91DTU1mPxwtMOtJMU0t UZ1u7gmAL7Bh9zTQrutgOBOZ9Y6fsyvDdjvW0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=MGKoF/BfR+V2A9YVaf4kFc0I2eQflIAWysEunW7nkyB7GzWtVUJEjhdc6ifyA+agHY HxzXnn9XZbqplARqez1Jlt5bzkF++Fvavjt5SO4yu6ZTlxS2d05F+8Nm8g2YDyK5nEWo 2UKdxn5Q6P5EC/pPm5PsA+8BGTj3RrYwQRHL4= MIME-Version: 1.0 Received: by 10.211.131.11 with SMTP id i11mr8114100ebn.68.1255011535274; Thu, 08 Oct 2009 07:18:55 -0700 (PDT) Date: Thu, 8 Oct 2009 16:18:55 +0200 Message-ID: From: Guillaume Ballet To: freebsd-arm@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: Adding members to struct cpu_functions X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Oct 2009 14:18:56 -0000 Hello list, I am continuing my effort to port FreeBSD to the BeagleBoard. I reached the point where the system prompts for the root filesystem. I am therefore cleaning up my code and will then post it to this list for comments. I still have a few hacky fixups to remove before it becomes readable :) I know that Mark Tinguely, whose help has been precious in this endeavor, has some patches ready for ARMv6 cache management, so I did not focus on this. At the moment, I am using backward-compatibility for the TLB format. I want to start using the ARMv6 TLB format. My current problem is that most of the arch-dependent code uses macros that are defined to match the pre-ARMv6 TLB format. There are several ways of fixing this, including defining these macros depending on some symbol such as _ARM_ARCH_* or CPU_ARM*. I am however no friend of heavy preprocessor flagging. What if instead, cpu_functions was extended to include fields like the prototype for TLB entries of each size? For example, take this patch to the following excerpt from pmap_map_chunk in sys/arm/arm/pmap.c: /* See if we can use a L2 large page mapping. */ if (L2_L_MAPPABLE_P(va, pa, resid)) { #ifdef VERBOSE_INIT_ARM printf("L"); #endif for (i = 0; i < 16; i++) { pte[l2pte_index(va) + i] = - L2_L_PROTO | pa | + cpufuncs.cf_l2_l_proto | pa | - L2_L_PROT(PTE_KERNEL, prot) | f2l; + cpufuncs.l2_l_prot(PTE_KERNEL, prot) | f2l; PTE_SYNC(&pte[l2pte_index(va) + i]); } va += L2_L_SIZE; pa += L2_L_SIZE; resid -= L2_L_SIZE; continue; } Would that be acceptable? Now, assuming people agree with this change, that would only be a first step because all values for cpufuncs are defined in the same file (cpufunc.c), which is guarded with as many CPU_ARMx defines as there are cpu flavors. Is there a specific reason for all these structures to be defined in a same file, instead of defining it in a platform- or cpu-specific file and using the files.* to select the appropriate cpufunc flavor in the build system? Guillaume