From patchwork Wed Dec 28 08:42:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 89161 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp5374051qgi; Wed, 28 Dec 2016 00:44:56 -0800 (PST) X-Received: by 10.55.43.149 with SMTP id r21mr37296729qkr.123.1482914696707; Wed, 28 Dec 2016 00:44:56 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id u41si29595231qtu.283.2016.12.28.00.44.56; Wed, 28 Dec 2016 00:44:56 -0800 (PST) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id F2C1160D29; Wed, 28 Dec 2016 08:44:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 2D8D96065B; Wed, 28 Dec 2016 08:44:51 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 3F3816065E; Wed, 28 Dec 2016 08:44:49 +0000 (UTC) Received: from mail-pg0-f47.google.com (mail-pg0-f47.google.com [74.125.83.47]) by lists.linaro.org (Postfix) with ESMTPS id 160C16064F for ; Wed, 28 Dec 2016 08:44:47 +0000 (UTC) Received: by mail-pg0-f47.google.com with SMTP id g1so114671755pgn.0 for ; Wed, 28 Dec 2016 00:44:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=vToOSDkMdZ/snJIes1PGpr9nLtjDtD2TjA2uw0hGK5Y=; b=COX2IkWve2X0kkXkd9EQ5MWyB+HnixhBk67qsXkB+GaV7jOIqTqpWK89aM/4Nh+PV/ NEnq1iC5ndyGHKdpZ1v17o1ePG+9hBtKkikVmvutwB7Y9frWvB8BfK8t7Zo9F5DZF5qd 9CUkZ2zogRBVOku9TMq7YL9SeV0rybXcHTBqzfbBJqjY5eOAwQ71+PM5wevNVEowe7DC 8puk9Y7moEgucFCxbrx7wkodKAQJj/IODdXYYPhbDIs+Ch1rc0dNnc+dNOboCcJV5cAB 69j4otBqOi1RCdZ8uBj0I8ssO5TkhNqso7KsW5CuiOicQH63OqujtEHlsfH97bENugSW vnaA== X-Gm-Message-State: AIkVDXK9VGltE8DTAhJRPAJxgh9dsZQrNd6rPmoEo678sSEbwxnPadRUBqsZrB3/IxM0a6S0P3k= X-Received: by 10.98.157.199 with SMTP id a68mr18654238pfk.129.1482914686324; Wed, 28 Dec 2016 00:44:46 -0800 (PST) Received: from localhost.localdomain ([119.145.15.121]) by smtp.gmail.com with ESMTPSA id k22sm37632100pfg.84.2016.12.28.00.44.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Dec 2016 00:44:45 -0800 (PST) From: Chenhui Sun X-Google-Original-From: Chenhui Sun To: linaro-uefi@lists.linaro.org Date: Wed, 28 Dec 2016 16:42:49 +0800 Message-Id: <1482914571-40416-1-git-send-email-sunchenhui@huawei.com> X-Mailer: git-send-email 1.9.1 Cc: Daode Huang , sunchenhui@huawei.com, wanghuiqiang@huawei.com Subject: [Linaro-uefi] [linaro-uefi v1 1/2] Hisilicon/D05: add cpld to get sfp status X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" From: Heyi Guo This patch is for https://bugs.linaro.org/show_bug.cgi?id=2711. When there is no optical module plugged in XGE port, the interfaces (ethX) will show up/down information on console, such as below: [root@localhost ~]# [ 676.034368] hns-nic HISI00C2:03 eth3: link up [ 676.038840] IPv6: ADDRCONF(NETDEV_CHANGE): eth3: link becomes ready [ 677.058362] hns-nic HISI00C2:03 eth3: link down [ 692.418366] hns-nic HISI00C2:03 eth3: link up [ 693.442359] hns-nic HISI00C2:03 eth3: link down [ 748.738365] hns-nic HISI00C2:03 eth3: link up [ 749.762363] hns-nic HISI00C2:03 eth3: link down This patch adds a logic to check whether the optical module is absent or not, if absent, means the interface is down, otherwise check the mac link status. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daode Huang Reviewed-by: Graeme Gregory --- .../Hisilicon/Hi1616/D05AcpiTables/Dsdt/D05Hns.asl | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Chips/Hisilicon/Hi1616/D05AcpiTables/Dsdt/D05Hns.asl b/Chips/Hisilicon/Hi1616/D05AcpiTables/Dsdt/D05Hns.asl index 14a905d..11c28ba 100644 --- a/Chips/Hisilicon/Hi1616/D05AcpiTables/Dsdt/D05Hns.asl +++ b/Chips/Hisilicon/Hi1616/D05AcpiTables/Dsdt/D05Hns.asl @@ -174,6 +174,15 @@ Scope(_SB) H3L3, 16, // port5 , 16, //RESERVED } + OperationRegion(HSFP, SystemMemory, 0x78000010, 0x100) + Field(HSFP, ByteAcc, NoLock, Preserve) { + Offset (0x2), + HSF0, 1, // port0 + , 7, //RESERVED + Offset (0x6), + HSF1, 1, // port1 + , 7, //RESERVED + } Name (_HID, "HISI00B2") Name (_CCA, 1) // Cache-coherent controller Name (_CRS, ResourceTemplate (){ @@ -520,7 +529,21 @@ Scope(_SB) //Get sfp status case (0x5) { + Store (1, Local1) //set no sfp default + Store (DeRefOf (Index (Arg3, 0)), Local0) + If (LEqual (Local0, 0)) + { + // port 0: + Store (HSF0, Local1) + } + ElseIf (LEqual (Local0, 1)) + { + // port 1 + Store (HSF1, Local1) + } + XOr (Local1, 1, local1) + Return (Local1) } } }