Commit fca6a936 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Linus Torvalds

[PATCH] PA-RISC: parisc_device diet

 - Remove parent/child/sibling links from parisc_device in favour of the
   ones in the embedded struct device.
 - Display irq and device IDs through sysfs
 - Translate a PA-RISC firmware path into a struct device (Thibaut Varene)
Signed-off-by: default avatarMatthew Wilcox <willy@parisc-linux.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c2ed00d8
This diff is collapsed.
......@@ -518,7 +518,7 @@ add_system_map_addresses(struct parisc_device *dev, int num_addrs,
}
/**
* do_system_map_inventory - Retrieve firmware devices via SYSTEM_MAP.
* system_map_inventory - Retrieve firmware devices via SYSTEM_MAP.
*
* This function attempts to retrieve and register all the devices firmware
* knows about via the SYSTEM_MAP PDC call.
......@@ -528,13 +528,15 @@ static void __init system_map_inventory(void)
int i;
long status = PDC_OK;
for (i = 0; status != PDC_BAD_PROC && status != PDC_NE_MOD; i++) {
for (i = 0; i < 256; i++) {
struct parisc_device *dev;
struct pdc_system_map_mod_info module_result;
struct pdc_module_path module_path;
status = pdc_system_map_find_mods(&module_result,
&module_path, i);
if ((status == PDC_BAD_PROC) || (status == PDC_NE_MOD))
break;
if (status != PDC_OK)
continue;
......@@ -584,10 +586,10 @@ void __init do_memory_inventory(void)
void __init do_device_inventory(void)
{
extern void parisc_generic_device_register(void);
printk(KERN_INFO "Searching for devices...\n");
init_parisc_bus();
switch (pdc_type) {
case PDC_TYPE_PAT:
......@@ -605,7 +607,6 @@ void __init do_device_inventory(void)
default:
panic("Unknown PDC type!\n");
}
parisc_generic_device_register();
printk(KERN_INFO "Found devices:\n");
print_parisc_devices();
}
......@@ -1198,9 +1198,10 @@ void * ccio_get_iommu(const struct parisc_device *dev)
* to/from certain pages. To avoid this happening, we mark these pages
* as `used', and ensure that nothing will try to allocate from them.
*/
void ccio_cujo20_fixup(struct parisc_device *dev, u32 iovp)
void ccio_cujo20_fixup(struct parisc_device *cujo, u32 iovp)
{
unsigned int idx;
struct parisc_device *dev = parisc_parent(cujo);
struct ioc *ioc = ccio_get_iommu(dev);
u8 *res_ptr;
......@@ -1556,9 +1557,12 @@ static int ccio_probe(struct parisc_device *dev)
create_proc_read_entry(MODULE_NAME"-bitmap", S_IRWXU,
proc_runway_root, ccio_resource_map, NULL);
}
ioc_count++;
parisc_vmerge_boundary = IOVP_SIZE;
parisc_vmerge_max_size = BITS_PER_LONG * IOVP_SIZE;
ioc_count++;
parisc_has_iommu();
return 0;
}
......
......@@ -951,9 +951,9 @@ dino_driver_callback(struct parisc_device *dev)
#ifdef CONFIG_IOMMU_CCIO
printk(KERN_WARNING "Enabling Cujo 2.0 bug workaround\n");
if (dev->hpa == (unsigned long)CUJO_RAVEN_ADDR) {
ccio_cujo20_fixup(dev->parent, CUJO_RAVEN_BADPAGE);
ccio_cujo20_fixup(dev, CUJO_RAVEN_BADPAGE);
} else if (dev->hpa == (unsigned long)CUJO_FIREHAWK_ADDR) {
ccio_cujo20_fixup(dev->parent, CUJO_FIREHAWK_BADPAGE);
ccio_cujo20_fixup(dev, CUJO_FIREHAWK_BADPAGE);
} else {
printk("Don't recognise Cujo at address 0x%lx, not enabling workaround\n", dev->hpa);
}
......
......@@ -40,7 +40,7 @@ serial_init_chip(struct parisc_device *dev)
* what we have here is a missing parent device, so tell
* the user what they're missing.
*/
if (dev->parent->id.hw_type != HPHW_IOA) {
if (parisc_parent(dev)->id.hw_type != HPHW_IOA) {
printk(KERN_INFO "Serial: device 0x%lx not configured.\n"
"Enable support for Wax, Lasi, Asp or Dino.\n", dev->hpa);
}
......@@ -99,13 +99,13 @@ static struct parisc_device_id lasi_tbl[] = {
MODULE_DEVICE_TABLE(parisc, serial_tbl);
static struct parisc_driver lasi_driver = {
.name = "Lasi RS232",
.name = "serial_1",
.id_table = lasi_tbl,
.probe = serial_init_chip,
};
static struct parisc_driver serial_driver = {
.name = "Serial RS232",
.name = "serial",
.id_table = serial_tbl,
.probe = serial_init_chip,
};
......
......@@ -115,14 +115,13 @@ extern int register_parisc_driver(struct parisc_driver *driver);
extern int count_parisc_driver(struct parisc_driver *driver);
extern int unregister_parisc_driver(struct parisc_driver *driver);
extern void walk_central_bus(void);
extern void fixup_child_irqs(struct parisc_device *parent, int irqbase,
int (*choose)(struct parisc_device *parent));
extern void print_subdevices(struct parisc_device *dev);
extern const struct parisc_device *find_pa_parent_type(const struct parisc_device *, int);
extern void print_parisc_devices(void);
extern char *print_pa_hwpath(struct parisc_device *dev, char *path);
extern char *print_pci_hwpath(struct pci_dev *dev, char *path);
extern void get_pci_node_path(struct pci_dev *dev, struct hardware_path *path);
extern void init_parisc_bus(void);
extern struct device *hwpath_to_device(struct hardware_path *modpath);
/* inventory.c: */
......
......@@ -3,11 +3,7 @@
struct parisc_device {
unsigned long hpa; /* Hard Physical Address */
struct parisc_device_id id;
struct parisc_device *parent;
struct parisc_device *sibling;
struct parisc_device *child;
struct parisc_driver *driver; /* Driver for this device */
void *sysdata; /* Driver instance private data */
char name[80]; /* The hardware description */
int irq;
......@@ -40,5 +36,18 @@ struct parisc_driver {
#define to_parisc_device(d) container_of(d, struct parisc_device, dev)
#define to_parisc_driver(d) container_of(d, struct parisc_driver, drv)
#define parisc_parent(d) to_parisc_device(d->dev.parent)
static inline void
parisc_set_drvdata(struct parisc_device *d, void *p)
{
dev_set_drvdata(&d->dev, p);
}
static inline void *
parisc_get_drvdata(struct parisc_device *d)
{
return dev_get_drvdata(&d->dev);
}
extern struct bus_type parisc_bus_type;
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