Skip to content

Commit b7d845a

Browse files
committed
dbg2: decode OEMData of synopsys/chipidea controller.
1 parent 2ef2545 commit b7d845a

File tree

6 files changed

+172
-83
lines changed

6 files changed

+172
-83
lines changed

include/common/dbg2.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ enum DBG2_DEBUG_PORT_SUBTYPE_NET {
9999
"DBG2_DEBUG_DEVICE_INFO_STRUCTURE_" #name " size incorrect");
100100

101101
#define DBG2_DEFINE_DEBUG_DEVICE_INFO_STRUCTURE( \
102-
name, num_of_generic_addr_regs, namespacestr_len, oemdata_len) \
102+
name, num_of_generic_addr_regs, namespacestr_len, oemdata_cnt, \
103+
oemdata_struct) \
103104
typedef struct { \
104105
UINT8 Revision; \
105106
UINT16 Length; \
@@ -116,10 +117,11 @@ enum DBG2_DEBUG_PORT_SUBTYPE_NET {
116117
ACPI_GAS BaseAddrRegister[num_of_generic_addr_regs]; \
117118
UINT32 AddressSize[num_of_generic_addr_regs]; \
118119
CHAR8 NamespaceString[namespacestr_len]; \
119-
UINT8 OemData[oemdata_len]; \
120+
oemdata_struct OemData[oemdata_cnt]; \
120121
} __attribute__((packed)) DBG2_DEBUG_DEVICE_INFO_STRUCTURE_##name; \
121-
DEBUG_DEVICE_INFO_STRUCTURE_SIZE_CHECK(name, num_of_generic_addr_regs, \
122-
namespacestr_len, oemdata_len);
122+
DEBUG_DEVICE_INFO_STRUCTURE_SIZE_CHECK( \
123+
name, num_of_generic_addr_regs, namespacestr_len, \
124+
oemdata_cnt * sizeof(oemdata_struct));
123125

124126
#define DBG2_DEFINE_TABLE(...) \
125127
typedef struct { \

include/common/dbg2_chipidea.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/** OEMdata struct of chipidea controller in dbg2
2+
Reference to:
3+
\Windows
4+
Kits\10\Debuggers\ddk\samples\kdnet\usb\usbfn\miniport\chipidea\usbfnmp.c
5+
*/
6+
7+
#include "common.h"
8+
9+
#define DBG2_DEVICE_OEM_DATA_CHIPIDEA_WRITE_ENTRIES_MAX 16
10+
#define DBG2_DEVICE_OEM_DATA_CHIPIDEA_MAGIC '1', 'X', 'I', 'F' // "FIX1"
11+
12+
typedef struct {
13+
UINT8 BaseAddressReg;
14+
UINT8 Reserved;
15+
UINT16 Offset;
16+
UINT32 Val2And;
17+
UINT32 Val2Or;
18+
} __attribute__((packed)) DBG2_DEVICE_OEM_DATA_CHIPIDEA_WRITE_ENTRY;
19+
20+
typedef struct {
21+
UINT16 PortType;
22+
UINT16 Reserved;
23+
UINT32 Magic;
24+
UINT32 NumOfEntries;
25+
DBG2_DEVICE_OEM_DATA_CHIPIDEA_WRITE_ENTRY
26+
WriteEntries[DBG2_DEVICE_OEM_DATA_CHIPIDEA_WRITE_ENTRIES_MAX];
27+
} __attribute__((packed)) DBG2_DEVICE_OEM_DATA_CHIPIDEA;
28+
29+
// Helper macro to define CHIPIDEA OEM data
30+
#define DBG2_DEVICE_OEM_DATA_CHIPIDEA_ENTRY(base_addr_reg, offset, val2and, \
31+
val2or) \
32+
{ \
33+
.BaseAddressReg = base_addr_reg, \
34+
.Reserved = 0, \
35+
.Offset = offset, \
36+
.Val2And = val2and, \
37+
.Val2Or = val2or, \
38+
}

include/common/dbg2_synopsys.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/** OEMdata struct of synopsys controller in dbg2
2+
3+
Reference to:
4+
\Windows
5+
Kits\10\Debuggers\ddk\samples\kdnet\usb\usbfn\miniport\synopsys\usbfnmp.c File
6+
copyright: Copyright (c) Microsoft Corporation
7+
*/
8+
#include "common.h"
9+
10+
#define DBG2_DEVICE_OEM_DATA_SYNOPSYS_WRITE_ENTRIES_MAX 16
11+
#define DBG2_DEVICE_OEM_DATA_SYNOPSYS_MAGIC '2', 'X', 'I', 'F' // "FIX2"
12+
13+
typedef struct {
14+
UINT8 BaseAddressReg;
15+
UINT8 Phase;
16+
UINT8 Reserved[2];
17+
UINT32 Offset;
18+
UINT32 Val2And;
19+
UINT32 Val2Or;
20+
} __attribute__((packed)) DBG2_DEVICE_OEM_DATA_SYNOPSYS_WRITE_ENTRY;
21+
22+
typedef struct {
23+
UINT16 PortType;
24+
UINT16 Reserved;
25+
CHAR8 Magic[4];
26+
UINT32 NumOfEntries;
27+
DBG2_DEVICE_OEM_DATA_SYNOPSYS_WRITE_ENTRY
28+
WriteEntries[DBG2_DEVICE_OEM_DATA_SYNOPSYS_WRITE_ENTRIES_MAX];
29+
} __attribute__((packed)) DBG2_DEVICE_OEM_DATA_SYNOPSYS;
30+
31+
// Helper macro to define synopsys OEM data
32+
#define DBG2_DEVICE_OEM_DATA_SYNOPSYS_ENTRY(phase, offset, val2and, val2or) \
33+
{ \
34+
.BaseAddressReg = 0, \
35+
.Phase = phase, \
36+
.Reserved = {0}, \
37+
.Offset = offset, \
38+
.Val2And = val2and, \
39+
.Val2Or = val2or, \
40+
}

include/vendor/qcom/acpi_vendor.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#pragma once
22

33
#define ACPI_TABLE_HEADER_OEM_ID 'Q', 'C', 'O', 'M', ' ', ' ' // "QCOM"
4-
#define ACPI_TABLE_HEADER_OEM_TABLE_ID 'Q', 'C', 'O', 'M', 'E', 'D', 'K', '2' // "QCOMEDK2"
4+
#define ACPI_TABLE_HEADER_OEM_TABLE_ID \
5+
'Q', 'C', 'O', 'M', 'E', 'D', 'K', '2' // "QCOMEDK2"
56
#define ACPI_CSRT_VENDOR_ID 0x4D4F4351ULL // 'M', 'O', 'C', 'Q'
67
#define ACPI_CSRT_SUB_VENDOR_ID 0x0ULL
78

@@ -41,3 +42,15 @@ enum ACPI_CSRT_DEVICE_ID {
4142
.AddressSize = {0x1000}, \
4243
.NamespaceString = namepath, \
4344
}
45+
46+
/** PortType in dbg2 device info for usb controllers.
47+
Reference to:
48+
\Windows Kits\10\Debuggers\ddk\samples\kdnet\usb\qualcomm\kdqcom\kdextension.c
49+
*/
50+
enum {
51+
DBG2_QCOM_DEBUG_PORT_SUBTYPE_CHIPIDEA_USBFN = 1,
52+
DBG2_QCOM_DEBUG_PORT_SUBTYPE_CHIPIDEA_AX88772 = 2,
53+
DBG2_QCOM_DEBUG_PORT_SUBTYPE_CHIPIDEA_USBFNB = 3,
54+
DBG2_QCOM_DEBUG_PORT_SUBTYPE_SYNOPSYS_USBFN = 4,
55+
DBG2_QCOM_DEBUG_PORT_SUBTYPE_SYNOPSYS_USBFNB = 5,
56+
};

include/vendor/qcom/sm8450/dbg2.h

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22
#include "table_header.h"
33
#include <common/dbg2.h>
4+
#include <common/dbg2_synopsys.h>
45

56
// DEBUG UART
67
#define UARD_NAMESPACE_STRING "\\_SB.UARD"
@@ -14,13 +15,14 @@
1415

1516
/* typedef */
1617
DBG2_DEFINE_DEBUG_DEVICE_INFO_STRUCTURE(UARD, UARD_NUM_GAS,
17-
sizeof(UARD_NAMESPACE_STRING), 0);
18+
sizeof(UARD_NAMESPACE_STRING), 0,
19+
UINT8);
1820
DBG2_DEFINE_DEBUG_DEVICE_INFO_STRUCTURE(URS0HS, URS0_NUM_GAS,
19-
sizeof(URS0_NAMESPACE_STRING),
20-
USB_OEM_DATA_SIZE);
21+
sizeof(URS0_NAMESPACE_STRING), 1,
22+
DBG2_DEVICE_OEM_DATA_SYNOPSYS);
2123
DBG2_DEFINE_DEBUG_DEVICE_INFO_STRUCTURE(URS0SS, URS0_NUM_GAS,
22-
sizeof(URS0_NAMESPACE_STRING),
23-
USB_OEM_DATA_SIZE);
24+
sizeof(URS0_NAMESPACE_STRING), 1,
25+
DBG2_DEVICE_OEM_DATA_SYNOPSYS);
2426

