Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZN3e4-0001mq-Fr for mharc-grub-devel@gnu.org; Wed, 05 Aug 2015 14:42:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43676) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZN3e2-0001m0-Hb for grub-devel@gnu.org; Wed, 05 Aug 2015 14:42:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZN3dz-0004th-63 for grub-devel@gnu.org; Wed, 05 Aug 2015 14:42:30 -0400 Received: from 66-220-144-178.intmgw.facebook.com ([66.220.144.178]:33592 helo=mx-out.facebook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZN3dz-0004tc-04 for grub-devel@gnu.org; Wed, 05 Aug 2015 14:42:27 -0400 Received: from facebook.com (2401:db00:2040:5012:face:0:9:0) by mx-out.facebook.com (10.103.99.97) with ESMTP id 7dc3ce1a3b9a11e5b0a50002c9931860-7a3f92b0 for ; Wed, 05 Aug 2015 10:50:42 -0700 Received: by devbig041.ash4.facebook.com (Postfix, from userid 8730) id 0D95D454205B; Wed, 5 Aug 2015 10:50:41 -0700 (PDT) From: Josef Bacik To: grub-devel@gnu.org, mchang@suse.com, pjones@redhat.com, kernel-team@fb.com Subject: [PATCH 1/3] efinet: handle get_status() properly Date: Wed, 5 Aug 2015 10:50:38 -0700 Message-Id: <1438797040-1667541-2-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 1.8.5.6 In-Reply-To: <1438797040-1667541-1-git-send-email-jbacik@fb.com> References: <1438797040-1667541-1-git-send-email-jbacik@fb.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 66.220.144.178 Cc: Josef Bacik X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Aug 2015 18:42:31 -0000 The EFI SNP documentation isn't super clear on the value that is returned in txbuf when calling into GetStatus. The documentation says its the pointer to the recycle buffer, but the documentation for Transmit() says that it should be the pointer to the buffer that we transmitted. On the boxes I'm using it's just a random pointer (usually 0x1). It is definitely transmitting stuff, but the get_status call is not returning the pointer to the txbuf we passed in. Looking at a few EFI implementations and other SNP drivers it seems like there is confusion everywhere on this. So since we only transmit one buffer at a time, just assume that a non-NULL txbuf means that our transmit happened properly. With this patch I can now do networking on our EFI enabled boxes. Thanks, cc: Peter Jones Signed-off-by: Josef Bacik --- grub-core/net/drivers/efi/efinet.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c index f27a117..4d3f8aa 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -47,19 +47,11 @@ send_card_buffer (struct grub_net_card *dev, if (st != GRUB_EFI_SUCCESS) return grub_error (GRUB_ERR_IO, N_("couldn't send network packet")); - if (txbuf == dev->txbuf) + if (txbuf) { dev->txbusy = 0; break; } - if (txbuf) - { - st = efi_call_7 (net->transmit, net, 0, dev->last_pkt_size, - dev->txbuf, NULL, NULL, NULL); - if (st != GRUB_EFI_SUCCESS) - return grub_error (GRUB_ERR_IO, - N_("couldn't send network packet")); - } if (limit_time < grub_get_time_ms ()) return grub_error (GRUB_ERR_TIMEOUT, N_("couldn't send network packet")); @@ -84,8 +76,9 @@ send_card_buffer (struct grub_net_card *dev, we run in the GRUB_ERR_TIMEOUT case above. Perhaps a timeout in the FW has discarded the recycle buffer. */ + txbuf = NULL; st = efi_call_3 (net->get_status, net, 0, &txbuf); - dev->txbusy = !(st == GRUB_EFI_SUCCESS && txbuf == dev->txbuf); + dev->txbusy = !(st == GRUB_EFI_SUCCESS && txbuf); return GRUB_ERR_NONE; } -- 1.8.5.6