summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorYinghai Lu <yinghailu@gmail.com>2004-12-03 03:39:04 +0000
committerYinghai Lu <yinghailu@gmail.com>2004-12-03 03:39:04 +0000
commit7213d0f513c2a0dbcacbf0a811d01322cd82d25b (patch)
treef40eb3d7e577af50edbc10f0df921fd34de9e075 /src/include
parent57b6786168683e33c1c6c2d8df6a1e8c0246fbde (diff)
downloadcoreboot-7213d0f513c2a0dbcacbf0a811d01322cd82d25b.tar.xz
i2c mux support
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1809 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/include')
-rw-r--r--src/include/device/device.h3
-rw-r--r--src/include/device/smbus.h63
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 */