2527
DBG2_DEFINE_TABLE(DBG2_DEFINE_DEVICE_INFO_IN_TABLE(UARD);
2628
DBG2_DEFINE_DEVICE_INFO_IN_TABLE(URS0HS);
@@ -73,23 +75,21 @@ DBG2_START{
7375
},
7476
},
7577
.AddressSize = {0xFFFFF, 0x1000},
76-
.OemData = {0x05, 0x00, 0x00, 0x00, 0x32, 0x58, 0x49, 0x46, 0x03,
77-
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xc7,
78-
0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
79-
0x00, 0x00, 0x02, 0x00, 0x00, 0x10, 0x88, 0x0f, 0x00,
80-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,
81-
0x02, 0x00, 0x00, 0xb4, 0x88, 0x0f, 0x00, 0x00, 0x00,
82-
0x00, 0x00, 0xeb, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00,
83-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
84-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
85-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
86-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
87-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
88-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
89-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
90-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
91-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
92-
0x43, 0x42, 0x53, 0x55},
78+
.OemData = {{
79+
.PortType = DBG2_QCOM_DEBUG_PORT_SUBTYPE_SYNOPSYS_USBFNB,
80+
.Magic = {DBG2_DEVICE_OEM_DATA_SYNOPSYS_MAGIC},
81+
.NumOfEntries = 3,
82+
.WriteEntries =
83+
{
84+
/* Phase, Offset, Val2And, Value2Or*/
85+
DBG2_DEVICE_OEM_DATA_SYNOPSYS_ENTRY(
86+
0x02, 0x0000c700, 0xfffffff8, 0x00000000),
87+
DBG2_DEVICE_OEM_DATA_SYNOPSYS_ENTRY(
88+
0x02, 0x000f8810, 0x00000000, 0x10100000),
89+
DBG2_DEVICE_OEM_DATA_SYNOPSYS_ENTRY(
90+
0x02, 0x000f88b4, 0x00000000, 0x00000deb),
91+
},
92+
}},
9393
},
9494
/* Primary Core USB SS (Synopsys)*/
9595
.URS0SS =
@@ -130,23 +130,21 @@ DBG2_START{
130130
},
131131
},
132132
.AddressSize = {0xFFFFF, 0x1000},
133-
.OemData = {0x05, 0x00, 0x00, 0x00, 0x32, 0x58, 0x49, 0x46, 0x03,
134-
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0xc7,
135-
0x00, 0x00, 0xff, 0xe1, 0xff, 0xff, 0x00, 0x00, 0x00,
136-
0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x88, 0x0f, 0x00,
137-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,
138-
0x02, 0x00, 0x00, 0xb4, 0x88, 0x0f, 0x00, 0x00, 0x00,
139-
0x00, 0x00, 0xeb, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00,
140-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
141-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
142-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
143-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
144-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
145-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
146-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
147-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
148-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
149-
0x43, 0x42, 0x53, 0x55},
133+
.OemData = {{
134+
.PortType = DBG2_QCOM_DEBUG_PORT_SUBTYPE_SYNOPSYS_USBFNB,
135+
.Magic = {DBG2_DEVICE_OEM_DATA_SYNOPSYS_MAGIC},
136+
.NumOfEntries = 3,
137+
.WriteEntries =
138+
{
139+
/* Phase, Offset, Val2And, Value2Or*/
140+
DBG2_DEVICE_OEM_DATA_SYNOPSYS_ENTRY(
141+
0x02, 0x0000c704, 0xffffe1ff, 0x00000000),
142+
DBG2_DEVICE_OEM_DATA_SYNOPSYS_ENTRY(
143+
0x01, 0x000f8810, 0x00000000, 0x10100000),
144+
DBG2_DEVICE_OEM_DATA_SYNOPSYS_ENTRY(
145+
0x02, 0x000f88b4, 0x00000000, 0x00000deb),
146+
},
147+
}},
150148
},
151149

