Felix Held has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42224 )
Change subject: soc/amd/common/blocks/gpio: Introduce gpio_get_bar ......................................................................
Patch Set 4:
(2 comments)
https://review.coreboot.org/c/coreboot/+/42224/4/src/soc/amd/common/block/gp... File src/soc/amd/common/block/gpio_banks/gpio.c:
https://review.coreboot.org/c/coreboot/+/42224/4/src/soc/amd/common/block/gp... PS4, Line 86: uint16_t block_offset = GPIO_BLOCK_SIZE * (gpio_num / GPIO_PINS_PER_BLOCK);
I would hope the compiler converts these to shifts. The values are all power of two.
I'd be very surprised if the compiler doesn't turn those into shifts. I also find this easier to read
https://review.coreboot.org/c/coreboot/+/42224/4/src/soc/amd/common/block/gp... PS4, Line 87: uint16_t pin_offset = (gpio_num % GPIO_PINS_PER_BLOCK) * sizeof(uint32_t);
mask/shift instead of module division and multiplication? Unless PSP is fast here? Maybe not worth o […]
it's modulo a power of two constant, which the compiler should recognize as masking bits