Attention is currently required from: Bora Guvendik, Caveh Jalali, Selma Bensaid, Maulik V Vaghela, Subrata Banik, Nick Vaccaro, Patrick Rudolph, Karthik Ramasubramanian. Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/58351 )
Change subject: soc/intel/common: add generic gpio lock mechanism ......................................................................
Patch Set 7:
(2 comments)
File src/soc/intel/common/block/smm/smihandler.c:
https://review.coreboot.org/c/coreboot/+/58351/comment/0786c846_2d10bf7d PS7, Line 333: exit if SoC does not export a list this doesn't look true?
https://review.coreboot.org/c/coreboot/+/58351/comment/e17c0fc9_50fb654c PS7, Line 328: const struct gpio_lock_config *soc_gpios; : const struct gpio_lock_config *mb_gpios; : size_t soc_gpio_num; : size_t mb_gpio_num; : : /* get list of gpios from SoC, exit if SoC does not export a list */ : soc_gpios = soc_gpio_lock_config(&soc_gpio_num); : : /* get list of gpios from mainboard, it's ok if mb does not export a list */ : mb_gpios = mb_gpio_lock_config(&mb_gpio_num); : : /* Lock all mainboard and soc requested gpios */ : gpio_lock_multiple_pads(soc_gpios, soc_gpio_num, mb_gpios, mb_gpio_num); so you could just use malloc() here to allocate a list long enough to store both and not have the awkward API
``` const struct gpio_lock_config *soc_gpios; const struct gpio_lock_config *mb_gpios; size_t soc_gpio_num; size_t mb_gpio_num;
soc_gpios = soc_gpio_lock_config(&soc_gpio_num); mb_gpios = mb_gpio_lock_config(&mb_gpio_num); const size_t total_num = soc_gpio_num + mb_gpio_num; const struct gpio_lock_config *all_gpios = malloc(sizeof(*all_gpios) * total_num);
memcpy(all_gpios, soc_gpios, sizeof(*soc_gpios) * soc_gpio_num); memcpy(all_gpios + soc_gpio_num, mb_gpios, sizeof(*mb_gpios) * mb_gpio_num);
/* Lock all mainboard and soc requested gpios */ gpio_lock_pads(all_gpios, total_num); ```