152150
} DBG2_END

include/vendor/qcom/sm8850/dbg2.h

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22
#include "table_header.h"
33
#include <common/dbg2.h>
4+
#include <common/dbg2_synopsys.h>
45

56
// DEBUG UART
67
#define UARD_NAMESPACE_STRING "\\_SB.UARD"
@@ -14,13 +15,14 @@
1415

1516
/* typedef */
1617
DBG2_DEFINE_DEBUG_DEVICE_INFO_STRUCTURE(UARD, UARD_NUM_GAS,
17-
sizeof(UARD_NAMESPACE_STRING), 0);
18+
sizeof(UARD_NAMESPACE_STRING), 0,
19+
UINT8);
1820
DBG2_DEFINE_DEBUG_DEVICE_INFO_STRUCTURE(URS0HS, URS0_NUM_GAS,
19-
sizeof(URS0_NAMESPACE_STRING),
20-
USB_OEM_DATA_SIZE);
21+
sizeof(URS0_NAMESPACE_STRING), 1,
22+
DBG2_DEVICE_OEM_DATA_SYNOPSYS);
2123
DBG2_DEFINE_DEBUG_DEVICE_INFO_STRUCTURE(URS0SS, URS0_NUM_GAS,
22-
sizeof(URS0_NAMESPACE_STRING),
23-
USB_OEM_DATA_SIZE);
24+
sizeof(URS0_NAMESPACE_STRING), 1,
25+
DBG2_DEVICE_OEM_DATA_SYNOPSYS);
2426

