Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZN3YY-0005nc-6S for mharc-grub-devel@gnu.org; Wed, 05 Aug 2015 14:36:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZN3YW-0005kH-Ep for grub-devel@gnu.org; Wed, 05 Aug 2015 14:36:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZN3YS-0002U8-I7 for grub-devel@gnu.org; Wed, 05 Aug 2015 14:36:48 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:24471) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZN3YS-0002Sx-9J for grub-devel@gnu.org; Wed, 05 Aug 2015 14:36:44 -0400 Received: from pps.filterd (m0044012 [127.0.0.1]) by mx0a-00082601.pphosted.com (8.14.5/8.14.5) with SMTP id t75IVTNj009452; Wed, 5 Aug 2015 11:36:42 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : mime-version : content-type; s=facebook; bh=ouXVGLSPV1IC5VCqQ52hvWuqXaXi6woygORkJ+XWloI=; b=IVSYmPAvvK3WX7HNr/sNHKFTCnmpWrUcK8mMwqfrTVvq92EijQf1dHIOJwSps7YvqQtY RNIiua8RWnnINLmng/qAu/c2QUaiBarJ91xKPQlyVapcUni3WzZ6zacDf4QOVjAjoWw2 sf0NHgMAAMaa1/l8e4JO22zCR4+dYy78+f4= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 1w3q90848c-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Wed, 05 Aug 2015 11:36:42 -0700 Received: from localhost (192.168.52.123) by mail.thefacebook.com (192.168.16.21) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 5 Aug 2015 11:36:40 -0700 From: Josef Bacik To: , , Subject: [PATCH 1/3] efinet: handle get_status() properly Date: Wed, 5 Aug 2015 14:36:37 -0400 Message-ID: <1438799799-32097-1-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.1.0 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.168.52.123] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.14.151, 1.0.33, 0.0.0000 definitions=2015-08-05_10:2015-08-05, 2015-08-05, 1970-01-01 signatures=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 67.231.145.42 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:36:49 -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; } -- 2.1.0