mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 23:22:37 +02:00
Eliminate all 'inline's from the flashrom code
They serve pretty much no purpose, compilers can optimize pretty much all of what we might mark as inline anyway, _and_ inlines are not enforced in any way by the compiler either. They're totally unneeded. Kill them. Corresponding to flashrom svn r522. Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:
parent
2cac6860c3
commit
09e04f74c3
@ -20,8 +20,7 @@
|
||||
|
||||
#include "flash.h"
|
||||
|
||||
static __inline__ int erase_sector_29f040b(chipaddr bios,
|
||||
unsigned long address)
|
||||
static int erase_sector_29f040b(chipaddr bios, unsigned long address)
|
||||
{
|
||||
chip_writeb(0xAA, bios + 0x555);
|
||||
chip_writeb(0x55, bios + 0x2AA);
|
||||
@ -38,10 +37,8 @@ static __inline__ int erase_sector_29f040b(chipaddr bios,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __inline__ int write_sector_29f040b(chipaddr bios,
|
||||
uint8_t *src,
|
||||
chipaddr dst,
|
||||
unsigned int page_size)
|
||||
static int write_sector_29f040b(chipaddr bios, uint8_t *src, chipaddr dst,
|
||||
unsigned int page_size)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
60
flash.h
60
flash.h
@ -104,55 +104,17 @@ struct programmer_entry {
|
||||
|
||||
extern const struct programmer_entry programmer_table[];
|
||||
|
||||
static inline int programmer_init(void)
|
||||
{
|
||||
return programmer_table[programmer].init();
|
||||
}
|
||||
|
||||
static inline int programmer_shutdown(void)
|
||||
{
|
||||
return programmer_table[programmer].shutdown();
|
||||
}
|
||||
|
||||
static inline void *programmer_map_flash_region(const char *descr, unsigned long phys_addr, size_t len)
|
||||
{
|
||||
return programmer_table[programmer].map_flash_region(descr, phys_addr, len);
|
||||
}
|
||||
|
||||
static inline void programmer_unmap_flash_region(void *virt_addr, size_t len)
|
||||
{
|
||||
programmer_table[programmer].unmap_flash_region(virt_addr, len);
|
||||
}
|
||||
|
||||
static inline void chip_writeb(uint8_t val, chipaddr addr)
|
||||
{
|
||||
programmer_table[programmer].chip_writeb(val, addr);
|
||||
}
|
||||
|
||||
static inline void chip_writew(uint16_t val, chipaddr addr)
|
||||
{
|
||||
programmer_table[programmer].chip_writew(val, addr);
|
||||
}
|
||||
|
||||
static inline void chip_writel(uint32_t val, chipaddr addr)
|
||||
{
|
||||
programmer_table[programmer].chip_writel(val, addr);
|
||||
}
|
||||
|
||||
static inline uint8_t chip_readb(const chipaddr addr)
|
||||
{
|
||||
return programmer_table[programmer].chip_readb(addr);
|
||||
}
|
||||
|
||||
static inline uint16_t chip_readw(const chipaddr addr)
|
||||
{
|
||||
return programmer_table[programmer].chip_readw(addr);
|
||||
}
|
||||
|
||||
static inline uint32_t chip_readl(const chipaddr addr)
|
||||
{
|
||||
return programmer_table[programmer].chip_readl(addr);
|
||||
}
|
||||
int programmer_init(void);
|
||||
int programmer_shutdown(void);
|
||||
void *programmer_map_flash_region(const char *descr, unsigned long phys_addr,
|
||||
size_t len);
|
||||
void programmer_unmap_flash_region(void *virt_addr, size_t len);
|
||||
void chip_writeb(uint8_t val, chipaddr addr);
|
||||
void chip_writew(uint16_t val, chipaddr addr);
|
||||
void chip_writel(uint32_t val, chipaddr addr);
|
||||
uint8_t chip_readb(const chipaddr addr);
|
||||
uint16_t chip_readw(const chipaddr addr);
|
||||
uint32_t chip_readl(const chipaddr addr);
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||
|
||||
|
52
flashrom.c
52
flashrom.c
@ -77,6 +77,58 @@ const struct programmer_entry programmer_table[] = {
|
||||
{},
|
||||
};
|
||||
|
||||
int programmer_init(void)
|
||||
{
|
||||
return programmer_table[programmer].init();
|
||||
}
|
||||
|
||||
int programmer_shutdown(void)
|
||||
{
|
||||
return programmer_table[programmer].shutdown();
|
||||
}
|
||||
|
||||
void *programmer_map_flash_region(const char *descr, unsigned long phys_addr,
|
||||
size_t len)
|
||||
{
|
||||
return programmer_table[programmer].map_flash_region(descr,
|
||||
phys_addr, len);
|
||||
}
|
||||
|
||||
void programmer_unmap_flash_region(void *virt_addr, size_t len)
|
||||
{
|
||||
programmer_table[programmer].unmap_flash_region(virt_addr, len);
|
||||
}
|
||||
|
||||
void chip_writeb(uint8_t val, chipaddr addr)
|
||||
{
|
||||
programmer_table[programmer].chip_writeb(val, addr);
|
||||
}
|
||||
|
||||
void chip_writew(uint16_t val, chipaddr addr)
|
||||
{
|
||||
programmer_table[programmer].chip_writew(val, addr);
|
||||
}
|
||||
|
||||
void chip_writel(uint32_t val, chipaddr addr)
|
||||
{
|
||||
programmer_table[programmer].chip_writel(val, addr);
|
||||
}
|
||||
|
||||
uint8_t chip_readb(const chipaddr addr)
|
||||
{
|
||||
return programmer_table[programmer].chip_readb(addr);
|
||||
}
|
||||
|
||||
uint16_t chip_readw(const chipaddr addr)
|
||||
{
|
||||
return programmer_table[programmer].chip_readw(addr);
|
||||
}
|
||||
|
||||
uint32_t chip_readl(const chipaddr addr)
|
||||
{
|
||||
return programmer_table[programmer].chip_readl(addr);
|
||||
}
|
||||
|
||||
void map_flash_registers(struct flashchip *flash)
|
||||
{
|
||||
size_t size = flash->total_size * 1024;
|
||||
|
12
ichspi.c
12
ichspi.c
@ -127,14 +127,14 @@ typedef struct _OPCODES {
|
||||
static OPCODES *curopcodes = NULL;
|
||||
|
||||
/* HW access functions */
|
||||
static inline uint32_t REGREAD32(int X)
|
||||
static uint32_t REGREAD32(int X)
|
||||
{
|
||||
volatile uint32_t regval;
|
||||
regval = *(volatile uint32_t *)((uint8_t *) spibar + X);
|
||||
return regval;
|
||||
}
|
||||
|
||||
static inline uint16_t REGREAD16(int X)
|
||||
static uint16_t REGREAD16(int X)
|
||||
{
|
||||
volatile uint16_t regval;
|
||||
regval = *(volatile uint16_t *)((uint8_t *) spibar + X);
|
||||
@ -146,8 +146,8 @@ static inline uint16_t REGREAD16(int X)
|
||||
#define REGWRITE8(X,Y) (*(uint8_t *)((uint8_t *)spibar+X)=Y)
|
||||
|
||||
/* Common SPI functions */
|
||||
static inline int find_opcode(OPCODES *op, uint8_t opcode);
|
||||
static inline int find_preop(OPCODES *op, uint8_t preop);
|
||||
static int find_opcode(OPCODES *op, uint8_t opcode);
|
||||
static int find_preop(OPCODES *op, uint8_t preop);
|
||||
static int generate_opcodes(OPCODES * op);
|
||||
static int program_opcodes(OPCODES * op);
|
||||
static int run_opcode(OPCODE op, uint32_t offset,
|
||||
@ -192,7 +192,7 @@ OPCODES O_ST_M25P = {
|
||||
|
||||
OPCODES O_EXISTING = {};
|
||||
|
||||
static inline int find_opcode(OPCODES *op, uint8_t opcode)
|
||||
static int find_opcode(OPCODES *op, uint8_t opcode)
|
||||
{
|
||||
int a;
|
||||
|
||||
@ -204,7 +204,7 @@ static inline int find_opcode(OPCODES *op, uint8_t opcode)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline int find_preop(OPCODES *op, uint8_t preop)
|
||||
static int find_preop(OPCODES *op, uint8_t preop)
|
||||
{
|
||||
int a;
|
||||
|
||||
|
13
sst28sf040.c
13
sst28sf040.c
@ -28,7 +28,7 @@
|
||||
#define RESET 0xFF
|
||||
#define READ_ID 0x90
|
||||
|
||||
static __inline__ void protect_28sf040(chipaddr bios)
|
||||
static void protect_28sf040(chipaddr bios)
|
||||
{
|
||||
uint8_t tmp;
|
||||
|
||||
@ -41,7 +41,7 @@ static __inline__ void protect_28sf040(chipaddr bios)
|
||||
tmp = chip_readb(bios + 0x040A);
|
||||
}
|
||||
|
||||
static __inline__ void unprotect_28sf040(chipaddr bios)
|
||||
static void unprotect_28sf040(chipaddr bios)
|
||||
{
|
||||
uint8_t tmp;
|
||||
|
||||
@ -54,8 +54,7 @@ static __inline__ void unprotect_28sf040(chipaddr bios)
|
||||
tmp = chip_readb(bios + 0x041A);
|
||||
}
|
||||
|
||||
static __inline__ int erase_sector_28sf040(chipaddr bios,
|
||||
unsigned long address)
|
||||
static int erase_sector_28sf040(chipaddr bios, unsigned long address)
|
||||
{
|
||||
chip_writeb(AUTO_PG_ERASE1, bios);
|
||||
chip_writeb(AUTO_PG_ERASE2, bios + address);
|
||||
@ -66,10 +65,8 @@ static __inline__ int erase_sector_28sf040(chipaddr bios,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __inline__ int write_sector_28sf040(chipaddr bios,
|
||||
uint8_t *src,
|
||||
chipaddr dst,
|
||||
unsigned int page_size)
|
||||
static int write_sector_28sf040(chipaddr bios, uint8_t *src, chipaddr dst,
|
||||
unsigned int page_size)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -38,8 +38,8 @@
|
||||
#define STATUS_ESS (1 << 6)
|
||||
#define STATUS_WSMS (1 << 7)
|
||||
|
||||
static __inline__ int write_lockbits_49lfxxxc(chipaddr bios, int size,
|
||||
unsigned char bits)
|
||||
static int write_lockbits_49lfxxxc(chipaddr bios, int size,
|
||||
unsigned char bits)
|
||||
{
|
||||
int i, left = size;
|
||||
unsigned long address;
|
||||
@ -65,8 +65,7 @@ static __inline__ int write_lockbits_49lfxxxc(chipaddr bios, int size,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __inline__ int erase_sector_49lfxxxc(chipaddr bios,
|
||||
unsigned long address)
|
||||
static int erase_sector_49lfxxxc(chipaddr bios, unsigned long address)
|
||||
{
|
||||
unsigned char status;
|
||||
|
||||
@ -85,10 +84,8 @@ static __inline__ int erase_sector_49lfxxxc(chipaddr bios,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __inline__ int write_sector_49lfxxxc(chipaddr bios,
|
||||
uint8_t *src,
|
||||
chipaddr dst,
|
||||
unsigned int page_size)
|
||||
static int write_sector_49lfxxxc(chipaddr bios, uint8_t *src, chipaddr dst,
|
||||
unsigned int page_size)
|
||||
{
|
||||
int i;
|
||||
unsigned char status;
|
||||
|
Loading…
x
Reference in New Issue
Block a user