Commit 3771495b authored by Jeb J. Cramer's avatar Jeb J. Cramer Committed by Jeff Garzik

[E1000] Read/Write register macro optimizations

* Optimized E1000_*_REG macros
parent f4630b19
...@@ -77,24 +77,22 @@ typedef enum { ...@@ -77,24 +77,22 @@ typedef enum {
#define E1000_WRITE_REG(a, reg, value) ( \ #define E1000_WRITE_REG(a, reg, value) ( \
((a)->mac_type >= e1000_82543) ? \ writel((value), ((a)->hw_addr + \
(writel((value), ((a)->hw_addr + E1000_##reg))) : \ (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg))))
(writel((value), ((a)->hw_addr + E1000_82542_##reg))))
#define E1000_READ_REG(a, reg) ( \ #define E1000_READ_REG(a, reg) ( \
((a)->mac_type >= e1000_82543) ? \ readl((a)->hw_addr + \
readl((a)->hw_addr + E1000_##reg) : \ (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg)))
readl((a)->hw_addr + E1000_82542_##reg))
#define E1000_WRITE_REG_ARRAY(a, reg, offset, value) ( \ #define E1000_WRITE_REG_ARRAY(a, reg, offset, value) ( \
((a)->mac_type >= e1000_82543) ? \ writel((value), ((a)->hw_addr + \
writel((value), ((a)->hw_addr + E1000_##reg + ((offset) << 2))) : \ (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
writel((value), ((a)->hw_addr + E1000_82542_##reg + ((offset) << 2)))) ((offset) << 2))))
#define E1000_READ_REG_ARRAY(a, reg, offset) ( \ #define E1000_READ_REG_ARRAY(a, reg, offset) ( \
((a)->mac_type >= e1000_82543) ? \ readl((a)->hw_addr + \
readl((a)->hw_addr + E1000_##reg + ((offset) << 2)) : \ (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
readl((a)->hw_addr + E1000_82542_##reg + ((offset) << 2))) ((offset) << 2)))
#define E1000_WRITE_FLUSH(a) E1000_READ_REG(a, STATUS) #define E1000_WRITE_FLUSH(a) E1000_READ_REG(a, STATUS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment