summaryrefslogtreecommitdiff
path: root/util
AgeCommit message (Collapse)Author
2024-05-01dell_flash_unlock: Add support for FreeBSDNicholas Chin
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-05-01dell_flash_unlock: Set iopl level back to 0 when doneNicholas Chin
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-05-01dell_flash_unlock: Fix ec_set_fdo() signatureNicholas Chin
Set argument list as void. Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-04-28dell-flash-unlock: Remove unnecessary includes for NetBSDNicholas Chin
The pio.h header, although present on NetBSD, is not necessary, as it only declares x86 port IO inx()/outx() functions which are not actually implemented. Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-04-28dell-flash-unlock: Remove memory clobber from inline assemblyNicholas Chin
The x86 port IO instructions do not access memory so it is not needed in the clobber list. Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-04-26Merge pull request 'dell-flash-unlock: add NetBSD support' (#194) from ↵Leah Rowe
linear/lbmk:master into master Reviewed-on: https://codeberg.org/libreboot/lbmk/pulls/194
2024-03-18util: Import autoport with Haswell patchesNicholas Chin
This is a copy of coreboot's autoport utility, with a patch applied to support Haswell/Lynx Point platforms. That patch is currently in review on coreboot's Gerrit. https://review.coreboot.org/c/coreboot/+/30890 Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-03-16dell-flash-unlock: add NetBSD supportlinear cannon
2024-01-27remove remaining flashrom remnants (use flashprog)Leah Rowe
we use flashprog now! Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-05README.md: Add Latitude E7270 as supportedNicholas Chin
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-01-05README.md: Add notes about iopl and AC adapter requirementNicholas Chin
In order for the EC to maintain the state of whether or not to set the flash descriptor override across a power cycle, the AC adapter must be connected, as the system leaves the voltage rail that the EC uses powered under this condition. Without this, the utility may fail, continually asking the user to power off and on. On Linux, CONFIG_X86_IOPL_IOPERM must be set for the kernel, or else the iopl call will error with "Function not implemented". Make a note of this in case a user runs into this issue. Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-01-05README.md: List E6520, E5530, and M4800 as supportedNicholas Chin
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2023-12-17README.md: Add possibly not working systemsNicholas Chin
These systems have a report that the unlock utility does not work. Until there are multiple reports of failed unlocks and a technical determination of why it doesn't work, they will not be listed as explicitly unsupported.
2023-12-17README.md: Add E6500, E6420, and E6530 as supportedNicholas Chin
2023-12-17README.md: Add instructions for relaxing memory permissionsNicholas Chin
As this utility requires access to /dev/mem, the default protections of Linux and OpenBSD must be relaxed to allow this. Make a note of this in the instructions.
2023-12-17README.md: Add references to Open Security TrainingNicholas Chin
The old Open Security Training site had a course called Advanced x86: BIOS and SMM Internals, which had a set of slides outlining the method to supress SMIs by changing the GBL_SMI_EN bit. Add a reference to it as this is where I originally learned of this method.
2023-11-06nvmutil: print usageRiku Viitanen
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-11-06nvmutil: fix makefileRiku Viitanen
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-11-06nvmutil: make installRiku Viitanen
make install is nice to have. now respects$(PREFIX) as well. Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-10-17util/spkmodem-recv: detailed copyright historyLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-12util/e6400-flash-unlock: Rename to dell-flash-unlockNicholas Chin
This more accurately describes the scope of the utility. Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2023-10-12nvmutil: simplify endianness handlingLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-12nvmutil: don't reset errno before writeLeah Rowe
under the current logic, errno would be ECANCELED if neither checksum is valid, or I/O related if pwrite fails; alternatively, the for loop exits and the file has been written, where it is quite correctly reset already. ergo, the errno reset at the start of writeGbeFile is superfluous. remove this bloat. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-12nvmutil: reset errno on successful writeLeah Rowe
previously, a bad checksum would have caused a non-zero exit, even if the other checksum was correct (observed when using the swap command) Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-12nvmutil: simplify prototype declarationsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-09util/e6400-flash-unlock: Update to upstream versionNicholas Chin
This updates lbmk's copy of e6400-flash-unlock to commit c5567fece479 (README.md: Update with info about broader device support) in my upstream repo. Changes: - Theoretical support for any Dell system that implements that flash descriptor override command. This is done by reading base address registers at runtime instead of hard coding them for specific devices. Tested on the Latitude E6400 and Latitude E6430. - Support for OpenBSD. It compiles, runs, and behaves as expected, though I have not actually tested internally flashing with flashrom yet. It should work though, as the program checks if the descriptor override is set and the BIOS Write Enable is able to be set to 1, which is all that is needed to internal flash. - Integrated changes made in the lbmk copy - Moved operating system accessor implementations to their own file It should be fully functional, though minor formatting and cleanup changes are still planned. Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2023-09-25util/: use SPDX license and copyright headersLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-25Update email address for Leah Rowe copyrightsLeah Rowe
also, some of them were out of date; years now updated. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-19util/nvmutil: remove xorswap() macroLeah Rowe
it's only used once, so just do it once. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-19util/nvmutil: make setWord a macroLeah Rowe
253 sloccount on nvmutil.c now, versus 258 Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-19util/nvmutil: further optimise swap commandLeah Rowe
don't swap pointers at all. handle it in the for loop. 258 sloccount now, versus 261. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-19util/nvmutil: use correct comparisons on pointersLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-19util/nvmutil: optimise swap commandLeah Rowe
handle it exclusively in writeGbeFile() this reduces nvmutil.c sloccount to 261, versus 265 Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-18util/nvmutil: don't use err_if on argc checkLeah Rowe
at this stage in the code, the file name will be NULL value, so it would be improper to use it in a string. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-18util/nvmutil: always print filename in err_ifLeah Rowe
the previous code size optimisations removed mention of the file name, on file-related err() calls. almost every error the user runs across will be file related, so put the path on err() called from err_if() Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-18util/nvmutil: remove SIZE_8KB defineLeah Rowe
use SIZE_4KB << 1 when needing 8KB size Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-18util/nvmutil: remove xpread/xpwrite macrosLeah Rowe
use err_if instead Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-18util/nvmutil: remove unnecessary xclose macroLeah Rowe
it is only used once. use err_if instead. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-18util/nvmutil: simplify pledge and unveil handlingLeah Rowe
there is no need to have these as defines, when err_if exists; get rid of xunveil and xpledge. use the bare pledge and unveil functions directly, with err_if(). 268 sloccount now on nvmutil.c, versus 289 sloccount before this change, with no loss of functionality. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-05util/nvmutil: put code all in nvmutil.cLeah Rowe
it doesn't really make sense to have nvmutil.h since this is only a very small program and not intended for use as a library Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-04move me7_update_parser.py to util/Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-03ich9m mainboards: use pre-assembled ifd/gbe filesLeah Rowe
This cuts down on build time, and it will allow libreboot to remove large chunks of code. these ifd/gbe configs are just binary-encoded config files, in a format well-understood. they can easily be opened up and displayed, using ich9show or ifdtool, and manipulated by these tools; bincfg can generate them from scratch, and nvmutil can change mac addresses, for example. so, do this and remove from lbmk the following: * ich9utils (which contains ich9gen) - not needed anymore * code in lbmk for handling ich9gen and insertions; the coreboot build system is now used, for this same purpose, so remove such code from lbmk this results in a massive code size reduction (thousands of lines) in lbmk; smaller when only looking at the build system, but much larger when you consider that ich9utils is also removed (about 3k sloc) Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-06-14util/nvmutil: reduced indentation inside loopLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-06-14util/spkmodem-recv: rename function for clarityLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-06-13util/spkmodem-recv: remove unnecessary error checkLeah Rowe
the loop in main() already checks EOF, and errno is properly handled at the end of main() we only need to call ferror(), to check error state this fixes a bogus error message when pressing ctrl+D to terminate the program, *which is the intended way to terminate this program* (that, or EOF is reached in any other another way) do not treat intended behaviour as an error condition! Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-06-13util/spkmodem-recv: say cc, not gcc, in commentLeah Rowe
i've build-tested this code with clang and that also works. in practise, a user is going to have clang or gcc Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-06-13util/spkmodem-recv: fix bad commentLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-06-13util/spkmodem-recv: remove unnecessary assignmentLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-06-13util/spkmodem-recv: simplify getopt handlingLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-06-13util/spkmodem-recv: cleaner ring buffer handlingLeah Rowe
make it more obvious that this *is* a ring buffer being handled, and make it more obvious when checking a pulse in the next frame Signed-off-by: Leah Rowe <leah@libreboot.org>