Patrick Georgi | ea063cb | 2020-05-08 19:28:13 +0200 | [diff] [blame] | 1 | /* inteltool - dump all registers on an Intel CPU + chipset based system */ |
Patrick Georgi | 7333a11 | 2020-05-08 20:48:04 +0200 | [diff] [blame] | 2 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Nico Huber | 1898023 | 2017-04-07 12:26:07 +0200 | [diff] [blame] | 3 | |
| 4 | #include <stdio.h> |
| 5 | #include <stdlib.h> |
| 6 | #include <stddef.h> |
| 7 | #include <stdint.h> |
| 8 | #include <assert.h> |
| 9 | #include <inttypes.h> |
| 10 | #include "inteltool.h" |
| 11 | #include "pcr.h" |
| 12 | |
Johanna Schander | f80c5d9 | 2020-01-29 09:20:23 +0100 | [diff] [blame] | 13 | #include "gpio_names/apollolake.h" |
Johanna Schander | d5a6530 | 2020-01-29 09:16:06 +0100 | [diff] [blame] | 14 | #include "gpio_names/cannonlake.h" |
Matt DeVillier | 3c78445 | 2019-06-11 23:23:46 -0500 | [diff] [blame] | 15 | #include "gpio_names/cannonlake_lp.h" |
Johanna Schander | 7da602f | 2020-01-29 09:51:25 +0100 | [diff] [blame] | 16 | #include "gpio_names/denverton.h" |
Sean Rhodes | 645dde7 | 2021-10-22 09:31:22 +0100 | [diff] [blame] | 17 | #include "gpio_names/geminilake.h" |
Johanna Schander | dca20cd | 2020-01-29 09:14:18 +0100 | [diff] [blame] | 18 | #include "gpio_names/icelake.h" |
Johanna Schander | aff7d1f | 2020-01-29 09:29:39 +0100 | [diff] [blame] | 19 | #include "gpio_names/lewisburg.h" |
Christian Walter | 1364ac3 | 2022-09-08 11:44:19 +0200 | [diff] [blame] | 20 | #include "gpio_names/emmitsburg.h" |
Johanna Schander | e98af86 | 2020-01-29 09:25:45 +0100 | [diff] [blame] | 21 | #include "gpio_names/sunrise.h" |
Michał Żygowski | 8ac40f3 | 2021-07-09 16:00:16 +0200 | [diff] [blame] | 22 | #include "gpio_names/tigerlake.h" |
Michał Kopeć | 2d8edeb | 2022-04-05 10:40:03 +0200 | [diff] [blame] | 23 | #include "gpio_names/alderlake_h.h" |
Kacper Stojek | fb9110b | 2022-08-17 10:28:20 +0200 | [diff] [blame] | 24 | #include "gpio_names/alderlake_p.h" |
Kacper Stojek | 76d2b66 | 2022-10-17 14:30:24 +0200 | [diff] [blame] | 25 | #include "gpio_names/elkhartlake.h" |
Karol Zmyslowski | b2f5a22 | 2023-03-10 19:44:04 +0100 | [diff] [blame] | 26 | #include "gpio_names/jasperlake.h" |
Johanna Schander | dca20cd | 2020-01-29 09:14:18 +0100 | [diff] [blame] | 27 | |
Nico Huber | 1898023 | 2017-04-07 12:26:07 +0200 | [diff] [blame] | 28 | #define SBBAR_SIZE (16 * MiB) |
| 29 | #define PCR_PORT_SIZE (64 * KiB) |
| 30 | |
Nico Huber | 1898023 | 2017-04-07 12:26:07 +0200 | [diff] [blame] | 31 | static const char *decode_pad_mode(const struct gpio_group *const group, |
| 32 | const size_t pad, const uint32_t dw0) |
| 33 | { |
| 34 | const size_t pad_mode = dw0 >> 10 & 7; |
Nico Huber | 8a95c6c | 2018-11-27 12:27:22 +0100 | [diff] [blame] | 35 | const char *const pad_name = |
| 36 | group->pad_names[pad * group->func_count + pad_mode]; |
| 37 | |
Nico Huber | 1898023 | 2017-04-07 12:26:07 +0200 | [diff] [blame] | 38 | if (!pad_mode) |
Nico Huber | 8a95c6c | 2018-11-27 12:27:22 +0100 | [diff] [blame] | 39 | return pad_name[0] == '*' ? "*GPIO" : "GPIO"; |
Nico Huber | 1898023 | 2017-04-07 12:26:07 +0200 | [diff] [blame] | 40 | else if (pad_mode < group->func_count) |
| 41 | return group->pad_names[pad * group->func_count + pad_mode]; |
| 42 | else |
| 43 | return "RESERVED"; |
| 44 | } |
| 45 | |
| 46 | static void print_gpio_group(const uint8_t pid, size_t pad_cfg, |
Thomas Heijligen | 725369f | 2019-02-19 10:51:34 +0000 | [diff] [blame] | 47 | const struct gpio_group *const group, |
| 48 | size_t pad_stepping) |
Nico Huber | 1898023 | 2017-04-07 12:26:07 +0200 | [diff] [blame] | 49 | { |
| 50 | size_t p; |
| 51 | |
| 52 | printf("%s\n", group->display); |
| 53 | |
Thomas Heijligen | 725369f | 2019-02-19 10:51:34 +0000 | [diff] [blame] | 54 | for (p = 0; p < group->pad_count; ++p, pad_cfg += pad_stepping) { |
Nico Huber | 1898023 | 2017-04-07 12:26:07 +0200 | [diff] [blame] | 55 | const uint32_t dw0 = read_pcr32(pid, pad_cfg); |
| 56 | const uint32_t dw1 = read_pcr32(pid, pad_cfg + 4); |
Nico Huber | 8a95c6c | 2018-11-27 12:27:22 +0100 | [diff] [blame] | 57 | const char *const pad_name = |
| 58 | group->pad_names[p * group->func_count]; |
Nico Huber | 1898023 | 2017-04-07 12:26:07 +0200 | [diff] [blame] | 59 | |
Nico Huber | 8a95c6c | 2018-11-27 12:27:22 +0100 | [diff] [blame] | 60 | printf("0x%04zx: 0x%016"PRIx64" %-12s %-20s\n", pad_cfg, |
Nico Huber | 1898023 | 2017-04-07 12:26:07 +0200 | [diff] [blame] | 61 | (uint64_t)dw1 << 32 | dw0, |
Nico Huber | 8a95c6c | 2018-11-27 12:27:22 +0100 | [diff] [blame] | 62 | pad_name[0] == '*' ? &pad_name[1] : pad_name, |
Nico Huber | 1898023 | 2017-04-07 12:26:07 +0200 | [diff] [blame] | 63 | decode_pad_mode(group, p, dw0)); |
| 64 | } |
| 65 | } |
| 66 | |
Thomas Heijligen | 725369f | 2019-02-19 10:51:34 +0000 | [diff] [blame] | 67 | static void print_gpio_community(const struct gpio_community *const community, |
| 68 | size_t pad_stepping) |
Nico Huber | 1898023 | 2017-04-07 12:26:07 +0200 | [diff] [blame] | 69 | { |
| 70 | size_t group, pad_count; |
| 71 | size_t pad_cfg; /* offset in bytes under this communities PCR port */ |
| 72 | |
| 73 | printf("%s\n\nPCR Port ID: 0x%06zx\n\n", |
| 74 | community->name, (size_t)community->pcr_port_id << 16); |
| 75 | |
| 76 | for (group = 0, pad_count = 0; group < community->group_count; ++group) |
| 77 | pad_count += community->groups[group]->pad_count; |
| 78 | assert(pad_count * 8 <= PCR_PORT_SIZE - 0x10); |
| 79 | |
| 80 | pad_cfg = read_pcr32(community->pcr_port_id, 0x0c); |
| 81 | if (pad_cfg + pad_count * 8 > PCR_PORT_SIZE) { |
| 82 | fprintf(stderr, "Bad Pad Base Address: 0x%08zx\n", pad_cfg); |
| 83 | return; |
| 84 | } |
| 85 | |
| 86 | for (group = 0; group < community->group_count; ++group) { |
Christian Walter | 1364ac3 | 2022-09-08 11:44:19 +0200 | [diff] [blame] | 87 | if (community->groups[group]->pad_offset) |
| 88 | pad_cfg = community->groups[group]->pad_offset; |
Nico Huber | 1898023 | 2017-04-07 12:26:07 +0200 | [diff] [blame] | 89 | print_gpio_group(community->pcr_port_id, |
Thomas Heijligen | 725369f | 2019-02-19 10:51:34 +0000 | [diff] [blame] | 90 | pad_cfg, community->groups[group], |
| 91 | pad_stepping); |
| 92 | pad_cfg += community->groups[group]->pad_count * pad_stepping; |
Nico Huber | 1898023 | 2017-04-07 12:26:07 +0200 | [diff] [blame] | 93 | } |
| 94 | } |
| 95 | |
Johanna Schander | e32ded8 | 2020-01-29 10:08:17 +0100 | [diff] [blame] | 96 | const struct gpio_community *const *get_gpio_communities(struct pci_dev *const sb, |
| 97 | size_t* community_count, |
| 98 | size_t* pad_stepping) |
Nico Huber | 1898023 | 2017-04-07 12:26:07 +0200 | [diff] [blame] | 99 | { |
Johanna Schander | e32ded8 | 2020-01-29 10:08:17 +0100 | [diff] [blame] | 100 | *pad_stepping = 8; |
Nico Huber | 1898023 | 2017-04-07 12:26:07 +0200 | [diff] [blame] | 101 | |
| 102 | switch (sb->device_id) { |
Pavel Sayekat | 9429b70 | 2019-07-28 23:09:08 +0600 | [diff] [blame] | 103 | case PCI_DEVICE_ID_INTEL_H110: |
Felix Singer | f98dc48 | 2019-07-29 21:53:14 +0200 | [diff] [blame] | 104 | case PCI_DEVICE_ID_INTEL_H170: |
| 105 | case PCI_DEVICE_ID_INTEL_Z170: |
| 106 | case PCI_DEVICE_ID_INTEL_Q170: |
| 107 | case PCI_DEVICE_ID_INTEL_Q150: |
Nico Huber | 54fe32f | 2017-10-03 16:03:07 +0200 | [diff] [blame] | 108 | case PCI_DEVICE_ID_INTEL_B150: |
Christian Walter | 9a8c5e7 | 2019-05-06 17:50:57 +0200 | [diff] [blame] | 109 | case PCI_DEVICE_ID_INTEL_C236: |
Felix Singer | f98dc48 | 2019-07-29 21:53:14 +0200 | [diff] [blame] | 110 | case PCI_DEVICE_ID_INTEL_C232: |
| 111 | case PCI_DEVICE_ID_INTEL_QM170: |
| 112 | case PCI_DEVICE_ID_INTEL_HM170: |
| 113 | case PCI_DEVICE_ID_INTEL_CM236: |
Timofey Komarov | 6c80082 | 2021-06-25 12:07:32 +0300 | [diff] [blame] | 114 | case PCI_DEVICE_ID_INTEL_H270: |
| 115 | case PCI_DEVICE_ID_INTEL_Z270: |
| 116 | case PCI_DEVICE_ID_INTEL_Q270: |
| 117 | case PCI_DEVICE_ID_INTEL_Q250: |
| 118 | case PCI_DEVICE_ID_INTEL_B250: |
| 119 | case PCI_DEVICE_ID_INTEL_Z370: |
| 120 | case PCI_DEVICE_ID_INTEL_H310C: |
| 121 | case PCI_DEVICE_ID_INTEL_X299: |
Johanna Schander | e32ded8 | 2020-01-29 10:08:17 +0100 | [diff] [blame] | 122 | *community_count = ARRAY_SIZE(sunrise_communities); |
| 123 | return sunrise_communities; |
Felix Singer | 0a7543d | 2019-02-19 23:49:11 +0100 | [diff] [blame] | 124 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_PRE: |
| 125 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_BASE_SKL: |
| 126 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_PREM_SKL: |
| 127 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_PREM_SKL: |
| 128 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_BASE_KBL: |
| 129 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_PREM_KBL: |
| 130 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_PREM_KBL: |
Matthew Garrett | 2bf28e5 | 2018-07-23 21:09:47 -0700 | [diff] [blame] | 131 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_IHDCP_BASE: |
| 132 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_IHDCP_PREM: |
| 133 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_IHDCP_PREM: |
Johanna Schander | e32ded8 | 2020-01-29 10:08:17 +0100 | [diff] [blame] | 134 | *community_count = ARRAY_SIZE(sunrise_lp_communities); |
| 135 | return sunrise_lp_communities; |
Maxim Polyakov | b89ce2e | 2019-08-17 14:54:02 +0300 | [diff] [blame] | 136 | case PCI_DEVICE_ID_INTEL_C621: |
| 137 | case PCI_DEVICE_ID_INTEL_C622: |
| 138 | case PCI_DEVICE_ID_INTEL_C624: |
| 139 | case PCI_DEVICE_ID_INTEL_C625: |
| 140 | case PCI_DEVICE_ID_INTEL_C626: |
| 141 | case PCI_DEVICE_ID_INTEL_C627: |
| 142 | case PCI_DEVICE_ID_INTEL_C628: |
| 143 | case PCI_DEVICE_ID_INTEL_C629: |
Maxim Polyakov | de7092b | 2020-07-17 00:19:41 +0300 | [diff] [blame] | 144 | case PCI_DEVICE_ID_INTEL_C621A: |
| 145 | case PCI_DEVICE_ID_INTEL_C627A: |
| 146 | case PCI_DEVICE_ID_INTEL_C629A: |
Maxim Polyakov | b89ce2e | 2019-08-17 14:54:02 +0300 | [diff] [blame] | 147 | case PCI_DEVICE_ID_INTEL_C624_SUPER: |
| 148 | case PCI_DEVICE_ID_INTEL_C627_SUPER_1: |
| 149 | case PCI_DEVICE_ID_INTEL_C621_SUPER: |
| 150 | case PCI_DEVICE_ID_INTEL_C627_SUPER_2: |
| 151 | case PCI_DEVICE_ID_INTEL_C628_SUPER: |
Maxim Polyakov | de7092b | 2020-07-17 00:19:41 +0300 | [diff] [blame] | 152 | case PCI_DEVICE_ID_INTEL_C621A_SUPER: |
| 153 | case PCI_DEVICE_ID_INTEL_C627A_SUPER: |
| 154 | case PCI_DEVICE_ID_INTEL_C629A_SUPER: |
Johanna Schander | e32ded8 | 2020-01-29 10:08:17 +0100 | [diff] [blame] | 155 | *community_count = ARRAY_SIZE(lewisburg_communities); |
| 156 | return lewisburg_communities; |
Christian Walter | 1364ac3 | 2022-09-08 11:44:19 +0200 | [diff] [blame] | 157 | case PCI_DEVICE_ID_INTEL_EBG: |
| 158 | *pad_stepping = 16; |
| 159 | *community_count = ARRAY_SIZE(emmitsburg_communities); |
| 160 | return emmitsburg_communities; |
Thomas Heijligen | da02719 | 2019-01-12 19:20:50 +0100 | [diff] [blame] | 161 | case PCI_DEVICE_ID_INTEL_DNV_LPC: |
Johanna Schander | e32ded8 | 2020-01-29 10:08:17 +0100 | [diff] [blame] | 162 | *community_count = ARRAY_SIZE(denverton_communities); |
| 163 | return denverton_communities; |
Nico Huber | 8a95c6c | 2018-11-27 12:27:22 +0100 | [diff] [blame] | 164 | case PCI_DEVICE_ID_INTEL_APL_LPC: |
Johanna Schander | e32ded8 | 2020-01-29 10:08:17 +0100 | [diff] [blame] | 165 | *community_count = ARRAY_SIZE(apl_communities); |
| 166 | return apl_communities; |
Sean Rhodes | 645dde7 | 2021-10-22 09:31:22 +0100 | [diff] [blame] | 167 | case PCI_DEVICE_ID_INTEL_GLK_LPC: |
| 168 | *community_count = ARRAY_SIZE(glk_communities); |
| 169 | *pad_stepping = 16; |
| 170 | return glk_communities; |
Matt DeVillier | 3c78445 | 2019-06-11 23:23:46 -0500 | [diff] [blame] | 171 | case PCI_DEVICE_ID_INTEL_CANNONPOINT_LP_U_PREM: |
Matt DeVillier | 62e883d | 2020-08-08 11:17:31 -0500 | [diff] [blame] | 172 | case PCI_DEVICE_ID_INTEL_COMETPOINT_LP_U_PREM: |
| 173 | case PCI_DEVICE_ID_INTEL_COMETPOINT_LP_U_BASE: |
Matt DeVillier | 3c78445 | 2019-06-11 23:23:46 -0500 | [diff] [blame] | 174 | *community_count = ARRAY_SIZE(cannonlake_pch_lp_communities); |
| 175 | *pad_stepping = 16; |
| 176 | return cannonlake_pch_lp_communities; |
Thomas Heijligen | 725369f | 2019-02-19 10:51:34 +0000 | [diff] [blame] | 177 | case PCI_DEVICE_ID_INTEL_H310: |
| 178 | case PCI_DEVICE_ID_INTEL_H370: |
| 179 | case PCI_DEVICE_ID_INTEL_Z390: |
| 180 | case PCI_DEVICE_ID_INTEL_Q370: |
| 181 | case PCI_DEVICE_ID_INTEL_B360: |
| 182 | case PCI_DEVICE_ID_INTEL_C246: |
| 183 | case PCI_DEVICE_ID_INTEL_C242: |
| 184 | case PCI_DEVICE_ID_INTEL_QM370: |
| 185 | case PCI_DEVICE_ID_INTEL_HM370: |
| 186 | case PCI_DEVICE_ID_INTEL_CM246: |
Johanna Schander | e32ded8 | 2020-01-29 10:08:17 +0100 | [diff] [blame] | 187 | *community_count = ARRAY_SIZE(cannonlake_pch_h_communities); |
| 188 | *pad_stepping = 16; |
| 189 | return cannonlake_pch_h_communities; |
Johanna Schander | 0174ea7 | 2020-01-04 15:14:59 +0100 | [diff] [blame] | 190 | case PCI_DEVICE_ID_INTEL_ICELAKE_LP_U: |
Johanna Schander | e32ded8 | 2020-01-29 10:08:17 +0100 | [diff] [blame] | 191 | *community_count = ARRAY_SIZE(icelake_pch_h_communities); |
| 192 | *pad_stepping = 16; |
| 193 | return icelake_pch_h_communities; |
Michał Żygowski | 8ac40f3 | 2021-07-09 16:00:16 +0200 | [diff] [blame] | 194 | case PCI_DEVICE_ID_INTEL_TIGERPOINT_U_SUPER: |
| 195 | case PCI_DEVICE_ID_INTEL_TIGERPOINT_U_PREM: |
| 196 | case PCI_DEVICE_ID_INTEL_TIGERPOINT_U_BASE: |
| 197 | case PCI_DEVICE_ID_INTEL_TIGERPOINT_Y_SUPER: |
| 198 | case PCI_DEVICE_ID_INTEL_TIGERPOINT_Y_PREM: |
| 199 | *community_count = ARRAY_SIZE(tigerlake_pch_lp_communities); |
| 200 | *pad_stepping = 16; |
| 201 | return tigerlake_pch_lp_communities; |
| 202 | case PCI_DEVICE_ID_INTEL_Q570: |
| 203 | case PCI_DEVICE_ID_INTEL_Z590: |
| 204 | case PCI_DEVICE_ID_INTEL_H570: |
| 205 | case PCI_DEVICE_ID_INTEL_B560: |
| 206 | case PCI_DEVICE_ID_INTEL_H510: |
| 207 | case PCI_DEVICE_ID_INTEL_WM590: |
| 208 | case PCI_DEVICE_ID_INTEL_QM580: |
| 209 | case PCI_DEVICE_ID_INTEL_HM570: |
| 210 | case PCI_DEVICE_ID_INTEL_C252: |
| 211 | case PCI_DEVICE_ID_INTEL_C256: |
| 212 | case PCI_DEVICE_ID_INTEL_W580: |
| 213 | *community_count = ARRAY_SIZE(tigerlake_pch_h_communities); |
| 214 | *pad_stepping = 16; |
| 215 | return tigerlake_pch_h_communities; |
Maximilian Brune | 8d1051f | 2022-08-08 12:55:57 +0200 | [diff] [blame] | 216 | case PCI_DEVICE_ID_INTEL_H610E: |
| 217 | case PCI_DEVICE_ID_INTEL_Q670E: |
| 218 | case PCI_DEVICE_ID_INTEL_R680E: |
Michał Kopeć | 2d8edeb | 2022-04-05 10:40:03 +0200 | [diff] [blame] | 219 | case PCI_DEVICE_ID_INTEL_H610: |
| 220 | case PCI_DEVICE_ID_INTEL_B660: |
| 221 | case PCI_DEVICE_ID_INTEL_H670: |
| 222 | case PCI_DEVICE_ID_INTEL_Q670: |
| 223 | case PCI_DEVICE_ID_INTEL_Z690: |
| 224 | case PCI_DEVICE_ID_INTEL_W680: |
Michał Kopeć | 2d8edeb | 2022-04-05 10:40:03 +0200 | [diff] [blame] | 225 | case PCI_DEVICE_ID_INTEL_WM690: |
| 226 | case PCI_DEVICE_ID_INTEL_HM670: |
Michał Żygowski | 472d83b | 2023-06-16 12:49:12 +0200 | [diff] [blame] | 227 | case PCI_DEVICE_ID_INTEL_W790: |
| 228 | case PCI_DEVICE_ID_INTEL_Z790: |
| 229 | case PCI_DEVICE_ID_INTEL_H770: |
| 230 | case PCI_DEVICE_ID_INTEL_B760: |
Michał Kopeć | 2d8edeb | 2022-04-05 10:40:03 +0200 | [diff] [blame] | 231 | case PCI_DEVICE_ID_INTEL_HM770: |
Michał Żygowski | 472d83b | 2023-06-16 12:49:12 +0200 | [diff] [blame] | 232 | case PCI_DEVICE_ID_INTEL_WM790: |
| 233 | case PCI_DEVICE_ID_INTEL_C262: |
| 234 | case PCI_DEVICE_ID_INTEL_C266: |
Michał Kopeć | 2d8edeb | 2022-04-05 10:40:03 +0200 | [diff] [blame] | 235 | *community_count = ARRAY_SIZE(alderlake_pch_h_communities); |
| 236 | *pad_stepping = 16; |
| 237 | return alderlake_pch_h_communities; |
Kacper Stojek | fb9110b | 2022-08-17 10:28:20 +0200 | [diff] [blame] | 238 | case PCI_DEVICE_ID_INTEL_ADL_P: |
| 239 | case PCI_DEVICE_ID_INTEL_ADL_M: |
| 240 | case PCI_DEVICE_ID_INTEL_RPL_P: |
| 241 | *community_count = ARRAY_SIZE(alderlake_pch_p_communities); |
| 242 | *pad_stepping = 16; |
| 243 | return alderlake_pch_p_communities; |
Karol Zmyslowski | b2f5a22 | 2023-03-10 19:44:04 +0100 | [diff] [blame] | 244 | case PCI_DEVICE_ID_INTEL_JSL: |
| 245 | *community_count = ARRAY_SIZE(jasperlake_pch_communities); |
| 246 | *pad_stepping = 16; |
| 247 | return jasperlake_pch_communities; |
Kacper Stojek | 76d2b66 | 2022-10-17 14:30:24 +0200 | [diff] [blame] | 248 | case PCI_DEVICE_ID_INTEL_EHL: |
| 249 | *community_count = ARRAY_SIZE(elkhartlake_pch_communities); |
| 250 | *pad_stepping = 16; |
| 251 | return elkhartlake_pch_communities; |
Kacper Stojek | fb9110b | 2022-08-17 10:28:20 +0200 | [diff] [blame] | 252 | |
Nico Huber | 1898023 | 2017-04-07 12:26:07 +0200 | [diff] [blame] | 253 | default: |
Johanna Schander | e32ded8 | 2020-01-29 10:08:17 +0100 | [diff] [blame] | 254 | return NULL; |
Nico Huber | 1898023 | 2017-04-07 12:26:07 +0200 | [diff] [blame] | 255 | } |
Johanna Schander | e32ded8 | 2020-01-29 10:08:17 +0100 | [diff] [blame] | 256 | } |
| 257 | |
| 258 | void print_gpio_groups(struct pci_dev *const sb) |
| 259 | { |
| 260 | size_t community_count; |
| 261 | const struct gpio_community *const *communities; |
| 262 | size_t pad_stepping; |
| 263 | |
| 264 | communities = get_gpio_communities(sb, &community_count, &pad_stepping); |
| 265 | |
| 266 | if (!communities) |
| 267 | return; |
| 268 | |
| 269 | pcr_init(sb); |
Nico Huber | 1898023 | 2017-04-07 12:26:07 +0200 | [diff] [blame] | 270 | |
| 271 | printf("\n============= GPIOS =============\n\n"); |
| 272 | |
| 273 | for (; community_count; --community_count) |
Thomas Heijligen | 725369f | 2019-02-19 10:51:34 +0000 | [diff] [blame] | 274 | print_gpio_community(*communities++, pad_stepping); |
Nico Huber | 1898023 | 2017-04-07 12:26:07 +0200 | [diff] [blame] | 275 | } |