Commit Graph

217 Commits (4a9fca57f377349ee03cdf51afcc90ab2910a698)

Author SHA1 Message Date
Leah Rowe 77770f5ad8 remove remaining flashrom remnants (use flashprog)
we use flashprog now!

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-27 22:37:39 +00:00
Nicholas Chin bdd32a5c7f
README.md: Add Latitude E7270 as supported
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-01-05 14:53:33 -07:00
Nicholas Chin 051b17f4fe
README.md: Add notes about iopl and AC adapter requirement
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-05 14:48:38 -07:00
Nicholas Chin d2de03cefa
README.md: List E6520, E5530, and M4800 as supported
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-01-05 14:48:37 -07:00
Nicholas Chin d207e9bc45
README.md: Add possibly not working systems
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-17 19:38:23 -07:00
Nicholas Chin ab59f9128c
README.md: Add E6500, E6420, and E6530 as supported 2023-12-17 19:38:23 -07:00
Nicholas Chin ca28255db8
README.md: Add instructions for relaxing memory permissions
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-17 19:38:23 -07:00
Nicholas Chin f481908135
README.md: Add references to Open Security Training
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-12-17 19:38:16 -07:00
Riku Viitanen 866087211f nvmutil: print usage
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-11-06 13:07:36 +02:00
Riku Viitanen f12f5c3aee nvmutil: fix makefile
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-11-06 12:53:14 +02:00
Riku Viitanen 9184940f34 nvmutil: make install
make install is nice to have. now respects$(PREFIX) as well.

Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-11-06 01:06:16 +02:00
Leah Rowe 4cdf60e60a util/spkmodem-recv: detailed copyright history
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-17 13:55:20 +01:00
Nicholas Chin 5d6946c42c
util/e6400-flash-unlock: Rename to dell-flash-unlock
This more accurately describes the scope of the utility.

Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2023-10-12 17:57:06 -06:00
Leah Rowe 1f3316422d nvmutil: simplify endianness handling
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-12 15:55:51 +01:00
Leah Rowe 3162d60d52 nvmutil: don't reset errno before write
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-12 15:22:13 +01:00
Leah Rowe f989360e88 nvmutil: reset errno on successful write
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-12 15:17:47 +01:00
Leah Rowe 3ad171fd3d nvmutil: simplify prototype declarations
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-12 15:10:50 +01:00
Nicholas Chin 724cb39f86
util/e6400-flash-unlock: Update to upstream version
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-10-09 23:16:18 -06:00
Leah Rowe b727f9666b util/: use SPDX license and copyright headers
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-25 02:49:34 +01:00
Leah Rowe 208620198c Update email address for Leah Rowe copyrights
also, some of them were out of date; years now updated.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-25 02:27:26 +01:00
Leah Rowe 905f3d8e7b util/nvmutil: remove xorswap() macro
it's only used once, so just do it once.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-19 16:51:37 +01:00
Leah Rowe 231015ef89 util/nvmutil: make setWord a macro
253 sloccount on nvmutil.c now, versus 258

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-19 16:18:13 +01:00
Leah Rowe d9bed11501 util/nvmutil: further optimise swap command
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-19 16:05:34 +01:00
Leah Rowe 5e8013601a util/nvmutil: use correct comparisons on pointers
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-19 16:01:26 +01:00
Leah Rowe 137a548b04 util/nvmutil: optimise swap command
handle it exclusively in writeGbeFile()

this reduces nvmutil.c sloccount to 261, versus 265

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-19 15:56:55 +01:00
Leah Rowe 4d44820163 util/nvmutil: don't use err_if on argc check
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-18 16:48:26 +01:00
Leah Rowe 0897a0be17 util/nvmutil: always print filename in err_if
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-18 16:42:49 +01:00
Leah Rowe 9a92524a47 util/nvmutil: remove SIZE_8KB define
use SIZE_4KB << 1 when needing 8KB size

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-18 16:36:45 +01:00
Leah Rowe 5a129cea11 util/nvmutil: remove xpread/xpwrite macros
use err_if instead

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-18 16:32:37 +01:00
Leah Rowe ac0e49996a util/nvmutil: remove unnecessary xclose macro
it is only used once. use err_if instead.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-18 16:26:03 +01:00
Leah Rowe 83e6cfb294 util/nvmutil: simplify pledge and unveil handling
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-18 15:50:44 +01:00
Leah Rowe e3b9dfc959 util/nvmutil: put code all in nvmutil.c
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-05 15:24:21 +01:00
Leah Rowe 2c769dc136 move me7_update_parser.py to util/
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-04 03:24:46 +01:00
Leah Rowe 19efdf9eeb ich9m mainboards: use pre-assembled ifd/gbe files
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-09-03 22:40:33 +01:00
Leah Rowe c285dbd372 util/nvmutil: reduced indentation inside loop
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-06-14 10:56:11 +01:00
Leah Rowe b508245451 util/spkmodem-recv: rename function for clarity
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-06-14 08:43:54 +01:00
Leah Rowe 17cd0af9c1 util/spkmodem-recv: remove unnecessary error check
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-13 22:52:12 +01:00
Leah Rowe a1758a7ab0 util/spkmodem-recv: say cc, not gcc, in comment
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-13 22:35:34 +01:00
Leah Rowe 2b5727310c util/spkmodem-recv: fix bad comment
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-06-13 22:34:31 +01:00
Leah Rowe bd8b8919f9 util/spkmodem-recv: remove unnecessary assignment
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-06-13 22:29:34 +01:00
Leah Rowe 5be3d67ced util/spkmodem-recv: simplify getopt handling
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-06-13 21:01:15 +01:00
Leah Rowe 5c5c1c64fd util/spkmodem-recv: cleaner ring buffer handling
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>
2023-06-13 20:47:17 +01:00
Leah Rowe f257eb6f9d remove errant file
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-06-13 12:11:56 +01:00
Leah Rowe b52a7f4f86 util/spkmodem-recv: re-add full license header
i forked spkmodem-recv from coreboot, who forked it from
gnu grub. gnu grub's version has the full header, with
copyright declared as belonging to the fsf

coreboot made changes after forking it, and later replaced
the license declaration with an equivalent SPDX header, but
they also removed the FSF's copyright declaration, which by
itself does not void the declaration

anyway, i just feel better re-adding the full declaration.
make it so!

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-06-12 23:37:58 +01:00
Leah Rowe 7ca9b98766 util/ich9gen: change default mac address
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-06-12 23:02:30 +01:00
Leah Rowe dee8f44b37 util/spkmodem-recv: fix regression
The last bit wasn't being handled, *and* ascii_bit
wasn't being reduced at all.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-06-08 12:35:36 +01:00
Leah Rowe f2822db9dd util/spkmodem-recv: make ringpos a global variable
there's no point passing it as argument to a
function. it's used across more than one function,
so make it global

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-06-05 15:38:36 +01:00
Leah Rowe 334bfedfd4 util/spkmodem-recv: simplify sample_cnt/char reset
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-06-05 02:05:36 +01:00
Leah Rowe 4a6b582777 util/spkmodem-recv: print stats in other function
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-06-05 01:57:20 +01:00
Leah Rowe 2652a1ddfa util/spkmodem-recv: only print unhandled err on -d
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-06-05 01:53:24 +01:00