From owner-freebsd-questions@FreeBSD.ORG Sat Nov 1 01:45:03 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 6CB7C2B9; Sat, 1 Nov 2014 01:45:03 +0000 (UTC) Received: from mail-wg0-x22a.google.com (mail-wg0-x22a.google.com [IPv6:2a00:1450:400c:c00::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D5AC95FB; Sat, 1 Nov 2014 01:45:02 +0000 (UTC) Received: by mail-wg0-f42.google.com with SMTP id k14so7652827wgh.29 for ; Fri, 31 Oct 2014 18:45:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=gGt9W6mQXupmvt7rehAh7kpB6tz4JZFIvbwDQnORkjY=; b=uoCVWuG/doxDL1GFh+ROR3CWmpfmocMtz4dU2lR6JgusoT9MhSV5efigxbjnzfi/50 y1Q5idvaoO3bpfl9cmnQWFJzJQqLN/VWOjCFfGFIsl2D1XHKDPw2lT3pya1B90to6m/2 4rtp3rOlsL4rbxNqUCvZ6QkdGJr5lXJXbzGb76h6DALgTvpfr/NeyzMsyZ/qCVpHuQnL eeSfyfAUz5j6kSMMbFaDSrv+x/2zE6mgspqAH55klGqh1dtwC4+wBQ1Cpqyr60BSNOXO KG0+u1bdxZUpRFyLuLrxqPvYkpmKMJo+ZEoyoDCyJiItXcr4onor9xEfMYKOcrFogkWA keFA== MIME-Version: 1.0 X-Received: by 10.180.92.169 with SMTP id cn9mr941183wib.26.1414806300934; Fri, 31 Oct 2014 18:45:00 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.216.106.136 with HTTP; Fri, 31 Oct 2014 18:45:00 -0700 (PDT) In-Reply-To: <1414714882.16625.43.camel@ammy.its.adelaide.edu.au> References: <1414622725.16625.22.camel@ammy.its.adelaide.edu.au> <1414714882.16625.43.camel@ammy.its.adelaide.edu.au> Date: Fri, 31 Oct 2014 18:45:00 -0700 X-Google-Sender-Auth: wt5L09asFXwsJCCaBh4kFBtDMPM Message-ID: Subject: Re: Loader vs loader efi ficl incompatibility From: Adrian Chadd To: William Content-Type: text/plain; charset=UTF-8 Cc: Ed Maste , 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: Sat, 01 Nov 2014 01:45:03 -0000 Hi! Is the code anywhere public? If not, would you actually publish it somewhere? I'm glad you're digging into this! It sounds like it's a real pre-requisite to make these laptops useful in FreeBSD. Thanks! -adrian On 30 October 2014 17:21, William wrote: > On Thu, 2014-10-30 at 10:59 -0400, Ed Maste wrote: >> On 29 October 2014 18:45, William wrote: >> > Hi, >> > >> > To get my laptop working (Macbook pro) with freebsd, at boot you need to >> > outb to some memory locations before boot so that graphics works. >> >> Do you happen to have a good reference for the io ports you mention? I >> see them described on a number of Linux forums, but a canonical source >> would be nice. > > So, I should explain. > > In the MacBookPro 15" 8,2, it has two graphics cards. The i915 intel and > a radeon 6770. These are connected to a multiplexer (gmux) and that is > connected to the laptop panel via LVDS. > > When the system boots, the ati card is selected on the gmux, and both > powered on. I wish to preboot change to the i915 then boot the system. > > The reason for doing this preboot is that efifb doesn't support > re-probing the display after a switch. As I say this, I mean that > FreeBSD doesn't currently appear to support gmux switching, I wrote my > own kernel module to do this, so it's very rough and doesn't interact > with efifb at all. > > The obvious reason for the gpu swap and power down of the inactive card > is battery and heat. The radeon idle runs at 60+ degrees, and halves the > battery. > > There is no canonical source that I know of, merely reverse engineering. > If you want the details of the specific addresses I can provide these, > as each one of those 4 has a unique function in the gmux. > > >> >> > 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 > > Removing the ifdef would be enough to make this work for my own personal > use? Or would there be unintended consequences. > >> I'd really like to have MBP support be handled automatically in the >> loader itself. >> _______________________________________________ > > Each Mac revision slightly tweaks the gmux, which makes it harder to > support. IIRC the linux kernel apple-gmux implementation has this > working. > > The correct way to do this really would be early in loader before the > display is setup, change to the intel, and reinit the framebuffer. This > relies on Mac hardware detection, the programmatic gmux base address > detection, and loader being able to completely reinit the frame buffer > in efi. Alternately, you do it just after loader, but just before the > freebsd kernel runs so that you don't worry about the screen going black > before the efifb gets reinitialised. > > Then freebsd itself needs a graphics swapping kernel module. You need to > be able to carry out a swap, do an LVDS reprobe, and redraw the fb / > display. radeon supports this, i915 does not (It's been broken in linux > for years and no developers are willing to look at it). For tty with > KMS/DRM which does not use these drivers, you likely could just do some > handling in efifb. > > All in all, it would be far more than just a quick "loader" fix imo, and > for my specific use case I just need the intel gpu working. I'm quite > happy to just drop the outb commands into boot.4th. I'd love to see the > fix be done "properly" for all, but I don't have the knowledge to do it, > the time etc. I'd be happy some of the work into the loader components > for this, but I don't know enough about KMS/DRM to fix those components. > > Finally, I want to ask if hardware-specific detection should go into > loader? I'm not 100% familiar with this architecture and if this very > targeted hardware manipulation should go in it. > > -- > William > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"