2022-05-23 02:52:18 +02:00
|
|
|
Intel Pad to Macro (intelp2m) converter
|
|
|
|
=======================================
|
|
|
|
|
2022-05-23 04:11:03 +02:00
|
|
|
This utility allows one to convert the configuration DW0/1 register
|
|
|
|
values from an inteltool dump to coreboot macros.
|
2022-05-23 02:52:18 +02:00
|
|
|
|
|
|
|
```bash
|
2022-05-23 04:11:03 +02:00
|
|
|
cd util/intelp2m
|
|
|
|
make
|
|
|
|
./intelp2m -h
|
|
|
|
./intelp2m -file /path/to/inteltool.log
|
2022-05-23 02:52:18 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
### Platforms
|
|
|
|
|
2022-05-23 04:11:03 +02:00
|
|
|
It is possible to use templates for parsing inteltool.log files.
|
|
|
|
To specify such a pattern, use the option `-t <template number>`.
|
|
|
|
|
|
|
|
```text
|
|
|
|
-t
|
|
|
|
template type number
|
|
|
|
0 - inteltool.log (default)
|
|
|
|
1 - gpio.h
|
|
|
|
2 - your template
|
|
|
|
```
|
|
|
|
|
|
|
|
For example, using template type 1, you can parse gpio.h from an
|
|
|
|
existing board in the coreboot project.
|
|
|
|
|
2022-05-23 02:52:18 +02:00
|
|
|
```bash
|
2022-05-23 04:11:03 +02:00
|
|
|
./intelp2m -t 1 -file coreboot/src/mainboard/yourboard/gpio.h
|
2022-05-23 02:52:18 +02:00
|
|
|
```
|
2022-05-23 04:11:03 +02:00
|
|
|
|
|
|
|
You can also add a template to 'parser/template.go' for your file type
|
|
|
|
with the configuration of the pads.
|
2022-05-23 02:52:18 +02:00
|
|
|
|
|
|
|
platform type is set using the -p option (Sunrise by default):
|
|
|
|
|
2022-05-23 04:11:03 +02:00
|
|
|
```text
|
|
|
|
-p string
|
|
|
|
set up a platform
|
|
|
|
snr - Sunrise PCH with Skylake/Kaby Lake CPU
|
|
|
|
lbg - Lewisburg PCH with Xeon SP CPU
|
|
|
|
apl - Apollo Lake SoC
|
|
|
|
cnl - CannonLake-LP or Whiskeylake/Coffeelake/Cometlake-U SoC
|
|
|
|
adl - AlderLake PCH
|
|
|
|
(default "snr")
|
|
|
|
```
|
|
|
|
|
|
|
|
```bash
|
|
|
|
./intelp2m -p <platform> -file path/to/inteltool.log
|
2022-05-23 02:52:18 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
### Packages
|
|
|
|
|
|
|
|
![][pckgs]
|
|
|
|
|
2022-05-23 04:11:03 +02:00
|
|
|
[pckgs]: gopackages.png
|
2022-05-23 02:52:18 +02:00
|
|
|
|
|
|
|
### Bit fields in macros
|
|
|
|
|
2022-05-23 04:11:03 +02:00
|
|
|
Use the `-fld=cb` option to only generate a sequence of bit fields in
|
|
|
|
a new macro:
|
2022-05-23 02:52:18 +02:00
|
|
|
|
|
|
|
```bash
|
2022-05-23 04:11:03 +02:00
|
|
|
./intelp2m -fld cb -p apl -file ../apollo-inteltool.log
|
2022-05-23 02:52:18 +02:00
|
|
|
```
|
2022-05-23 04:11:03 +02:00
|
|
|
|
2022-05-23 02:52:18 +02:00
|
|
|
```c
|
2022-05-23 04:11:03 +02:00
|
|
|
_PAD_CFG_STRUCT(GPIO_37, PAD_FUNC(NF1) | PAD_TRIG(OFF) | PAD_TRIG(OFF), \
|
|
|
|
PAD_PULL(DN_20K)), /* LPSS_UART0_TXD */
|
2022-05-23 02:52:18 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
### Raw DW0, DW1 register value
|
|
|
|
|
2022-05-23 04:11:03 +02:00
|
|
|
To generate the gpio.c with raw PAD_CFG_DW0 and PAD_CFG_DW1 register
|
|
|
|
values you need to use the -fld=raw option:
|
2022-05-23 02:52:18 +02:00
|
|
|
|
|
|
|
```bash
|
2022-05-23 04:11:03 +02:00
|
|
|
./intelp2m -fld raw -file /path/to/inteltool.log
|
2022-05-23 02:52:18 +02:00
|
|
|
```
|
2022-05-23 04:11:03 +02:00
|
|
|
|
2022-05-23 02:52:18 +02:00
|
|
|
```c
|
|
|
|
_PAD_CFG_STRUCT(GPP_A10, 0x44000500, 0x00000000),
|
|
|
|
```
|
|
|
|
|
|
|
|
```bash
|
2022-05-23 04:11:03 +02:00
|
|
|
./intelp2m -iiii -fld raw -file /path/to/inteltool.log
|
2022-05-23 02:52:18 +02:00
|
|
|
```
|
2022-05-23 04:11:03 +02:00
|
|
|
|
2022-05-23 02:52:18 +02:00
|
|
|
```c
|
|
|
|
/* GPP_A10 - CLKOUT_LPC1 */
|
|
|
|
/* DW0: 0x44000500, DW1: 0x00000000 */
|
|
|
|
/* DW0: 0x04000100 - IGNORED */
|
|
|
|
/* PAD_CFG_NF(GPP_A10, NONE, DEEP, NF1), */
|
|
|
|
_PAD_CFG_STRUCT(GPP_A10, 0x44000500, 0x00000000),
|
|
|
|
```
|
|
|
|
|
|
|
|
### Macro Check
|
|
|
|
|
|
|
|
After generating the macro, the utility checks all used
|
|
|
|
fields of the configuration registers. If some field has been
|
|
|
|
ignored, the utility generates field macros. To not check
|
|
|
|
macros, use the -n option:
|
2022-05-23 04:11:03 +02:00
|
|
|
|
2022-05-23 02:52:18 +02:00
|
|
|
```bash
|
2022-05-23 04:11:03 +02:00
|
|
|
./intelp2m -n -file /path/to/inteltool.log
|
2022-05-23 02:52:18 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
In this case, some fields of the configuration registers
|
|
|
|
DW0 will be ignored.
|
2022-05-23 04:11:03 +02:00
|
|
|
|
2022-05-23 02:52:18 +02:00
|
|
|
```c
|
|
|
|
PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_38, UP_20K, DEEP, NF1, HIZCRx1, DISPUPD),
|
|
|
|
PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE, DISPUPD),
|
|
|
|
```
|
|
|
|
|
|
|
|
### Information level
|
|
|
|
|
|
|
|
The utility can generate additional information about the bit
|
|
|
|
fields of the DW0 and DW1 configuration registers. Using the
|
|
|
|
options -i, -ii, -iii, -iiii you can set the info level from
|
|
|
|
1 to 4:
|
|
|
|
|
|
|
|
```bash
|
2022-05-23 04:11:03 +02:00
|
|
|
./intelp2m -i -file /path/to/inteltool.log
|
2022-05-23 02:52:18 +02:00
|
|
|
```
|
2022-05-23 04:11:03 +02:00
|
|
|
|
2022-05-23 02:52:18 +02:00
|
|
|
```c
|
2022-05-23 04:11:03 +02:00
|
|
|
_PAD_CFG_STRUCT(GPIO_39, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF),\
|
|
|
|
PAD_PULL(UP_20K) | PAD_IOSTERM(DISPUPD)), /* LPSS_UART0_TXD */
|
2022-05-23 02:52:18 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
```bash
|
2022-05-23 04:11:03 +02:00
|
|
|
./intelp2m -ii -file /path/to/inteltool.log
|
|
|
|
./intelp2m -iii -file /path/to/inteltool.log
|
|
|
|
./intelp2m -iiii -file /path/to/inteltool.log
|
2022-05-23 02:52:18 +02:00
|
|
|
```
|
2022-05-23 04:11:03 +02:00
|
|
|
|
2022-05-23 02:52:18 +02:00
|
|
|
```c
|
|
|
|
/* GPIO_39 - LPSS_UART0_TXD */
|
|
|
|
/* DW0: 0x44000400, DW1: 0x00003100 */ --> (ii)
|
|
|
|
/* DW0 : PAD_TRIG(OFF) - IGNORED */ --> (iii)
|
2022-05-23 04:11:03 +02:00
|
|
|
/* PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE,
|
|
|
|
DISPUPD), */ --> (iiii)
|
|
|
|
_PAD_CFG_STRUCT(GPIO_39, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF),
|
|
|
|
PAD_PULL(UP_20K) | PAD_IOSTERM(DISPUPD)),
|
2022-05-23 02:52:18 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
If the -n switch was used and macros was generated without checking:
|
|
|
|
```c
|
|
|
|
/* GPIO_39 - LPSS_UART0_TXD */ --> (i)
|
|
|
|
/* DW0: 0x44000400, DW1: 0x00003100 */ --> (ii)
|
|
|
|
/* DW0: PAD_TRIG(OFF) - IGNORED */ --> (iii)
|
2022-05-23 04:11:03 +02:00
|
|
|
/* _PAD_CFG_STRUCT(GPIO_39, PAD_FUNC(NF1) | PAD_RESET(DEEP) |
|
|
|
|
PAD_TRIG(OFF), PAD_PULL(UP_20K) | PAD_IOSTERM(DISPUPD)), */ --> (iiii)
|
|
|
|
PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE, \
|
|
|
|
DISPUPD),
|
2022-05-23 02:52:18 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
### Ignoring Fields
|
|
|
|
|
|
|
|
Utilities can generate the _PAD_CFG_STRUCT macro and exclude fields
|
|
|
|
from it that are not in the corresponding PAD_CFG_*() macro:
|
|
|
|
|
|
|
|
```bash
|
2022-05-23 04:11:03 +02:00
|
|
|
./intelp2m -iiii -fld cb -ign -file /path/to/inteltool.log
|
2022-05-23 02:52:18 +02:00
|
|
|
```
|
2022-05-23 04:11:03 +02:00
|
|
|
|
2022-05-23 02:52:18 +02:00
|
|
|
```c
|
|
|
|
/* GPIO_39 - LPSS_UART0_TXD */
|
|
|
|
/* DW0: 0x44000400, DW1: 0x00003100 */
|
|
|
|
/* DW0: PAD_TRIG(OFF) - IGNORED */
|
2022-05-23 04:11:03 +02:00
|
|
|
/* PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1,
|
|
|
|
TxLASTRxE, DISPUPD), */
|
|
|
|
_PAD_CFG_STRUCT(GPIO_39, PAD_FUNC(NF1) | PAD_RESET(DEEP), \
|
|
|
|
PAD_PULL(UP_20K) | PAD_IOSTERM(DISPUPD)),
|
2022-05-23 02:52:18 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
### FSP-style macro
|
|
|
|
|
2022-05-23 04:11:03 +02:00
|
|
|
The utility allows one to generate macros that include fsp/edk2-platform
|
|
|
|
style bitfields:
|
2022-05-23 02:52:18 +02:00
|
|
|
|
|
|
|
```bash
|
2022-05-23 04:11:03 +02:00
|
|
|
./intelp2m -i -fld fsp -p lbg -file ../crb-inteltool.log
|
2022-05-23 02:52:18 +02:00
|
|
|
```
|
2022-05-23 04:11:03 +02:00
|
|
|
|
2022-05-23 02:52:18 +02:00
|
|
|
```c
|
2022-05-23 04:11:03 +02:00
|
|
|
{ GPIO_SKL_H_GPP_A12, { GpioPadModeGpio, GpioHostOwnAcpi, GpioDirInInvOut,
|
|
|
|
GpioOutLow, GpioIntSci | GpioIntLvlEdgDis, GpioResetNormal, GpioTermNone,
|
|
|
|
GpioPadConfigLock }, /* GPIO */
|
2022-05-23 02:52:18 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
```bash
|
2022-05-23 04:11:03 +02:00
|
|
|
./intelp2m -iiii -fld fsp -p lbg -file ../crb-inteltool.log
|
2022-05-23 02:52:18 +02:00
|
|
|
```
|
2022-05-23 04:11:03 +02:00
|
|
|
|
2022-05-23 02:52:18 +02:00
|
|
|
```c
|
|
|
|
/* GPP_A12 - GPIO */
|
|
|
|
/* DW0: 0x80880102, DW1: 0x00000000 */
|
|
|
|
/* PAD_CFG_GPI_SCI(GPP_A12, NONE, PLTRST, LEVEL, INVERT), */
|
2022-05-23 04:11:03 +02:00
|
|
|
{ GPIO_SKL_H_GPP_A12, { GpioPadModeGpio, GpioHostOwnAcpi, GpioDirInInvOut,
|
|
|
|
GpioOutLow, GpioIntSci | GpioIntLvlEdgDis, GpioResetNormal, GpioTermNone,
|
|
|
|
GpioPadConfigLock },
|
2022-05-23 02:52:18 +02:00
|
|
|
```
|
|
|
|
|
2022-05-23 04:11:03 +02:00
|
|
|
### Supported Chipsets
|
2022-05-23 02:52:18 +02:00
|
|
|
|
|
|
|
Sunrise PCH, Lewisburg PCH, Apollo Lake SoC, CannonLake-LP SoCs
|