device/mmio: Make buffer_to_fifo32() take a const buffer

The input buffer to the buffer_to_fifo family of functions is only read,
so it can be a const pointer. (Also, remove the MIPS check in libpayload
for these functions... the MIPS architecture has been removed a while
ago.)

Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I021069680cf691590fdacc3d51f747f12ae3df31
Reviewed-on: https://review.coreboot.org/c/coreboot/+/57731
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
This commit is contained in:
Julius Werner 2021-09-16 15:53:32 -07:00 committed by Felix Held
parent 1c8e8b259d
commit ea03d0047b
4 changed files with 8 additions and 12 deletions

View File

@ -472,18 +472,16 @@ static inline int __ffs64(u64 x) { return log2_64(x & (u64)(-(s64)x)); }
* @defgroup mmio MMIO helper functions
* @{
*/
#if !CONFIG(LP_ARCH_MIPS)
void buffer_from_fifo32(void *buffer, size_t size, void *fifo,
int fifo_stride, int fifo_width);
void buffer_to_fifo32_prefix(void *buffer, u32 prefix, int prefsz, size_t size,
void buffer_to_fifo32_prefix(const void *buffer, u32 prefix, int prefsz, size_t size,
void *fifo, int fifo_stride, int fifo_width);
static inline void buffer_to_fifo32(void *buffer, size_t size, void *fifo,
static inline void buffer_to_fifo32(const void *buffer, size_t size, void *fifo,
int fifo_stride, int fifo_width)
{
buffer_to_fifo32_prefix(buffer, 0, 0, size, fifo,
fifo_stride, fifo_width);
}
#endif
/** @} */
/**

View File

@ -126,7 +126,6 @@ char *getenv(const char *name)
return NULL;
}
#if !CONFIG(LP_ARCH_MIPS)
/*
* Reads a transfer buffer from 32-bit FIFO registers. fifo_stride is the
* distance in bytes between registers (e.g. pass 4 for a normal array of 32-bit
@ -156,10 +155,10 @@ void buffer_from_fifo32(void *buffer, size_t size, void *fifo,
* bytes of the 'prefix' u32 parameter and any high-order bytes exceeding prefsz
* must be 0. Note that 'size' counts total bytes written, including 'prefsz'.
*/
void buffer_to_fifo32_prefix(void *buffer, u32 prefix, int prefsz, size_t size,
void buffer_to_fifo32_prefix(const void *buffer, u32 prefix, int prefsz, size_t size,
void *fifo, int fifo_stride, int fifo_width)
{
u8 *p = buffer;
const u8 *p = buffer;
int i, j = prefsz;
assert(fifo_width > 0 && fifo_width <= sizeof(u32) &&
@ -175,4 +174,3 @@ void buffer_to_fifo32_prefix(void *buffer, u32 prefix, int prefsz, size_t size,
}
}
#endif

View File

@ -21,10 +21,10 @@ void buffer_from_fifo32(void *buffer, size_t size, void *fifo,
}
}
void buffer_to_fifo32_prefix(void *buffer, u32 prefix, int prefsz, size_t size,
void buffer_to_fifo32_prefix(const void *buffer, u32 prefix, int prefsz, size_t size,
void *fifo, int fifo_stride, int fifo_width)
{
u8 *p = buffer;
const u8 *p = buffer;
int i, j = prefsz;
assert(fifo_width > 0 && fifo_width <= sizeof(u32) &&

View File

@ -42,7 +42,7 @@ void buffer_from_fifo32(void *buffer, size_t size, void *fifo,
* bytes of the 'prefix' u32 parameter and any high-order bytes exceeding prefsz
* must be 0. Note that 'size' counts total bytes written, including 'prefsz'.
*/
void buffer_to_fifo32_prefix(void *buffer, u32 prefix, int prefsz, size_t size,
void buffer_to_fifo32_prefix(const void *buffer, u32 prefix, int prefsz, size_t size,
void *fifo, int fifo_stride, int fifo_width);
/*
@ -51,7 +51,7 @@ void buffer_to_fifo32_prefix(void *buffer, u32 prefix, int prefsz, size_t size,
* registers or 0 to write everything into the same register). fifo_width is
* the amount of bytes written per register (can be 1 through 4).
*/
static inline void buffer_to_fifo32(void *buffer, size_t size, void *fifo,
static inline void buffer_to_fifo32(const void *buffer, size_t size, void *fifo,
int fifo_stride, int fifo_width)
{
buffer_to_fifo32_prefix(buffer, 0, 0, size, fifo,