Age | Commit message (Collapse) | Author |
|
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>
|
|
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>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
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>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
also, some of them were out of date; years now updated.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
it's only used once, so just do it once.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
253 sloccount on nvmutil.c now, versus 258
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
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>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
handle it exclusively in writeGbeFile()
this reduces nvmutil.c sloccount to 261, versus 265
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
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>
|
|
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>
|
|
use SIZE_4KB << 1 when needing 8KB size
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
use err_if instead
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
it is only used once. use err_if instead.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
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>
|
|
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>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
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>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
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>
|
|
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>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
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>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
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>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
The last bit wasn't being handled, *and* ascii_bit
wasn't being reduced at all.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
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>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
it's currently a build-time option
make it a runtime option instead, so that every
user can optionally make use of it, on all builds
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
thus, there's no need to handle flushing of stdout
whatsoever, and the code can be greatly simplified
ascii bits are still reset, when no input on stdin
is given
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
when spkmodem-recv doesn't receive anything (via stdout)
after a few frames, it's assumed that the console is dead
and the buffered output is flushed
this logic is assumed superfluous when -u is set
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
the logic for *setting* a character, and the logic
for outputting it, ought to be separate. do that.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
my style was: 2 tabs. bsd-style, for extending a line, is
4 spaces. this style has grown on me, so let's do it here
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
my style of C programming is this: always return errno
upon exit from the program, or from a thread.
handle errno in the calling/forking function.
returning errno at the end of main has this intention:
if an unhandled error occured, the program exits with
non-zero status.
a correctly written program should *never* return non-zero
at the end of main, and if it does, this indicates a bug
in the code (per my code style / philosophy).
so, warn the user with a message if this occurs. the
intention is that this message should never be printed.
do not use assert() for this. i don't believe in that.
such a test should always be present, for everyone.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
This version of spkmodem uses err() to indicate an error,
and the value of errno is used as exit status at all times,
even when it is zero.
When calling err(), it is intended that errno always be
non-zero, so modify the code accordingly.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
also be more thorough about errno value when calling
pledge. rename variable in a for loop for clarity.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
when calling fread(), errno may be set to EOVEFLOW if
the range being read will cause an integer overflow
if end-of-file is reached, errno may not be set. when
calling this function, you must check errno or check
feof() - ferror() should also be checked, so this check
is added immediately afterwards in the code
ferror() does not set errno, so ERR() is used to set
errno to ECANCELED as program exit status
further separate reading of frames into a new function
Signed-off-by: Leah Rowe <leah@libreboot.org>
|