diff mbox

[Linaro-uefi,linaro-uefi,v1,1/2] Hisilicon/D05: add cpld to get sfp status

Message ID 1482914571-40416-1-git-send-email-sunchenhui@huawei.com
State New
Headers show

Commit Message

gary guo Dec. 28, 2016, 8:42 a.m. UTC
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(+)

Comments

Graeme Gregory Jan. 5, 2017, 10:20 a.m. UTC | #1
On Wed, Dec 28, 2016 at 04:42:49PM +0800, Chenhui Sun wrote:
> 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>


This looks fine to me

Reviewed-by: Graeme Gregory <graeme.gregory@linaro.org>



> ---

>  .../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)

>              }

>            }

>          }

> -- 

> 1.9.1

>
gary guo Jan. 9, 2017, 6:52 a.m. UTC | #2
Hi Leif,

Could you help to review this path? if it is ok please help to push it. 
Thanks.

The commit also could be found in 
http://git.linaro.org/uefi/OpenPlatformPkg.git (rp-16.12-04-all)

Thanks and Regards,
Heyi.

在 2017/1/5 18:20, graeme.gregory@linaro.org 写道:
> On Wed, Dec 28, 2016 at 04:42:49PM +0800, Chenhui Sun wrote:
>> 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>
> This looks fine to me
>
> Reviewed-by: Graeme Gregory <graeme.gregory@linaro.org>
>
>
>> ---
>>   .../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)
>>               }
>>             }
>>           }
>> -- 
>> 1.9.1
>>
Leif Lindholm Jan. 9, 2017, 7:17 p.m. UTC | #3
Hi Heyi,

I've pushed 1-4 of the top 5 patches from your branch.

Regards,

Leif


On Mon, Jan 09, 2017 at 02:52:39PM +0800, Heyi Guo wrote:
> Hi Leif,
> 
> Could you help to review this path? if it is ok please help to push it.
> Thanks.
> 
> The commit also could be found in
> http://git.linaro.org/uefi/OpenPlatformPkg.git (rp-16.12-04-all)
> 
> Thanks and Regards,
> Heyi.
> 
> 在 2017/1/5 18:20, graeme.gregory@linaro.org 写道:
> >On Wed, Dec 28, 2016 at 04:42:49PM +0800, Chenhui Sun wrote:
> >>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>
> >This looks fine to me
> >
> >Reviewed-by: Graeme Gregory <graeme.gregory@linaro.org>
> >
> >
> >>---
> >>  .../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)
> >>              }
> >>            }
> >>          }
> >>-- 
> >>1.9.1
> >>
>
gary guo Jan. 10, 2017, 1:50 a.m. UTC | #4
Hi Leif,

Got it, Thanks:)

Regards,

Heyi

在 2017/1/10 3:17, Leif Lindholm 写道:
> Hi Heyi,
>
> I've pushed 1-4 of the top 5 patches from your branch.
>
> Regards,
>
> Leif
>
>
> On Mon, Jan 09, 2017 at 02:52:39PM +0800, Heyi Guo wrote:
>> Hi Leif,
>>
>> Could you help to review this path? if it is ok please help to push it.
>> Thanks.
>>
>> The commit also could be found in
>> http://git.linaro.org/uefi/OpenPlatformPkg.git (rp-16.12-04-all)
>>
>> Thanks and Regards,
>> Heyi.
>>
>> 在 2017/1/5 18:20, graeme.gregory@linaro.org 写道:
>>> On Wed, Dec 28, 2016 at 04:42:49PM +0800, Chenhui Sun wrote:
>>>> 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>
>>> This looks fine to me
>>>
>>> Reviewed-by: Graeme Gregory <graeme.gregory@linaro.org>
>>>
>>>
>>>> ---
>>>>   .../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)
>>>>               }
>>>>             }
>>>>           }
>>>> -- 
>>>> 1.9.1
>>>>
diff mbox

Patch

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)
             }
           }
         }