1 #include <linux/export.h>
2 #include <linux/kernel.h>
4 #include <linux/slab.h>
6 #include <asm/addrspace.h>
19 } gio_name_table[] = {
20 { .name =
"SGI Impact", .id = 0x10 },
21 { .name =
"Phobos G160", .id = 0x35 },
23 { .name =
"SGI Newport", .id = 0x7e },
24 { .name =
"SGI GR2/GR3", .id = 0x7f },
27 static struct device gio_bus = {
45 for (ids = match; ids->
id != 0xff; ids++)
46 if (ids->
id == dev->
id.id)
92 giodev->
dev.bus = &gio_bus_type;
93 giodev->
dev.parent = &gio_bus;
112 static int gio_device_probe(
struct device *
dev)
129 error = drv->
probe(gio_dev, match);
136 static int gio_device_remove(
struct device *dev)
153 error = drv->
suspend(gio_dev, state);
157 static int gio_device_resume(
struct device *dev)
164 error = drv->
resume(gio_dev);
168 static void gio_device_shutdown(
struct device *dev)
201 return sprintf(buf,
"%x", giodev->
id.id);
226 drv->
driver.bus = &gio_bus_type;
276 static int ip22_gio_id(
unsigned long addr,
u32 *
res)
299 if (tmp8 == (tmp16 & 0xff) &&
300 tmp8 == (tmp32 & 0xff) &&
301 tmp16 == (tmp32 & 0xffff)) {
309 #define HQ2_MYSTERY_OFFS 0x6A07C
310 #define NEWPORT_USTATUS_OFFS 0xF133C
312 static int ip22_is_gr2(
unsigned long addr)
320 if (tmp == 0xdeadbeef)
327 static void ip22_check_gio(
int slotno,
unsigned long addr)
329 const char *
name =
"Unknown";
336 if (ip22_is_gr2(addr))
339 if (!ip22_gio_id(addr, &tmp)) {
357 for (i = 0; i <
ARRAY_SIZE(gio_name_table); i++) {
358 if (
id == gio_name_table[i].
id) {
359 name = gio_name_table[
i].name;
365 gio_dev = kzalloc(
sizeof *gio_dev,
GFP_KERNEL);
370 gio_dev->
resource.end = addr + 0x3fffff;
378 static struct bus_type gio_bus_type = {
380 .dev_attrs = gio_dev_attrs,
381 .match = gio_bus_match,
382 .probe = gio_device_probe,
383 .remove = gio_device_remove,
384 .suspend = gio_device_suspend,
385 .resume = gio_device_resume,
386 .shutdown = gio_device_shutdown,
387 .uevent = gio_device_uevent,
390 static struct resource gio_bus_resource = {