Home | History | Annotate | Download | only in Dsdt
      1 /** @file
      2   Differentiated System Description Table Fields (DSDT)
      3 
      4   Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>
      5     This program and the accompanying materials
      6   are licensed and made available under the terms and conditions of the BSD License
      7   which accompanies this distribution.  The full text of the license may be found at
      8   http://opensource.org/licenses/bsd-license.php
      9 
     10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     12 
     13 **/
     14 
     15 Scope(_SB)
     16 {
     17   Device (MDIO)
     18   {
     19       OperationRegion(CLKR, SystemMemory, 0x80000338, 8)
     20     Field(CLKR, DWordAcc, NoLock, Preserve) {
     21       CLKE, 1,  // clock enable
     22       , 31,
     23       CLKD, 1,  // clode disable
     24       , 31,
     25     }
     26       OperationRegion(RSTR, SystemMemory, 0x80000A38, 8)
     27     Field(RSTR, DWordAcc, NoLock, Preserve) {
     28       RSTE, 1,  // reset
     29       , 31,
     30       RSTD, 1,  // de-reset
     31       , 31,
     32     }
     33 
     34     Name(_HID, "HISI0141")
     35     Name (_CRS, ResourceTemplate (){
     36       Memory32Fixed (ReadWrite, 0x803c0000 , 0x10000)
     37             })
     38 
     39     Method(_RST, 0, Serialized) {
     40       Store (0x1, RSTE)
     41       Sleep (10)
     42       Store (0x1, CLKD)
     43       Sleep (10)
     44       Store (0x1, RSTD)
     45       Sleep (10)
     46       Store (0x1, CLKE)
     47       Sleep (10)
     48     }
     49   }
     50 
     51   Device (DSF0)
     52   {
     53     OperationRegion(H3SR, SystemMemory, 0xC0000180, 4)
     54     Field(H3SR, DWordAcc, NoLock, Preserve) {
     55           H3ST, 1,
     56           , 31,  //RESERVED
     57         }
     58     OperationRegion(H4SR, SystemMemory, 0xC0000190, 4)
     59     Field(H4SR, DWordAcc, NoLock, Preserve) {
     60           H4ST, 1,
     61           , 31,  //RESERVED
     62         }
     63     // DSAF RESET
     64     OperationRegion(DRER, SystemMemory, 0xC0000A00, 8)
     65     Field(DRER, DWordAcc, NoLock, Preserve) {
     66           DRTE, 1,
     67           , 31,  //RESERVED
     68           DRTD, 1,
     69           , 31,  //RESERVED
     70         }
     71     // NT RESET
     72     OperationRegion(NRER, SystemMemory, 0xC0000A08, 8)
     73     Field(NRER, DWordAcc, NoLock, Preserve) {
     74           NRTE, 1,
     75           , 31,  //RESERVED
     76           NRTD, 1,
     77           , 31,  //RESERVED
     78         }
     79     // XGE RESET
     80     OperationRegion(XRER, SystemMemory, 0xC0000A10, 8)
     81     Field(XRER, DWordAcc, NoLock, Preserve) {
     82           XRTE, 31,
     83           , 1,    //RESERVED
     84           XRTD, 31,
     85           , 1,    //RESERVED
     86         }
     87 
     88     // GE RESET
     89     OperationRegion(GRTR, SystemMemory, 0xC0000A18, 16)
     90     Field(GRTR, DWordAcc, NoLock, Preserve) {
     91           GR0E, 30,
     92           , 2,    //RESERVED
     93           GR0D, 30,
     94           , 2,    //RESERVED
     95           GR1E, 18,
     96           , 14,  //RESERVED
     97           GR1D, 18,
     98           , 14,  //RESERVED
     99         }
    100     // PPE RESET
    101     OperationRegion(PRTR, SystemMemory, 0xC0000A48, 8)
    102     Field(PRTR, DWordAcc, NoLock, Preserve) {
    103           PRTE, 10,
    104           , 22,  //RESERVED
    105           PRTD, 10,
    106           , 22,  //RESERVED
    107         }
    108 
    109     // RCB PPE COM RESET
    110     OperationRegion(RRTR, SystemMemory, 0xC0000A88, 8)
    111     Field(RRTR, DWordAcc, NoLock, Preserve) {
    112           RRTE, 1,
    113           , 31,  //RESERVED
    114           RRTD, 1,
    115           , 31,  //RESERVED
    116         }
    117 
    118     // ROCE
    119 
    120     // CPLD LED
    121 
    122     // Serdes
    123     OperationRegion(H4LR, SystemMemory, 0xC2288100, 0x1000)
    124     Field(H4LR, DWordAcc, NoLock, Preserve) {
    125           H4L0, 16,    // port0
    126           H4R0, 16,    //RESERVED
    127           Offset (0x400),
    128           H4L1, 16,    // port1
    129           H4R1, 16,    //RESERVED
    130           Offset (0x800),
    131           H4L2, 16,    // port2
    132           H4R2, 16,    //RESERVED
    133           Offset (0xc00),
    134           H4L3, 16,    // port3
    135           H4R3, 16,    //RESERVED
    136         }
    137     OperationRegion(H3LR, SystemMemory, 0xC2208900, 0x800)
    138     Field(H3LR, DWordAcc, NoLock, Preserve) {
    139           H3L2, 16,    // port4
    140           , 16,    //RESERVED
    141           Offset (0x400),
    142           H3L3, 16,    // port5
    143           , 16,    //RESERVED
    144         }
    145     Name (_HID, "HISI00B1")
    146     Name (_CCA, 1) // Cache-coherent controller
    147     Name (_CRS, ResourceTemplate (){
    148       Memory32Fixed (ReadWrite, 0xc5000000 , 0x890000)
    149                         Memory32Fixed (ReadWrite, 0xc7000000 , 0x60000)
    150       Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive,,,)
    151         {
    152           149,150,151,152,153,154,26,27,155,156,157,158,159,160,  //[14] ge fifo err 8 / xge 6
    153           6,7,8,9,16,17,18,19,22,23,24,25,      //[12] rcb com 4*3
    154           0,1,2,3,4,5,12,13,          //[8] ppe tnl 0-7
    155           128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,  //[21] dsaf event int 3+18
    156           161,162,163,164,
    157         }
    158       Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive,,,)
    159         {
    160           384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399,  //[256] sevice rcb 2*128
    161           400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415,
    162           416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431,
    163           432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447,
    164           448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463,
    165           464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479,
    166           480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495,
    167           496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511,
    168           512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527,
    169           528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543,
    170           544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559,
    171           560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575,
    172         }
    173                 })
    174                 Name (_DSD, Package () {
    175                         ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
    176       Package () {
    177                                 Package () {"mode", "6port-16rss"},
    178                                 Package () {"buf-size", 4096},
    179                                 Package () {"desc-num", 1024},
    180         Package () {"interrupt-parent", Package() {\_SB.MBI1}},
    181                         }
    182                 })
    183 
    184     //reset XGE port
    185     //Arg0 : XGE port index in dsaf
    186     //Arg1 : 0 reset, 1 cancle reset
    187     Method(XRST, 2, Serialized) {
    188       ShiftLeft (0x2082082, Arg0, Local0)
    189       Or (Local0, 0x1, Local0)
    190 
    191       If (LEqual (Arg1, 0)) {
    192         Store(Local0, XRTE)
    193       } Else  {
    194         Store(Local0, XRTD)
    195       }
    196     }
    197 
    198     //reset XGE core
    199     //Arg0 : XGE port index in dsaf
    200     //Arg1 : 0 reset, 1 cancle reset
    201     Method(XCRT, 2, Serialized) {
    202       ShiftLeft (0x2080, Arg0, Local0)
    203 
    204       If (LEqual (Arg1, 0)) {
    205         Store(Local0, XRTE)
    206       } Else  {
    207         Store(Local0, XRTD)
    208       }
    209     }
    210 
    211     //reset GE port
    212     //Arg0 : GE port index in dsaf
    213     //Arg1 : 0 reset, 1 cancle reset
    214     Method(GRST, 2, Serialized) {
    215       If (LLessEqual (Arg0, 5)) {
    216         //Service port
    217         ShiftLeft (0x1041041, Arg0, Local0)
    218         ShiftLeft (0x1, Arg0, Local1)
    219 
    220         If (LEqual (Arg1, 0)) {
    221           Store(Local1, GR1E)
    222           Store(Local0, GR0E)
    223         } Else  {
    224           Store(Local0, GR0D)
    225           Store(Local1, GR1D)
    226         }
    227       }
    228     }
    229 
    230     //reset PPE port
    231     //Arg0 : PPE port index in dsaf
    232     //Arg1 : 0 reset, 1 cancle reset
    233     Method(PRST, 2, Serialized) {
    234       ShiftLeft (0x1, Arg0, Local0)
    235       If (LEqual (Arg1, 0)) {
    236         Store(Local0, PRTE)
    237       } Else  {
    238         Store(Local0, PRTD)
    239       }
    240     }
    241 
    242     // Set Serdes Loopback
    243     //Arg0 : port
    244     //Arg1 : 0 disable, 1 enable
    245     Method(SRLP, 2, Serialized) {
    246       ShiftLeft (Arg1, 10, Local0)
    247       Switch (ToInteger(Arg0))
    248       {
    249         case (0x0){
    250           Store (H4L0, Local1)
    251           And (Local1, 0xfffffbff, Local1)
    252           Or (Local0, Local1, Local0)
    253           Store (Local0, H4L0)
    254         }
    255         case (0x1){
    256           Store (H4L1, Local1)
    257           And (Local1, 0xfffffbff, Local1)
    258           Or (Local0, Local1, Local0)
    259           Store (Local0, H4L1)
    260         }
    261         case (0x2){
    262           Store (H4L2, Local1)
    263           And (Local1, 0xfffffbff, Local1)
    264           Or (Local0, Local1, Local0)
    265           Store (Local0, H4L2)
    266         }
    267         case (0x3){
    268           Store (H4L3, Local1)
    269           And (Local1, 0xfffffbff, Local1)
    270           Or (Local0, Local1, Local0)
    271           Store (Local0, H4L3)
    272         }
    273         case (0x4){
    274           Store (H3L2, Local1)
    275           And (Local1, 0xfffffbff, Local1)
    276           Or (Local0, Local1, Local0)
    277           Store (Local0, H3L2)
    278         }
    279         case (0x5){
    280           Store (H3L3, Local1)
    281           And (Local1, 0xfffffbff, Local1)
    282           Or (Local0, Local1, Local0)
    283           Store (Local0, H3L3)
    284         }
    285       }
    286     }
    287 
    288     //Reset
    289     //Arg0 : reset type (1: dsaf; 2: ppe; 3:XGE core; 4:XGE; 5:G3)
    290     //Arg1 : port
    291     //Arg2 : 0 disable, 1 enable
    292     Method(DRST, 3, Serialized)
    293     {
    294       Switch (ToInteger(Arg0))
    295       {
    296         //DSAF reset
    297         case (0x1)
    298         {
    299           Store (Arg2, Local0)
    300           If (LEqual (Local0, 0))
    301           {
    302             Store (0x1, DRTE)
    303             Store (0x1, NRTE)
    304             Sleep (10)
    305             Store (0x1, RRTE)
    306           }
    307           Else
    308           {
    309             Store (0x1, DRTD)
    310             Store (0x1, NRTD)
    311             Sleep (10)
    312             Store (0x1, RRTD)
    313           }
    314         }
    315         //Reset PPE port
    316         case (0x2)
    317         {
    318           Store (Arg1, Local0)
    319           Store (Arg2, Local1)
    320           PRST (Local0, Local1)
    321         }
    322 
    323         //Reset XGE core
    324         case (0x3)
    325         {
    326           Store (Arg1, Local0)
    327           Store (Arg2, Local1)
    328           XCRT (Local0, Local1)
    329         }
    330         //Reset XGE port
    331         case (0x4)
    332         {
    333           Store (Arg1, Local0)
    334           Store (Arg2, Local1)
    335           XRST (Local0, Local1)
    336         }
    337 
    338         //Reset GE port
    339         case (0x5)
    340         {
    341           Store (Arg1, Local0)
    342           Store (Arg2, Local1)
    343           GRST (Local0, Local1)
    344         }
    345       }
    346     }
    347 
    348     // _DSM Device Specific Method
    349     //
    350     // Arg0: UUID Unique function identifier
    351     // Arg1: Integer Revision Level
    352     // Arg2: Integer Function Index
    353     //   0 : Return Supported Functions bit mask
    354     //   1 : Reset Sequence
    355     //    Arg3[0] : reset type (1:dsaf; 2:ppe; 3:xge core; 4:xge; 5: ge)
    356     //    Arg3[1] : port index in dsaf
    357     //    Arg3[2] : 0 reset, 1 cancle reset
    358     //   2 : Set Serdes Loopback
    359     //    Arg3[0] : port
    360     //    Arg3[1] : 0 disable, 1 enable
    361     //   3 : LED op set
    362     //    Arg3[0] : op type
    363     //    Arg3[1] : port
    364     //    Arg3[2] : para
    365     //   4 : Get port type (GE or XGE)
    366     //    Arg3[0] : port index in dsaf
    367     //    Return : 0 GE, 1 XGE
    368     //   5 : Get sfp status
    369     //    Arg3[0] : port index in dsaf
    370     //    Return : 0 no sfp, 1 have sfp
    371     // Arg3: Package Parameters
    372     Method (_DSM, 4, Serialized)
    373     {
    374       If (LEqual(Arg0,ToUUID("1A85AA1A-E293-415E-8E28-8D690A0F820A")))
    375       {
    376         If (LEqual (Arg1, 0x00))
    377         {
    378           Switch (ToInteger(Arg2))
    379           {
    380             case (0x0)
    381             {
    382               Return (Buffer () {0x3F})
    383             }
    384 
    385             //Reset Sequence
    386             case (0x1)
    387             {
    388               Store (DeRefOf (Index (Arg3, 0)), Local0)
    389               Store (DeRefOf (Index (Arg3, 1)), Local1)
    390               Store (DeRefOf (Index (Arg3, 2)), Local2)
    391               DRST (Local0, Local1, Local2)
    392             }
    393 
    394             //Set Serdes Loopback
    395             case (0x2)
    396             {
    397               Store (DeRefOf (Index (Arg3, 0)), Local0)
    398               Store (DeRefOf (Index (Arg3, 1)), Local1)
    399               SRLP (Local0, Local1)
    400             }
    401 
    402             //LED op set
    403             case (0x3)
    404             {
    405 
    406             }
    407 
    408             // Get port type (GE or XGE)
    409             case (0x4)
    410             {
    411               Store (0, Local1)
    412               Store (DeRefOf (Index (Arg3, 0)), Local0)
    413               If (LLessEqual (Local0, 3))
    414               {
    415                 Store (H4ST, Local1)
    416               }
    417               ElseIf (LLessEqual (Local0, 5))
    418               {
    419                 Store (H3ST, Local1)
    420               }
    421 
    422               Return (Local1)
    423             }
    424 
    425             //Get sfp status
    426             case (0x5)
    427             {
    428 
    429             }
    430           }
    431         }
    432       }
    433       Return (Buffer() {0x00})
    434     }
    435     Device (PRT0)
    436     {
    437       Name (_ADR, 0x0)
    438       Name (_DSD, Package () {
    439                         ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
    440         Package () {
    441           Package () {"reg", 0},
    442           Package () {"media-type", "fiber"},
    443                         }
    444                 })
    445     }
    446     Device (PRT1)
    447     {
    448       Name (_ADR, 0x1)
    449       Name (_DSD, Package () {
    450                         ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
    451         Package () {
    452           Package () {"reg", 1},
    453           Package () {"media-type", "fiber"},
    454                         }
    455                 })
    456     }
    457     Device (PRT4)
    458     {
    459       Name (_ADR, 0x4)
    460       Name (_DSD, Package () {
    461                         ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
    462         Package () {
    463           Package () {"reg", 4},
    464           Package () {"phy-mode", "sgmii"},
    465           Package () {"phy-addr", 0},
    466           Package () {"mdio-node", Package (){\_SB.MDIO}},
    467           Package () {"media-type", "copper"},
    468                         }
    469                 })
    470     }
    471     Device (PRT5)
    472     {
    473       Name (_ADR, 0x5)
    474       Name (_DSD, Package () {
    475                         ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
    476         Package () {
    477           Package () {"reg", 5},
    478           Package () {"phy-mode", "sgmii"},
    479           Package () {"phy-addr", 1},
    480           Package () {"mdio-node", Package (){\_SB.MDIO}},
    481           Package () {"media-type", "copper"},
    482                         }
    483                 })
    484     }
    485   }
    486 /*
    487   Device (DSF1)
    488   {
    489     OperationRegion(H3SR, SystemMemory, 0xC0000180, 4)
    490     Field(H3SR, DWordAcc, NoLock, Preserve) {
    491           H3ST, 1,
    492           , 31,  //RESERVED
    493         }
    494 
    495     // XGE RESET
    496     OperationRegion(XRER, SystemMemory, 0xC0000A10, 8)
    497     Field(XRER, DWordAcc, NoLock, Preserve) {
    498           XRTE, 31,
    499           , 1,    //RESERVED
    500           XRTD, 31,
    501           , 1,    //RESERVED
    502         }
    503 
    504     // GE RESET
    505     OperationRegion(GRTR, SystemMemory, 0xC0000A18, 16)
    506     Field(GRTR, DWordAcc, NoLock, Preserve) {
    507           GR0E, 30,
    508           , 2,    //RESERVED
    509           GR0D, 30,
    510           , 2,    //RESERVED
    511           GR1E, 18,
    512           , 14,  //RESERVED
    513           GR1D, 18,
    514           , 14,  //RESERVED
    515         }
    516 
    517     // PPE RESET
    518     OperationRegion(PRTR, SystemMemory, 0xC0000A48, 8)
    519     Field(PRTR, DWordAcc, NoLock, Preserve) {
    520           PRTE, 10,
    521           , 22,  //RESERVED
    522           PRTD, 10,
    523           , 22,  //RESERVED
    524         }
    525 
    526     // ROCE
    527 
    528     // CPLD LED
    529 
    530     // Serdes
    531     OperationRegion(H3LR, SystemMemory, 0xC2208100, 0x4)
    532     Field(H3LR, DWordAcc, NoLock, Preserve) {
    533           H3L0, 16,    // debug port0
    534           , 16,    //RESERVED
    535         }
    536                 Name(_HID, "HISI00B1")
    537                 Name (_CCA, 1) // Cache-coherent controller
    538                 Name (_CRS, ResourceTemplate (){
    539                         Memory32Fixed (ReadWrite, 0xc2000000 , 0x890000)
    540 
    541                 Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive,,,)
    542         {
    543           14, 15,
    544         }
    545                 })
    546                 Name (_DSD, Package () {
    547                         ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
    548         Package () {
    549                                 Package () {"mode", "single-port"},
    550                                 Package () {"buf-size", 4096},
    551                                 Package () {"desc-num", 1024},
    552         Package () {"interrupt-parent", Package() {\_SB.MBI1}},
    553                         }
    554                 })
    555 
    556       // Set Serdes Loopback
    557     //Arg0 : port
    558     //Arg1 : 0 disable, 1 enable
    559     Method(SRLP, 1, Serialized) {
    560       ShiftLeft (Arg0, 10, Local0)
    561       Store (H3L0, Local1)
    562       And (Local1, 0xfffffbff, Local1)
    563       Or (Local0, Local1, Local0)
    564       Store (Local1, H3L0)
    565     }
    566 
    567     //Reset
    568     //Arg0 : reset type (1: dsaf; 2: ppe; 3:reserved; 4:reserved; 5:G3)
    569     //Arg1 : 0 disable, 1 enable
    570     Method(DRST, 2, Serialized)
    571     {
    572       Switch (ToInteger(Arg0))
    573       {
    574         //DSAF reset
    575         case (0x1)
    576         {
    577           If (LEqual (Arg1, 0)) {
    578             Store (0x100, PRTE)
    579           } Else {
    580             Store (0x100, PRTD)
    581           }
    582         }
    583         //Reset PPE port
    584         case (0x2)
    585         {
    586           If (LEqual (Arg1, 0)) {
    587             Store(0x40, PRTE)
    588           } Else  {
    589             Store(0x40, PRTD)
    590           }
    591         }
    592 
    593         //Reset GE port
    594         case (0x5)
    595         {
    596           If (LEqual (Arg1, 0)) {
    597             Store(0x15540, GR1E)
    598             Store(0x100, PRTE)
    599           } Else {
    600             Store(0x15540, GR1D)
    601             Store(0x100, PRTD)
    602           }
    603         }
    604       }
    605     }
    606     // _DSM Device Specific Method
    607     //
    608     // Arg0: UUID Unique function identifier
    609     // Arg1: Integer Revision Level
    610     // Arg2: Integer Function Index
    611     //   0 : Return Supported Functions bit mask
    612     //   1 : Reset Sequence
    613     //    Arg3[0] : reset type (1:dsaf; 2:ppe; 3:reserved; 4:reserved; 5: ge)
    614     //    Arg3[1] : reserved
    615     //    Arg3[2] : 0 reset, 1 cancle reset
    616     //   2 : Set Serdes Loopback
    617     //    Arg3[0] : reserved
    618     //    Arg3[1] : 0 disable, 1 enable
    619     //   3 : LED op set
    620     //    Arg3[0] : op type
    621     //    Arg3[1] : reserved
    622     //    Arg3[2] : para
    623     //   4 : Get port type (GE or XGE)
    624     //    Arg3[0] : reserved
    625     //    Return : 0 GE, 1 XGE
    626     //   5 : Get sfp status
    627     //    Arg3[0] : reserved
    628     //    Return : 0 no sfp, 1 have sfp
    629     // Arg3: Package Parameters
    630     Method (_DSM, 4, Serialized)
    631     {
    632       If (LEqual(Arg0,ToUUID("1A85AA1A-E293-415E-8E28-8D690A0F820A")))
    633       {
    634         If (LEqual (Arg1, 0x00))
    635         {
    636           Switch (ToInteger(Arg2))
    637           {
    638             case (0x0)
    639             {
    640               Return (Buffer () {0x3F})
    641             }
    642 
    643             //Reset Sequence
    644             case (0x1)
    645             {
    646               Store (DeRefOf (Index (Arg3, 0)), Local0)
    647               Store (DeRefOf (Index (Arg3, 2)), Local2)
    648               DRST (Local0, Local2)
    649             }
    650 
    651             //Set Serdes Loopback
    652             case (0x2)
    653             {
    654               Store (DeRefOf (Index (Arg3, 2)), Local0)
    655               SRLP (Local0)
    656             }
    657 
    658             //LED op set
    659             case (0x3)
    660             {
    661 
    662             }
    663 
    664             // Get port type (GE or XGE)
    665             case (0x4)
    666             {
    667               Store (H3ST, Local0)
    668               Return (Local0)
    669             }
    670 
    671             //Get sfp status
    672             case (0x5)
    673             {
    674 
    675             }
    676           }
    677         }
    678       }
    679       Return (Buffer() {0x00})
    680     }
    681 
    682     Device (PRT0)
    683     {
    684       Name (_ADR, 0x0)
    685       Name (_DSD, Package () {
    686                         ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
    687         Package () {
    688           Package () {"reg", 0},
    689           Package () {"phy-mode", "sgmii"},
    690           Package () {"phy-addr", 0},
    691           Package () {"mdio-node", Package (){\_SB.MDIO}},
    692                         }
    693                 })
    694     }
    695   }
    696   Device (DSF2)
    697   {
    698     OperationRegion(H3SR, SystemMemory, 0xC0000180, 4)
    699     Field(H3SR, DWordAcc, NoLock, Preserve) {
    700           H3ST, 1,
    701           , 31,  //RESERVED
    702         }
    703 
    704     // XGE RESET
    705     OperationRegion(XRER, SystemMemory, 0xC0000A10, 8)
    706     Field(XRER, DWordAcc, NoLock, Preserve) {
    707           XRTE, 31,
    708           , 1,    //RESERVED
    709           XRTD, 31,
    710           , 1,    //RESERVED
    711         }
    712 
    713     // GE RESET
    714     OperationRegion(GRTR, SystemMemory, 0xC0000A18, 16)
    715     Field(GRTR, DWordAcc, NoLock, Preserve) {
    716           GR0E, 30,
    717           , 2,    //RESERVED
    718           GR0D, 30,
    719           , 2,    //RESERVED
    720           GR1E, 18,
    721           , 14,  //RESERVED
    722           GR1D, 18,
    723           , 14,  //RESERVED
    724         }
    725 
    726     // PPE RESET
    727     OperationRegion(PRTR, SystemMemory, 0xC0000A48, 8)
    728     Field(PRTR, DWordAcc, NoLock, Preserve) {
    729           PRTE, 10,
    730           , 22,  //RESERVED
    731           PRTD, 10,
    732           , 22,  //RESERVED
    733         }
    734 
    735     // ROCE
    736 
    737     // CPLD LED
    738 
    739     // Serdes
    740     OperationRegion(H3LR, SystemMemory, 0xC2208500, 0x4)
    741     Field(H3LR, DWordAcc, NoLock, Preserve) {
    742           H3L1, 16,    // debug port1
    743           , 16,    //RESERVED
    744         }
    745                 Name(_HID, "HISI00B1")
    746                 Name (_CCA, 1) // Cache-coherent controller
    747                 Name (_CRS, ResourceTemplate (){
    748                         Memory32Fixed (ReadWrite, 0xc2100000 , 0x890000)
    749 
    750                 Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive,,,)
    751         {
    752           20, 21,
    753         }
    754                 })
    755                 Name (_DSD, Package () {
    756                         ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
    757         Package () {
    758                                 Package () {"mode", "single-port"},
    759                                 Package () {"buf-size", 4096},
    760                                 Package () {"desc-num", 1024},
    761         Package () {"interrupt-parent", Package() {\_SB.MBI1}},
    762                         }
    763                 })
    764 
    765       // Set Serdes Loopback
    766     //Arg0 : port
    767     //Arg1 : 0 disable, 1 enable
    768     Method(SRLP, 1, Serialized) {
    769       ShiftLeft (Arg0, 10, Local0)
    770       Store (H3L1, Local1)
    771       And (Local1, 0xfffffbff, Local1)
    772       Or (Local0, Local1, Local0)
    773       Store (Local1, H3L1)
    774     }
    775 
    776     //Reset
    777     //Arg0 : reset type (1: dsaf; 2: ppe; 3:reserved; 4:reserved; 5:G3)
    778     //Arg1 : 0 disable, 1 enable
    779     Method(DRST, 2, Serialized)
    780     {
    781       Switch (ToInteger(Arg0))
    782       {
    783         //DSAF reset
    784         case (0x1)
    785         {
    786           If (LEqual (Arg1, 0)) {
    787             Store (0x200, PRTE)
    788           } Else {
    789             Store (0x2200, PRTD)
    790           }
    791         }
    792 
    793         //Reset PPE port
    794         case (0x2)
    795         {
    796           If (LEqual (Arg1, 0)) {
    797             Store(0x80, PRTE)
    798           } Else  {
    799             Store(0x80, PRTD)
    800           }
    801         }
    802 
    803         //Reset GE port
    804         case (0x5)
    805         {
    806           If (LEqual (Arg1, 0)) {
    807             Store(0x2aa80, GR1E)
    808             Store(0x200, PRTE)
    809           } Else {
    810             Store(0x2aa80, GR1D)
    811             Store(0x200, PRTD)
    812           }
    813         }
    814       }
    815     }
    816     // _DSM Device Specific Method
    817     //
    818     // Arg0: UUID Unique function identifier
    819     // Arg1: Integer Revision Level
    820     // Arg2: Integer Function Index
    821     //   0 : Return Supported Functions bit mask
    822     //   1 : Reset sequence
    823     //    Arg3[0] : reset type (1:dsaf; 2:ppe; 3:reserved; 4:reserved; 5: ge)
    824     //    Arg3[1] : reserved
    825     //    Arg3[2] : 0 reset, 1 cancle reset
    826     //   2 : Set Serdes Loopback
    827     //    Arg3[0] : reserved
    828     //    Arg3[1] : 0 disable, 1 enable
    829     //   3 : LED op set
    830     //    Arg3[0] : op type
    831     //    Arg3[1] : reserved
    832     //    Arg3[2] : para
    833     //   4 : Get port type (GE or XGE)
    834     //    Arg3[0] : reserved
    835     //    Return : 0 GE, 1 XGE
    836     //   5 : Get sfp status
    837     //    Arg3[0] : reserved
    838     //    Return : 0 no sfp, 1 have sfp
    839     // Arg3: Package Parameters
    840     Method (_DSM, 4, Serialized)
    841     {
    842       If (LEqual(Arg0,ToUUID("1A85AA1A-E293-415E-8E28-8D690A0F820A")))
    843       {
    844         If (LEqual (Arg1, 0x00))
    845         {
    846           Switch (ToInteger(Arg2))
    847           {
    848             case (0x0)
    849             {
    850               Return (Buffer () {0x3F})
    851             }
    852 
    853             //Reset Sequence
    854             case (0x1)
    855             {
    856               Store (DeRefOf (Index (Arg3, 0)), Local0)
    857               Store (DeRefOf (Index (Arg3, 2)), Local2)
    858               DRST (Local0, Local2)
    859             }
    860 
    861             //Set Serdes Loopback
    862             case (0x2)
    863             {
    864               Store (DeRefOf (Index (Arg3, 2)), Local0)
    865               SRLP (Local0)
    866             }
    867 
    868             //LED op set
    869             case (0x3)
    870             {
    871 
    872             }
    873 
    874             // Get port type (GE or XGE)
    875             case (0x4)
    876             {
    877               Store (H3ST, Local0)
    878               Return (Local0)
    879             }
    880 
    881             //Get sfp status
    882             case (0x5)
    883             {
    884 
    885             }
    886           }
    887         }
    888       }
    889       Return (Buffer() {0x00})
    890     }
    891 
    892     Device (PRT0)
    893     {
    894       Name (_ADR, 0x0)
    895       Name (_DSD, Package () {
    896                         ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
    897         Package () {
    898           Package () {"reg", 0},
    899           Package () {"phy-mode", "sgmii"},
    900           Package () {"phy-addr", 1},
    901           Package () {"mdio-node", Package (){\_SB.MDIO}},
    902                         }
    903                 })
    904     }
    905   }
    906 */
    907   Device (ETH5) {
    908     Name(_HID, "HISI00C1")
    909     Name (_CCA, 1) // Cache-coherent controller
    910     Name (_DSD, Package () {
    911       ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
    912       Package () {
    913         Package () {"local-mac-address", Package () { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }}, // 6-bytes
    914         Package () {"ae-handle", Package (){\_SB.DSF0}},
    915         Package () {"port-idx-in-ae", 5},
    916       }
    917     })
    918   }
    919   Device (ETH4) {
    920     Name(_HID, "HISI00C1")
    921     Name (_CCA, 1) // Cache-coherent controller
    922     Name (_DSD, Package () {
    923       ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
    924       Package () {
    925         Package () {"local-mac-address", Package () { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }}, // 6-bytes
    926         Package () {"ae-handle", Package (){\_SB.DSF0}},
    927         Package () {"port-idx-in-ae", 4},
    928       }
    929     })
    930   }
    931   Device (ETH0) {
    932     Name(_HID, "HISI00C1")
    933     Name (_CCA, 1) // Cache-coherent controller
    934     Name (_DSD, Package () {
    935       ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
    936       Package () {
    937         Package () {"local-mac-address", Package () { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }}, // 6-bytes
    938         Package () {"ae-handle", Package (){\_SB.DSF0}},
    939         Package () {"port-idx-in-ae", 0},
    940       }
    941     })
    942   }
    943   Device (ETH1) {
    944     Name(_HID, "HISI00C1")
    945     Name (_CCA, 1) // Cache-coherent controller
    946     Name (_DSD, Package () {
    947       ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
    948       Package () {
    949         Package () {"local-mac-address", Package () { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }}, // 6-bytes
    950         Package () {"ae-handle", Package (){\_SB.DSF0}},
    951         Package () {"port-idx-in-ae", 1},
    952       }
    953     })
    954   }
    955 
    956 }
    957