summaryrefslogtreecommitdiff
path: root/Silicon/Hisilicon/Pv660/Pv660AcpiTables/Dsdt/Pci.asl
blob: 244ff9375d55efe1d6279da5841837387815c965 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/** @file
*
*  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
*  Copyright (c) 2016, Hisilicon Limited. All rights reserved.
*  Copyright (c) 2016, Linaro Limited. All rights reserved.
*
*  This program and the accompanying materials
*  are licensed and made available under the terms and conditions of the BSD License
*  which accompanies this distribution.  The full text of the license may be found at
*  http://opensource.org/licenses/bsd-license.php
*
*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*
*  Based on the files under ArmPlatformPkg/ArmJunoPkg/AcpiTables/
*
**/

Scope(_SB)
{
  // PCIe Root bus
  Device (PCI1)
  {
    Name (_HID, "HISI0080") // PCI Express Root Bridge
    Name (_CID, "PNP0A03") // Compatible PCI Root Bridge
    Name(_SEG, 1) // Segment of this Root complex
    Name(_BBN, 64) // Base Bus Number
    Name(_CCA, 1)
    Method (_CRS, 0, Serialized) { // Root complex resources
      Name (RBUF, ResourceTemplate () {
        WordBusNumber ( // Bus numbers assigned to this root
          ResourceProducer, MinFixed, MaxFixed, PosDecode,
          0, // AddressGranularity
          64, // AddressMinimum - Minimum Bus Number
          127, // AddressMaximum - Maximum Bus Number
          0, // AddressTranslation - Set to 0
          64 // RangeLength - Number of Busses
        )
        QWordMemory ( // 64-bit BAR Windows
          ResourceProducer,
          PosDecode,
          MinFixed,
          MaxFixed,
          Cacheable,
          ReadWrite,
          0x0000000000000000, // Granularity
          0x00000000b0000000, // Min Base Address pci address
          0x00000000b7feffff, // Max Base Address
          0x0000021f58000000, // Translate
          0x0000000007ff0000 // Length
        )
        QWordIO (
          ResourceProducer,
          MinFixed,
          MaxFixed,
          PosDecode,
          EntireRange,
          0x0000000000000000, // Granularity
          0x0000000000000000, // Min Base Address
          0x000000000000ffff, // Max Base Address
          0x000002200fff0000, // Translate
          0x0000000000010000 // Length
        )
      }) // Name(RBUF)
      Return (RBUF)
    } // Method(_CRS)

    Device (RES1)
    {
      Name (_HID, "HISI0081") // HiSi PCIe RC config base address
      Name (_CRS, ResourceTemplate (){
        Memory32Fixed (ReadWrite, 0xb0080000 , 0x10000)
      })
    }

    OperationRegion(SCTR, SystemMemory, 0xb0006918, 4)
    Field(SCTR, AnyAcc, NoLock, Preserve) {
      LSTA, 32,
    }
    Method(_DSM, 0x4, Serialized) {
      If(LEqual(Arg0,ToUUID("6d30f553-836c-408e-b6ad-45bccc957949"))) {

        switch(ToInteger(Arg2))
        {
          // Function 0: Return LinkStatus
          case(0) {
              Store (0, Local0)
              Store (LSTA, Local0)
              Return (Local0)
          }
          default {
          }
        }
      }
      // If not one of the function identifiers we recognize, then return a buffer
      // with bit 0 set to 0 indicating no functions supported.
      return(Buffer(){0})
    }
  } // Device(PCI1)

  // PCIe Root bus
  Device (PCI2)
  {
    Name (_HID, "HISI0080") // PCI Express Root Bridge
    Name (_CID, "PNP0A03") // Compatible PCI Root Bridge
    Name(_SEG, 2) // Segment of this Root complex
    Name(_BBN, 128) // Base Bus Number
    Name(_CCA, 1)
    Method (_CRS, 0, Serialized) { // Root complex resources
      Name (RBUF, ResourceTemplate () {
        WordBusNumber ( // Bus numbers assigned to this root
          ResourceProducer, MinFixed, MaxFixed, PosDecode,
          0, // AddressGranularity
          128, // AddressMinimum - Minimum Bus Number
          191, // AddressMaximum - Maximum Bus Number
          0, // AddressTranslation - Set to 0
          64 // RangeLength - Number of Busses
        )
        QWordMemory ( // 64-bit BAR Windows
          ResourceProducer,
          PosDecode,
          MinFixed,
          MaxFixed,
          Cacheable,
          ReadWrite,
          0x0000000000000000, // Granularity
          0x00000000c0000000, // Min Base Address
          0x00000000c3feffff, // Max Base Address
          0x0000023f4c000000, // Translate
          0x0000000003ff0000 // Length
        )
        QWordIO (
          ResourceProducer,
          MinFixed,
          MaxFixed,
          PosDecode,
          EntireRange,
          0x0000000000000000, // Granularity
          0x0000000000000000, // Min Base Address
          0x000000000000ffff, // Max Base Address
          0x000002400fff0000, // Translate
          0x0000000000010000 // Length
        )
      }) // Name(RBUF)
      Return (RBUF)
    } // Method(_CRS)

    Device (RES2)
    {
      Name (_HID, "HISI0081") // HiSi PCIe RC config base address
      Name (_CRS, ResourceTemplate (){
        Memory32Fixed (ReadWrite, 0xb0090000 , 0x10000)
      })
    }

    OperationRegion(SCTR, SystemMemory, 0xb0006a18, 4)
    Field(SCTR, AnyAcc, NoLock, Preserve) {
      LSTA, 32,
    }
    Method(_DSM, 0x4, Serialized) {
      If(LEqual(Arg0,ToUUID("6d30f553-836c-408e-b6ad-45bccc957949")))
      {
        switch(ToInteger(Arg2))
        {
          // Function 0: Return LinkStatus
          case(0) {
              Store (0, Local0)
              Store (LSTA, Local0)
              Return (Local0)
          }
          default {
          }
        }
      }
      // If not one of the function identifiers we recognize, then return a buffer
      // with bit 0 set to 0 indicating no functions supported.
      return(Buffer(){0})
    }
  } // Device(PCI2)
}