From: Heyi Guo heyi.guo@linaro.org
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 huangdaode@hisilicon.com --- .../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) } } }