All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Jones <pjones@redhat.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: Matt Fleming <matt@console-pimps.org>,
	linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Matt Fleming <matt.fleming@intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] x86/efi: Add EFI framebuffer earlyprintk support
Date: Thu, 10 Oct 2013 14:09:37 -0400	[thread overview]
Message-ID: <20131010180937.GD18821@fenchurch.internal.datastacks.com> (raw)
In-Reply-To: <20131010174521.GA27218@gmail.com>

On Thu, Oct 10, 2013 at 07:45:21PM +0200, Ingo Molnar wrote:
> 
> * Peter Jones <pjones@redhat.com> wrote:
> 
> > On Thu, Oct 10, 2013 at 07:28:44PM +0200, Ingo Molnar wrote:
> > > 
> > > Is a non-32-bit framebuffer a possibility? If yes then it might be nice to 
> > > emit an informative printk() here, so that users who try to enable EFI 
> > > early-printk can at least see why it's not working. (Assuming they get to 
> > > look at regular printk output, on a safe/working kernel.)
> > 
> > Not really - the spec allows RGBx, BGRx, and for custom bit masks, but
> > they're define like:
> > 
> > typedef struct {
> > 	UINT32 RedMask;
> > 	UINT32 GreenMask;
> > 	UINT32 BlueMask;
> > 	UINT32 ReservedMask;
> > } EFI_PIXEL_BITMASK;
> 
> Hm, that structure does not show up anywhere in the kernel that I can see.

It's the thing being interpretted in arch/x86/boot/compressed/eboot.c in
setup_gop() in the code that looks like:

        if (pixel_format == PIXEL_RGB_RESERVED_8BIT_PER_COLOR) {
		si->lfb_depth = 32;
		si->lfb_linelength = pixels_per_scan_line * 4;
		...
	} else if (pixel_format == PIXEL_BGR_RESERVED_8BIT_PER_COLOR) {
		...
	} else if (pixel_format == PIXEL_BIT_MASK) {
		find_bits(pixel_info.red_mask, &si->red_pos, &si->red_size);
		...
	...

> How are those mask values to be interpreted? As regular bitmasks? Are bits 
> in the masks set to 1 consecutively, starting from bit 0?

So, the spec actually has some sample code in it:

INTN
GetPixelElementSize (
IN EFI_PIXEL_BITMASK *PixelBits
)
{
	INTN HighestPixel = -1;
	INTN BluePixel;
	INTN RedPixel;
	INTN GreenPixel;
	INTN RsvdPixel;
	BluePixel = FindHighestSetBit (PixelBits->BlueMask);
	RedPixel = FindHighestSetBit (PixelBits->RedMask);
	GreenPixel = FindHighestSetBit (PixelBits->GreenMask);
	RsvdPixel = FindHighestSetBit (PixelBits->ReservedMask);
	HighestPixel = max (BluePixel, RedPixel);
	HighestPixel = max (HighestPixel, GreenPixel);
	HighestPixel = max (HighestPixel, RsvdPixel);
	return HighestPixel;
}
EFI_PHYSICAL_ADDRESS NewPixelAddress;
EFI_PHYSICAL_ADDRESS CurrentPixelAddress;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION OutputInfo;
INTN PixelElementSize;

switch (OutputInfo.PixelFormat) {
	case PixelBitMask:
		PixelElementSize = GetPixelElementSize (&OutputInfo.PixelInformation);
		break;
	case PixelBlueGreenRedReserved8BitPerColor:
	case PixelRedGreenBlueReserved8BitPerColor:
		PixelElementSize = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
		break;
}

Which makes this painfully clear.

> Also, the main question would be, what is the typical value for 
> si->lfb_depth. 32 on almost all EFI systems? All around the map? Depends 
> on what graphics state the EFI bootloader passes us?

Yes, 32 on almost all systems that implement a framebuffer console at
all.

-- 
        Peter

  parent reply	other threads:[~2013-10-10 18:09 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-10 16:41 [PATCH] x86/efi: Add EFI framebuffer earlyprintk support Matt Fleming
2013-10-10 16:41 ` Matt Fleming
     [not found] ` <1381423261-30566-1-git-send-email-matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2013-10-10 17:28   ` Ingo Molnar
2013-10-10 17:28     ` Ingo Molnar
     [not found]     ` <20131010172844.GA26430-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-10-10 17:37       ` Peter Jones
2013-10-10 17:37         ` Peter Jones
2013-10-10 17:45         ` Ingo Molnar
     [not found]           ` <20131010174521.GA27218-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-10-10 17:58             ` Matthew Garrett
2013-10-10 17:58               ` Matthew Garrett
     [not found]               ` <20131010175828.GA9065-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>
2013-10-11  6:21                 ` Ingo Molnar
2013-10-11  6:21                   ` Ingo Molnar
2013-10-10 18:09           ` Peter Jones [this message]
     [not found]             ` <20131010180937.GD18821-FS9oOTXHwv9t4tGkRPVz9tcb/sdHg95EuydrBrBl+0sAvxtiuMwx3w@public.gmane.org>
2013-10-11  7:08               ` Geert Uytterhoeven
2013-10-11  7:08                 ` Geert Uytterhoeven
2013-10-11 14:00       ` Matt Fleming
2013-10-11 14:00         ` Matt Fleming
     [not found]         ` <20131011140039.GF12321-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2013-10-12 17:49           ` Ingo Molnar
2013-10-12 17:49             ` Ingo Molnar
     [not found]             ` <20131012174934.GA18849-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-10-13 20:47               ` H. Peter Anvin
2013-10-13 20:47                 ` H. Peter Anvin
     [not found]                 ` <525B06CB.6090602-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
2013-10-14  7:57                   ` Ingo Molnar
2013-10-14  7:57                     ` Ingo Molnar
     [not found]                     ` <20131014075726.GB20435-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-10-16  9:16                       ` Matt Fleming
2013-10-16  9:16                         ` Matt Fleming
     [not found]                         ` <20131016091648.GD10834-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2013-10-16  9:27                           ` Ingo Molnar
2013-10-16  9:27                             ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131010180937.GD18821@fenchurch.internal.datastacks.com \
    --to=pjones@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.fleming@intel.com \
    --cc=matt@console-pimps.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.