2527
DBG2_DEFINE_TABLE(DBG2_DEFINE_DEVICE_INFO_IN_TABLE(UARD);
2628
DBG2_DEFINE_DEVICE_INFO_IN_TABLE(URS0HS);
@@ -73,23 +75,21 @@ DBG2_START{
7375
},
7476
},
7577
.AddressSize = {0xFFFFF, 0x1000},
76-
.OemData = {0x05, 0x00, 0x00, 0x00, 0x32, 0x58, 0x49, 0x46, 0x03,
77-
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xc7,
78-
0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
79-
0x00, 0x00, 0x02, 0x00, 0x00, 0x10, 0x88, 0x0f, 0x00,
80-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,
81-
0x02, 0x00, 0x00, 0xb4, 0x88, 0x0f, 0x00, 0x00, 0x00,
82-
0x00, 0x00, 0xeb, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00,
83-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
84-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
85-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
86-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
87-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
88-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
89-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
90-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
91-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
92-
0x43, 0x42, 0x53, 0x55},
78+
.OemData = {{
79+
.PortType = DBG2_QCOM_DEBUG_PORT_SUBTYPE_SYNOPSYS_USBFNB,
80+
.Magic = {DBG2_DEVICE_OEM_DATA_SYNOPSYS_MAGIC},
81+
.NumOfEntries = 3,
82+
.WriteEntries =
83+
{
84+
/* Phase, Offset, Val2And, Value2Or*/
85+
DBG2_DEVICE_OEM_DATA_SYNOPSYS_ENTRY(
86+
0x02, 0x0000c700, 0xfffffff8, 0x00000000),
87+
DBG2_DEVICE_OEM_DATA_SYNOPSYS_ENTRY(
88+
0x02, 0x000f8810, 0x00000000, 0x10100000),
89+
DBG2_DEVICE_OEM_DATA_SYNOPSYS_ENTRY(
90+
0x02, 0x000f88b4, 0x00000000, 0x00000deb),
91+
},
92+
}},
9393
},
9494
/* Primary Core USB SS (Synopsys)*/
9595
.URS0SS =
@@ -130,23 +130,21 @@ DBG2_START{
130130
},
131131
},
132132
.AddressSize = {0xFFFFF, 0x1000},
133-
.OemData = {0x05, 0x00, 0x00, 0x00, 0x32, 0x58, 0x49, 0x46, 0x03,
134-
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0xc7,
135-
0x00, 0x00, 0xff, 0xe1, 0xff, 0xff, 0x00, 0x00, 0x00,
136-
0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x88, 0x0f, 0x00,
137-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,
138-
0x02, 0x00, 0x00, 0xb4, 0x88, 0x0f, 0x00, 0x00, 0x00,
139-
0x00, 0x00, 0xeb, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00,
140-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
141-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
142-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
143-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
144-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
145-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
146-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
147-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
148-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
149-
0x43, 0x42, 0x53, 0x55},
133+
.OemData = {{
134+
.PortType = DBG2_QCOM_DEBUG_PORT_SUBTYPE_SYNOPSYS_USBFNB,
135+
.Magic = {DBG2_DEVICE_OEM_DATA_SYNOPSYS_MAGIC},
136+
.NumOfEntries = 3,
137+
.WriteEntries =
138+
{
139+
/* Phase, Offset, Val2And, Value2Or*/
140+
DBG2_DEVICE_OEM_DATA_SYNOPSYS_ENTRY(
141+
0x02, 0x0000c704, 0xffffe1ff, 0x00000000),
142+
DBG2_DEVICE_OEM_DATA_SYNOPSYS_ENTRY(
143+
0x01, 0x000f8810, 0x00000000, 0x10100000),
144+
DBG2_DEVICE_OEM_DATA_SYNOPSYS_ENTRY(
145+
0x02, 0x000f88b4, 0x00000000, 0x00000deb),
146+
},
147+
}},
150148
},
151149

152150
} DBG2_END

0 commit comments

Comments
 (0)