From owner-freebsd-hackers@freebsd.org Thu Nov 19 13:10:32 2015 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66A4EA31401 for ; Thu, 19 Nov 2015 13:10:32 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id CA5221927 for ; Thu, 19 Nov 2015 13:10:31 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 29e63f36 for ; Thu, 19 Nov 2015 14:10:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:subject:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; s=mail; bh=y3vWHYzJ1aZJ RV+WPdM+qMQz4OA=; b=rRfPpJwF9tsB8h1vSVwgmL9T75+uV/pPBUI1yPicDphC MLO43oNjSWWqvmXwNPfl0YVKo9alkxVME1wwFENz1Fhjg/+4SfhRsFfL8FKpdfAe owHgtj6EhDop9lnB1nGpZWHpEHEF2eLsJMGNY/0VCBIEuCzbLtafJfMh2CLqIZc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:subject:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; q=dns; s=mail; b=L4dajW xrlbOTiZUVtWeCofmKHxBKHfDMwY8UQ7dq8dEYqGvuK2trDO0j+FZ+/tERNsGNJR w1EpdNeVcqpOp6kPY7hHDxkUC7nmY4Woe/H48Su252xtG7Y8VDndMrIhEdN/6GxN Gpt3H2MOOSbWjt8/70jGQYfmzmwZyHlbEpYFI= Received: from atlantis.staff.bocal.org (163.5.250.153 [163.5.250.153]) by mail.blih.net (OpenSMTPD) with ESMTPSA id e58091b7 TLS version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO for ; Thu, 19 Nov 2015 14:10:26 +0100 (CET) Date: Thu, 19 Nov 2015 14:10:26 +0100 From: Emmanuel Vadot To: freebsd-hackers@freebsd.org Subject: Re: boot1.efi and ConsoleControl on HP 840G1/G2 Message-Id: <20151119141026.c1c859703fc5fcc09d18d9b5@bidouilliste.com> In-Reply-To: <20151119120945.71d0cb068006398d3a556559@bidouilliste.com> References: <20151119120945.71d0cb068006398d3a556559@bidouilliste.com> X-Mailer: Sylpheed 3.4.3 (GTK+ 2.24.28; amd64-portbld-freebsd10.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Nov 2015 13:10:32 -0000 On Thu, 19 Nov 2015 12:09:45 +0100 Emmanuel Vadot wrote: > > Hello Hackers, > > After hours I've found why I couldn't use properly FreeBSD on my HP 840G1/G2 laptop. > > What is happening right now with -current is that the kernel framebuffer is garbage (https://www.bidouilliste.com/images/efi/IMG_2650.JPG). > The problem is that boot1.efi calls ConsoleControl which, from my findings, is not in the UEFI specs but was only in the EDK implementation. > This should not be a problem as LocateProtocol should return != EFI_SUCCESS but on my laptops (and probably others) this is not the case. > > After removing the ConsoleControl related lines and recompiling boot1.efi I can now boot FreeBSD. > > I'm pretty sure that this would not be a problem on other machine (with the patch I can still boot correctly FreeBSD on my Samsung 870Z laptop) but I would prefer that other people test it. > > I've opened a bug on bugzilla (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=204674) if some people want to try the patch. > > Cheers, > > -- > Emmanuel Vadot Replying to myself cause I've found other stuff. I looked at GRUB sources and it do what boot1.efi do (use ConsoleControl to set the Console to text mode, grub_efi_set_text_mode in grub-core/kern/efi/efi.c). The only difference that I can see between how GRUB handle the EFI console and boot1 is that grub never Reset the Console nor change the current text mode (grub-core/term/efi/console.c). So I patched again boot1.efi leaving the ConsoleControl stuff on but commented the Reset and the SetMode stuff, and this worked. This is the screen when the console is Reset : https://www.bidouilliste.com/images/efi/IMG_2649.JPG This is the screen when the console is not reseted : https://www.bidouilliste.com/images/efi/IMG_2651.JPG From loader(8) with the current boot1.efi, if I type gop list I got 4 modes but all of them are 1920x1280. If I gop set X and gop set 0 (1920x1280) (Or via loader.rc), when the kernel start the framebuffer data is correct. From loader(8) with the patched boot1.efi, if I type gop list I got the 4 correct modes. Cheers, -- Emmanuel Vadot