Showing with 47 additions and 9 deletions.
  1. +9 −1 CHANGELOG.md
  2. +3 −0 README.md
  3. +35 −8 sortbootorder.c
10 changes: 9 additions & 1 deletion CHANGELOG.md
Expand Up @@ -7,6 +7,13 @@ Releases 4.5.x and 4.6.x are based on mainline support submitted in
[this gerrit ref](https://review.coreboot.org/#/c/14138/).

## [Unreleased]
## [v4.6.16] - 2019-12-30
### Added
- IOMMU runtime configuration

### Fixed
- top banner displays the correct board name

## [v4.6.15] - 2019-07-05
### Fixed
- incorrect IF conditions in SPI lock menu
Expand Down Expand Up @@ -172,7 +179,8 @@ initial commit based on [coreboot_140908](http://pcengines.ch/tmp/coreboot_14090
### Fixed
- used proper way to access extended SPI registers

[Unreleased]: https://github.com/pcengines/sortbootorder/compare/v4.6.15...master
[Unreleased]: https://github.com/pcengines/sortbootorder/compare/v4.6.16...master
[v4.6.16]: https://github.com/pcengines/sortbootorder/compare/v4.6.15...v4.6.16
[v4.6.15]: https://github.com/pcengines/sortbootorder/compare/v4.6.14...v4.6.15
[v4.6.14]: https://github.com/pcengines/sortbootorder/compare/v4.6.13...v4.6.14
[v4.6.13]: https://github.com/pcengines/sortbootorder/compare/v4.6.12...v4.6.13
Expand Down
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -51,6 +51,7 @@ saves boot order in flash.
m Force mPCIe2 slot CLK (GPP3 PCIe) - Currently Disabled
h EHCI0 controller - Currently Disabled
l Core Performance Boost - Currently Enabled
v IOMMU - Currently Disabled
w Enable BIOS write protect - Currently Disabled
x Exit setup without save
s Save configuration and exit
Expand Down Expand Up @@ -90,6 +91,7 @@ key.
**watchdog later. Too low value may result in a reset loop!**
* `j SD 3.0 mode` - enable SD controller in 3.0 mode to allow achieving full
speeds with UHS-I SD cards
* `v IOMMU` - enables/disables input–output memory management unit
* `w Enable BIOS write protect` - enables/disables BIOS WP functionality. For
details, see descritption in [BIOS WP option](#bios-wp-option).
* `x Exit setup without save` - exits setup menu without saving the settings
Expand Down Expand Up @@ -171,6 +173,7 @@ file is used to match device letter and description with corresponding node from
Core Performance Boost - Enabled
Watchdog - Disabled
SD 3.0 mode - Disabled
IOMMU - Disabled
Redirect console output to COM2 - Disabled
BIOS write protect - Disabled
```
Expand Down
43 changes: 35 additions & 8 deletions sortbootorder.c
Expand Up @@ -93,13 +93,15 @@ static u8 ehci0_toggle;
static u8 mpcie2_clk_toggle;
static u8 boost_toggle;
static u8 sd3_toggle;
#ifndef COREBOOT_LEGACY
static u8 iommu_toggle;
#endif
static u16 wdg_timeout;
#endif

static u8 uartc_toggle;
static u8 uartd_toggle;


static char bootlist_def[MAX_DEVICES][MAX_LENGTH];
static char bootlist_map[MAX_DEVICES][MAX_LENGTH];
static char id[MAX_DEVICES] = {0};
Expand Down Expand Up @@ -131,6 +133,8 @@ int main(void) {
struct cbfs_handle *bootorder_handle;
#endif

lib_get_sysinfo();

// Set to enabled because enable toggle is not (yet) implemented for these devices
device_toggle[SDCARD] = 1;
device_toggle[MSATA] = 1;
Expand All @@ -143,11 +147,11 @@ int main(void) {
noecho(); /* don't echo keystrokes */
#endif

#ifdef TARGET_APU1
printf("\n### PC Engines apu1 setup %s ###\n", SORTBOOTORDER_VER);
#else
printf("\n### PC Engines apu2 setup %s ###\n", SORTBOOTORDER_VER);
#endif
u8 *apu_id_string = lib_sysinfo.mainboard->strings +
lib_sysinfo.mainboard->part_number_idx;
printf("\n### PC Engines %s setup %s ###\n", apu_id_string,
SORTBOOTORDER_VER);


if (init_flash()) {
printf("Can't initialize flash device!\n");
Expand Down Expand Up @@ -213,7 +217,11 @@ int main(void) {
token = strstr(bootorder_data, "sd3mode");
token += strlen("sd3mode");
sd3_toggle = token ? strtoul(token, NULL, 10) : 0;

#ifndef COREBOOT_LEGACY
token = strstr(bootorder_data, "iommu");
token += strlen("iommu");
iommu_toggle = token ? strtoul(token, NULL, 10) : 0;
#endif
token = strstr(bootorder_data, "watchdog");
token += strlen("watchdog");
wdg_timeout = token ? (u16) strtoul(token, NULL, 16) : 0;
Expand Down Expand Up @@ -298,6 +306,12 @@ int main(void) {
case 'J':
sd3_toggle ^= 0x1;
break;
#ifndef COREBOOT_LEGACY
case 'v':
case 'V':
iommu_toggle ^= 0x1;
break;
#endif
case 'Q':
handle_spi_lock_menu();
break;
Expand Down Expand Up @@ -434,6 +448,10 @@ static void show_boot_device_list(char buffer[MAX_DEVICES][MAX_LENGTH],
(wdg_timeout) ? "Enabled" : "Disabled");
printf(" j SD 3.0 mode - Currently %s\n",
(sd3_toggle) ? "Enabled" : "Disabled");
#ifndef COREBOOT_LEGACY
printf(" v IOMMU - Currently %s\n",
(iommu_toggle) ? "Enabled" : "Disabled");
#endif
#endif
printf(" w Enable BIOS write protect - Currently %s\n",
(spi_wp_toggle) ? "Enabled" : "Disabled");
Expand Down Expand Up @@ -606,6 +624,9 @@ static void update_tags(char bootlist[MAX_DEVICES][MAX_LENGTH], u8 *max_lines)
update_tag_value(bootlist, max_lines, "ehcien", ehci0_toggle + '0');
update_tag_value(bootlist, max_lines, "boosten", boost_toggle + '0');
update_tag_value(bootlist, max_lines, "sd3mode", sd3_toggle + '0');
#ifndef COREBOOT_LEGACY
update_tag_value(bootlist, max_lines, "iommu", iommu_toggle + '0');
#endif
update_wdg_timeout(bootlist, max_lines, wdg_timeout);
#endif
}
Expand Down Expand Up @@ -672,7 +693,13 @@ static void refresh_tag_values(u8 max_lines)
token += strlen("sd3mode");
sd3_toggle = strtoul(token, NULL, 10);
}

#ifndef COREBOOT_LEGACY
token = strstr(&(bootlist_def[i][0]), "iommu");
if(token) {
token += strlen("iommu");
iommu_toggle = strtoul(token, NULL, 10);
}
#endif
token = strstr(&(bootlist_def[i][0]), "watchdog");
if(token) {
token += strlen("watchdog");
Expand Down