diff options
author | Elyes Haouas <ehaouas@noos.fr> | 2022-07-16 09:45:39 +0200 |
---|---|---|
committer | Martin L Roth <gaumless@tutanota.com> | 2022-07-17 21:54:55 +0000 |
commit | 558d731a4ccef1877f7edca7356eefd719563845 (patch) | |
tree | 1b5cf998545ad4677ef80c43a968bc8625ea7331 /src/southbridge/amd/agesa/hudson | |
parent | ba9deba362cfed3a2a8d3d65db6333b23f59f4d9 (diff) |
sb/amd/*/*/smbus_spd.c: Fix some white spaces issues
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Change-Id: I47ee16f2d4be34c42b2e7f9fa4c3a72a7a95967f
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65897
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/southbridge/amd/agesa/hudson')
-rw-r--r-- | src/southbridge/amd/agesa/hudson/smbus_spd.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/southbridge/amd/agesa/hudson/smbus_spd.c b/src/southbridge/amd/agesa/hudson/smbus_spd.c index 7dcbbf9a50..c240e5b877 100644 --- a/src/southbridge/amd/agesa/hudson/smbus_spd.c +++ b/src/southbridge/amd/agesa/hudson/smbus_spd.c @@ -16,31 +16,31 @@ * readSmbusByteData - read a single SPD byte from any offset */ -static int readSmbusByteData (int iobase, int address, char *buffer, int offset) +static int readSmbusByteData(int iobase, int address, char *buffer, int offset) { unsigned int status; UINT64 limit; address |= 1; // set read bit - __outbyte (iobase + 0, 0xFF); // clear error status - __outbyte (iobase + 1, 0x1F); // clear error status - __outbyte (iobase + 3, offset); // offset in eeprom - __outbyte (iobase + 4, address); // slave address and read bit - __outbyte (iobase + 2, 0x48); // read byte command + __outbyte(iobase + 0, 0xFF); // clear error status + __outbyte(iobase + 1, 0x1F); // clear error status + __outbyte(iobase + 3, offset); // offset in eeprom + __outbyte(iobase + 4, address); // slave address and read bit + __outbyte(iobase + 2, 0x48); // read byte command // time limit to avoid hanging for unexpected error status (should never happen) - limit = __rdtsc () + 2000000000 / 10; + limit = __rdtsc() + 2000000000 / 10; for (;;) { - status = __inbyte (iobase); - if (__rdtsc () > limit) break; + status = __inbyte(iobase); + if (__rdtsc() > limit) break; if ((status & 2) == 0) continue; // SMBusInterrupt not set, keep waiting if ((status & 1) == 1) continue; // HostBusy set, keep waiting break; } - buffer [0] = __inbyte (iobase + 5); + buffer [0] = __inbyte(iobase + 5); if (status == 2) status = 0; // check for done with no errors return status; } @@ -51,26 +51,26 @@ static int readSmbusByteData (int iobase, int address, char *buffer, int offset) * this function is faster function readSmbusByteData */ -static int readSmbusByte (int iobase, int address, char *buffer) +static int readSmbusByte(int iobase, int address, char *buffer) { unsigned int status; UINT64 limit; - __outbyte (iobase + 0, 0xFF); // clear error status - __outbyte (iobase + 2, 0x44); // read command + __outbyte(iobase + 0, 0xFF); // clear error status + __outbyte(iobase + 2, 0x44); // read command // time limit to avoid hanging for unexpected error status - limit = __rdtsc () + 2000000000 / 10; + limit = __rdtsc() + 2000000000 / 10; for (;;) { - status = __inbyte (iobase); - if (__rdtsc () > limit) break; + status = __inbyte(iobase); + if (__rdtsc() > limit) break; if ((status & 2) == 0) continue; // SMBusInterrupt not set, keep waiting if ((status & 1) == 1) continue; // HostBusy set, keep waiting break; } - buffer [0] = __inbyte (iobase + 5); + buffer [0] = __inbyte(iobase + 5); if (status == 2) status = 0; // check for done with no errors return status; } @@ -84,7 +84,7 @@ static int readSmbusByte (int iobase, int address, char *buffer) * Reads 128 bytes in 7-8 ms at 400 KHz. */ -static int readspd (int iobase, int SmbusSlaveAddress, char *buffer, int count) +static int readspd(int iobase, int SmbusSlaveAddress, char *buffer, int count) { int index, error; @@ -93,7 +93,7 @@ static int readspd (int iobase, int SmbusSlaveAddress, char *buffer, int count) iobase, SmbusSlaveAddress, count); /* read the first byte using offset zero */ - error = readSmbusByteData (iobase, SmbusSlaveAddress, buffer, 0); + error = readSmbusByteData(iobase, SmbusSlaveAddress, buffer, 0); if (error) { printk(BIOS_ERR, "-------------SPD READ ERROR-----------\n"); @@ -103,7 +103,7 @@ static int readspd (int iobase, int SmbusSlaveAddress, char *buffer, int count) /* read the remaining bytes using auto-increment for speed */ for (index = 1; index < count; index++) { - error = readSmbusByte (iobase, SmbusSlaveAddress, &buffer [index]); + error = readSmbusByte(iobase, SmbusSlaveAddress, &buffer [index]); if (error) { printk(BIOS_ERR, "-------------SPD READ ERROR-----------\n"); return error; @@ -115,15 +115,15 @@ static int readspd (int iobase, int SmbusSlaveAddress, char *buffer, int count) return 0; } -static void setupFch (int ioBase) +static void setupFch(int ioBase) { pm_write16(0x2c, ioBase | 1); - __outbyte (ioBase + 0x0E, 66000000 / 400000 / 4); // set SMBus clock to 400 KHz + __outbyte(ioBase + 0x0E, 66000000 / 400000 / 4); // set SMBus clock to 400 KHz } int hudson_readSpd(int spdAddress, char *buf, size_t len) { int ioBase = 0xB00; - setupFch (ioBase); - return readspd (ioBase, spdAddress, buf, len); + setupFch(ioBase); + return readspd(ioBase, spdAddress, buf, len); } |