From owner-freebsd-questions@FreeBSD.ORG Tue Nov 4 00:00:42 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8C34BBE3; Tue, 4 Nov 2014 00:00:42 +0000 (UTC) Received: from mail.firstyear.id.au (ppp194-109.static.internode.on.net [203.122.194.109]) by mx1.freebsd.org (Postfix) with ESMTP id EE2F9E43; Tue, 4 Nov 2014 00:00:41 +0000 (UTC) Received: from [129.127.46.250] (ammy.its.adelaide.edu.au [129.127.46.250]) by mail.firstyear.id.au (Postfix) with ESMTPSA id 41C4C453C441; Tue, 4 Nov 2014 10:30:39 +1030 (ACDT) Message-ID: <1415059238.8321.12.camel@ammy.its.adelaide.edu.au> Subject: Re: Loader vs loader efi ficl incompatibility From: William To: Ed Maste Date: Tue, 04 Nov 2014 10:30:38 +1030 In-Reply-To: References: <1414622725.16625.22.camel@ammy.its.adelaide.edu.au> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4 (3.10.4-4.fc20) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=1.3 required=5.0 tests=RDNS_NONE autolearn=no autolearn_force=no version=3.4.0 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lyra.ipa.blackhats.net.au Cc: FreeBSD Questions X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Nov 2014 00:00:42 -0000 > > Are there differences in the ficl interpreter between loader and > > loader.efi? Is this perhaps a bug? > > The loader only includes inb and outb for i386 (the non-UEFI loader is > 32-bit for both i386 and amd64): > > #ifdef __i386__ > dictAppendWord(dp, "outb", ficlOutb, FW_DEFAULT); > dictAppendWord(dp, "inb", ficlInb, FW_DEFAULT); > #endif > > We'd need to make these available in the 64-bit loader.efi, although > I'd really like to have MBP support be handled automatically in the > loader itself. Hi I've done some testing and the following patch works to make outb and inb available on amd64. The main question and concern is that I'm A) Duplicating the code from i386 B) That I am enabling this by commenting out the ifdef. Is there an __amd64__ ifdef I can use? Or can we make outb / inb platform independent. I would assume they are coming from machine/cpufunc.h This of course lets me initially get the mac to boot, and I'm having some display issues now. These have been posted to the x11 mailing list. Going forwards you mention making the MBP support part of loader itself. Where in loader is hardware specific initialisation done? Any pointers on how to develop this support? svn diff Index: amd64/sysdep.c =================================================================== --- amd64/sysdep.c (revision 274065) +++ amd64/sysdep.c (working copy) @@ -15,6 +15,7 @@ #else #include #endif +#include #include "ficl.h" /* @@ -77,8 +78,37 @@ free(p); } +/* + * outb ( port# c -- ) + * Store a byte to I/O port number port# + */ +void +ficlOutb(FICL_VM *pVM) +{ + u_char c; + u_int32_t port; + port=stackPopUNS(pVM->pStack); + c=(u_char)stackPopINT(pVM->pStack); + outb(port,c); +} + /* + * inb ( port# -- c ) + * Fetch a byte from I/O port number port# + */ +void +ficlInb(FICL_VM *pVM) +{ + u_char c; + u_int32_t port; + + port=stackPopUNS(pVM->pStack); + c=inb(port); + stackPushINT(pVM->pStack,c); +} + +/* ** Stub function for dictionary access control - does nothing ** by default, user can redefine to guarantee exclusive dict ** access to a single thread for updates. All dict update code Index: ficl.h =================================================================== --- ficl.h (revision 274065) +++ ficl.h (working copy) @@ -1113,10 +1113,10 @@ ** Various FreeBSD goodies */ -#if defined(__i386__) && !defined(TESTMAIN) +/* #if defined(__i386__) && !defined(TESTMAIN) -- Is there an __amd64__ I can use here? */ extern void ficlOutb(FICL_VM *pVM); extern void ficlInb(FICL_VM *pVM); -#endif +/* #endif */ extern void ficlSetenv(FICL_VM *pVM); extern void ficlSetenvq(FICL_VM *pVM); Index: loader.c =================================================================== --- loader.c (revision 274065) +++ loader.c (working copy) @@ -786,10 +786,10 @@ dictAppendWord(dp, "findfile", ficlFindfile, FW_DEFAULT); dictAppendWord(dp, "ccall", ficlCcall, FW_DEFAULT); #ifndef TESTMAIN -#ifdef __i386__ +/* #ifdef __i386__ -- Is there an __amd64__ I can use here? */ dictAppendWord(dp, "outb", ficlOutb, FW_DEFAULT); dictAppendWord(dp, "inb", ficlInb, FW_DEFAULT); -#endif +/* #endif */ #ifdef HAVE_PNP dictAppendWord(dp, "pnpdevices",ficlPnpdevices, FW_DEFAULT); dictAppendWord(dp, "pnphandlers",ficlPnphandlers, FW_DEFAULT);