diff options
Diffstat (limited to 'src/include/device')
-rw-r--r-- | src/include/device/device.h | 3 | ||||
-rw-r--r-- | src/include/device/smbus.h | 63 |
2 files changed, 23 insertions, 43 deletions
diff --git a/src/include/device/device.h b/src/include/device/device.h index 167a518f2a..253ec97d43 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -33,6 +33,7 @@ struct device_operations { void (*init)(device_t dev); unsigned int (*scan_bus)(device_t bus, unsigned int max); void (*enable)(device_t dev); + void (*set_link)(device_t dev, unsigned int link); const struct pci_operations *ops_pci; const struct smbus_bus_operations *ops_smbus_bus; const struct pci_bus_operations *ops_pci_bus; @@ -50,7 +51,7 @@ struct bus { }; #define MAX_RESOURCES 12 -#define MAX_LINKS 4 +#define MAX_LINKS 8 /* * There is one device structure for each slot-number/function-number * combination: diff --git a/src/include/device/smbus.h b/src/include/device/smbus.h index 40e49eefae..148c4d7785 100644 --- a/src/include/device/smbus.h +++ b/src/include/device/smbus.h @@ -21,50 +21,29 @@ struct smbus_bus_operations { int (*block_write) (device_t dev, uint8_t cmd, uint8_t bytes, const uint8_t *buffer); }; -static inline int smbus_quick_read(device_t dev) +static inline const struct smbus_bus_operations *ops_smbus_bus(struct bus *bus) { - return dev->bus->dev->ops->ops_smbus_bus->quick_read(dev); -} -static inline int smbus_quick_write(device_t dev) -{ - return dev->bus->dev->ops->ops_smbus_bus->quick_write(dev); -} -static inline int smbus_recv_byte(device_t dev) -{ - return dev->bus->dev->ops->ops_smbus_bus->recv_byte(dev); -} -static inline int smbus_send_byte(device_t dev, uint8_t byte) -{ - return dev->bus->dev->ops->ops_smbus_bus->send_byte(dev, byte); -} -static inline int smbus_read_byte(device_t dev, uint8_t addr) -{ - return dev->bus->dev->ops->ops_smbus_bus->read_byte(dev, addr); -} -static inline int smbus_write_byte(device_t dev, uint8_t addr, uint8_t val) -{ - return dev->bus->dev->ops->ops_smbus_bus->write_byte(dev, addr, val); -} -static inline int smbus_read_word(device_t dev, uint8_t addr) -{ - return dev->bus->dev->ops->ops_smbus_bus->read_word(dev, addr); -} -static inline int smbus_write_word(device_t dev, uint8_t addr, uint16_t val) -{ - return dev->bus->dev->ops->ops_smbus_bus->write_word(dev, addr, val); -} -static inline int smbus_process_call(device_t dev, uint8_t cmd, uint16_t data) -{ - return dev->bus->dev->ops->ops_smbus_bus->process_call(dev, cmd, data); -} -static inline int smbus_block_read(device_t dev, uint8_t cmd, uint8_t bytes, uint8_t *buffer) -{ - return dev->bus->dev->ops->ops_smbus_bus->block_read(dev, cmd, bytes, buffer); -} -static inline int smbus_block_write(device_t dev, uint8_t cmd, uint8_t bytes, const uint8_t *buffer) -{ - return dev->bus->dev->ops->ops_smbus_bus->block_write(dev, cmd, bytes, buffer); + const struct smbus_bus_operations *bops; + bops = 0; + if (bus && bus->dev && bus->dev->ops) { + bops = bus->dev->ops->ops_smbus_bus; + } + return bops; } +struct bus *get_pbus_smbus(device_t dev); +int smbus_set_link(device_t dev); + +int smbus_quick_read(device_t dev); +int smbus_quick_write(device_t dev); +int smbus_recv_byte(device_t dev); +int smbus_send_byte(device_t dev, uint8_t byte); +int smbus_read_byte(device_t dev, uint8_t addr); +int smbus_write_byte(device_t dev, uint8_t addr, uint8_t val); +int smbus_read_word(device_t dev, uint8_t addr); +int smbus_write_word(device_t dev, uint8_t addr, uint16_t val); +int smbus_process_call(device_t dev, uint8_t cmd, uint16_t data); +int smbus_block_read(device_t dev, uint8_t cmd, uint8_t bytes, uint8_t *buffer); +int smbus_block_write(device_t dev, uint8_t cmd, uint8_t bytes, const uint8_t *buffer); #endif /* DEVICE_SMBUS_H */ |