Add interrupt-map and interrupt-mask properties to
host bridge and sprinkle interrupt properties to various
devices. Based on hack by Artyom Tarasenko.
Signed-off-by: Blue Swirl <blauwirbel(a)gmail.com>
---
drivers/ide.c | 2 ++
drivers/pc_serial.c | 3 +++
drivers/pci.c | 23 +++++++++++++++++++++++
drivers/pci_database.c | 2 +-
drivers/pci_database.h | 1 +
5 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/drivers/ide.c b/drivers/ide.c
index 0d09bcd..90138ff 100644
--- a/drivers/ide.c
+++ b/drivers/ide.c
@@ -1432,6 +1432,8 @@ int ob_ide_init(const char *path, uint32_t
io_port0, uint32_t ctl_port0,
props[0]=14; props[1]=0;
set_property(dnode, "interrupts",
(char *)&props, 2*sizeof(props[0]));
+#elif defined(CONFIG_SPARC64)
+ set_int_property(get_cur_dev(), "interrupts", 0);
#endif
props[0] = __cpu_to_be32(chan->io_regs[0]);
diff --git a/drivers/pc_serial.c b/drivers/pc_serial.c
index 583d1c0..5882a05 100644
--- a/drivers/pc_serial.c
+++ b/drivers/pc_serial.c
@@ -190,6 +190,9 @@ ob_pc_serial_init(const char *path, const char
*dev_name, uint64_t base,
fword("encode+");
push_str("reg");
fword("property");
+#if defined(CONFIG_SPARC64)
+ set_int_property(get_cur_dev(), "interrupts", 1);
+#endif
aliases = find_dev("/aliases");
set_property(aliases, "ttya", nodebuff, strlen(nodebuff) + 1);
diff --git a/drivers/pci.c b/drivers/pci.c
index e270a73..1e68000 100644
--- a/drivers/pci.c
+++ b/drivers/pci.c
@@ -401,6 +401,21 @@ static void pci_host_set_interrupt_map(const
pci_config_t *config)
props[PCI_INT_MAP_PCI_INT] = 0x7;
set_property(dev, "interrupt-map-mask", (char *)props, 4 * sizeof(props[0]));
+#elif defined(CONFIG_SPARC64)
+ phandle_t dev = get_cur_dev();
+ uint32_t props[5];
+
+ props[0] = 0x000001fe;
+ props[1] = 0x020003f8;
+ props[2] = 1;
+ props[3] = find_dev("/");
+ props[4] = 0x2b;
+ set_property(dev, "interrupt-map", (char *)props, 5 * sizeof(props[0]));
+
+ props[0] = 0x000001ff;
+ props[1] = 0xffffffff;
+ props[2] = 3;
+ set_property(dev, "interrupt-map-mask", (char *)props, 3 * sizeof(props[0]));
#endif
}
@@ -522,6 +537,14 @@ int bridge_config_cb(const pci_config_t *config)
return 0;
}
+int virtio_config_cb(const pci_config_t *config)
+{
+#if defined(CONFIG_SPARC64)
+ set_int_property(get_cur_dev(), "interrupts", 0);
+#endif
+ return 0;
+}
+
int ide_config_cb2 (const pci_config_t *config)
{
ob_ide_init(config->path,
diff --git a/drivers/pci_database.c b/drivers/pci_database.c
index 7d420c3..1d2958c 100644
--- a/drivers/pci_database.c
+++ b/drivers/pci_database.c
@@ -52,7 +52,7 @@ static const pci_dev_t scsi_devices[] = {
NULL, "virtio-scsi", NULL,
"pci1af4,1001\0pci1af4,1001\0pciclass,01018f\0",
0, 0, 0,
- NULL, NULL,
+ virtio_config_cb, NULL,
},
{
0xFFFF, 0xFFFF,
diff --git a/drivers/pci_database.h b/drivers/pci_database.h
index 5ddbb20..5459032 100644
--- a/drivers/pci_database.h
+++ b/drivers/pci_database.h
@@ -28,6 +28,7 @@ struct pci_dev_t {
const void *private;
};
+extern int virtio_config_cb(const pci_config_t *config);
extern int ide_config_cb2(const pci_config_t *config);
extern int eth_config_cb(const pci_config_t *config);
extern int macio_heathrow_config_cb(const pci_config_t *config);
--
1.7.10