powerpc: Remove device_node addrs/n_addr
Subsystems (6)
PATCH 1/1 powerpc: Remove device_node addrs/n_addr
The pre-parsed addrs/n_addrs fields in struct device_node are finally gone. Remove the dodgy heuristics that did that parsing at boot and remove the fields themselves since we now have a good replacement with the new OF parsing code. This patch also fixes a bunch of drivers to use the new code instead, so that at least pmac32, pseries, iseries and g5 defconfigs build.
arch/powerpc/kernel/prom.c +10 -414
@@ -57,21 +57,6 @@ #define DBG(fmt...)#endif -struct pci_reg_property { -struct pci_address addr; -u32 size_hi; -u32 size_lo; -}; - -struct isa_reg_property { -u32 space; -u32 address; -u32 size; -}; - - -typedef int interpret_func (struct device_node *,unsigned long *, -int ,int ,int );static int __initdata dt_root_addr_cells;static int __initdata dt_root_size_cells;
@@ -410,237 +395,19 @@ static int __devinit finish_node_interrureturn 0 ; } -static int __devinit interpret_pci_props (struct device_node *np, -unsigned long *mem_start, -int naddrc,int nsizec, -int measure_only) -{ -struct address_range *adr; -struct pci_reg_property *pci_addrs; -int i, l, n_addrs; - - pci_addrs = (struct pci_reg_property *) -get_property (np,"assigned-addresses" , &l); -if (!pci_addrs) -return 0 ; - - n_addrs = l /sizeof (*pci_addrs); - - adr =prom_alloc (n_addrs *sizeof (*adr), mem_start); -if (!adr) -return -ENOMEM ; - -if (measure_only) -return 0 ; - - np->addrs = adr; - np->n_addrs = n_addrs; - -for (i =0 ; i < n_addrs; i++) { - adr[i].space = pci_addrs[i].addr.a_hi; - adr[i].address = pci_addrs[i].addr.a_lo | - ((u64 )pci_addrs[i].addr.a_mid <<32 ); - adr[i].size = pci_addrs[i].size_lo; - } - -return 0 ; -} - -static int __init interpret_dbdma_props (struct device_node *np, -unsigned long *mem_start, -int naddrc,int nsizec, -int measure_only) -{ -struct reg_property32 *rp; -struct address_range *adr; -unsigned long base_address; -int i, l; -struct device_node *db; - - base_address =0 ; -if (!measure_only) { -for (db = np->parent; db !=NULL ; db = db->parent) { -if (!strcmp (db->type,"dbdma" ) && db->n_addrs !=0 ) { - base_address = db->addrs[0 ].address; -break ; - } - } - } - - rp = (struct reg_property32 *)get_property (np,"reg" , &l); -if (rp !=0 && l >=sizeof (struct reg_property32 )) { - i =0 ; - adr = (struct address_range *) (*mem_start); -while ((l -=sizeof (struct reg_property32 )) >=0 ) { -if (!measure_only) { - adr[i].space =2 ; - adr[i].address = rp[i].address + base_address; - adr[i].size = rp[i].size; - } - ++i; - } - np->addrs = adr; - np->n_addrs = i; - (*mem_start) += i *sizeof (struct address_range ); - } - -return 0 ; -} - -static int __init interpret_macio_props (struct device_node *np, -unsigned long *mem_start, -int naddrc,int nsizec, -int measure_only) -{ -struct reg_property32 *rp; -struct address_range *adr; -unsigned long base_address; -int i, l; -struct device_node *db; - - base_address =0 ; -if (!measure_only) { -for (db = np->parent; db !=NULL ; db = db->parent) { -if (!strcmp (db->type,"mac-io" ) && db->n_addrs !=0 ) { - base_address = db->addrs[0 ].address; -break ; - } - } - } - - rp = (struct reg_property32 *)get_property (np,"reg" , &l); -if (rp !=0 && l >=sizeof (struct reg_property32 )) { - i =0 ; - adr = (struct address_range *) (*mem_start); -while ((l -=sizeof (struct reg_property32 )) >=0 ) { -if (!measure_only) { - adr[i].space =2 ; - adr[i].address = rp[i].address + base_address; - adr[i].size = rp[i].size; - } - ++i; - } - np->addrs = adr; - np->n_addrs = i; - (*mem_start) += i *sizeof (struct address_range ); - } - -return 0 ; -} - -static int __init interpret_isa_props (struct device_node *np, -unsigned long *mem_start, -int naddrc,int nsizec, -int measure_only) -{ -struct isa_reg_property *rp; -struct address_range *adr; -int i, l; - - rp = (struct isa_reg_property *)get_property (np,"reg" , &l); -if (rp !=0 && l >=sizeof (struct isa_reg_property )) { - i =0 ; - adr = (struct address_range *) (*mem_start); -while ((l -=sizeof (struct isa_reg_property )) >=0 ) { -if (!measure_only) { - adr[i].space = rp[i].space; - adr[i].address = rp[i].address; - adr[i].size = rp[i].size; - } - ++i; - } - np->addrs = adr; - np->n_addrs = i; - (*mem_start) += i *sizeof (struct address_range ); - } - -return 0 ; -} - -static int __init interpret_root_props (struct device_node *np, -unsigned long *mem_start, -int naddrc,int nsizec, -int measure_only) -{ -struct address_range *adr; -int i, l; -unsigned int *rp; -int rpsize = (naddrc + nsizec) *sizeof (unsigned int ); - - rp = (unsigned int *)get_property (np,"linux,usable-memory" , &l); -if (rp ==NULL ) - rp = (unsigned int *)get_property (np,"reg" , &l); - -if (rp !=0 && l >= rpsize) { - i =0 ; - adr = (struct address_range *) (*mem_start); -while ((l -= rpsize) >=0 ) { -if (!measure_only) { - adr[i].space =0 ; - adr[i].address = rp[naddrc -1 ]; - adr[i].size = rp[naddrc + nsizec -1 ]; - } - ++i; - rp += naddrc + nsizec; - } - np->addrs = adr; - np->n_addrs = i; - (*mem_start) += i *sizeof (struct address_range ); - } - -return 0 ; -} -static int __devinit finish_node (struct device_node *np,unsigned long *mem_start, -interpret_func *ifunc, -int naddrc,int nsizec,int measure_only) {struct device_node *child; -int *ip, rc =0 ; - -/* get the device addresses and interrupts */ -if (ifunc !=NULL ) - rc =ifunc (np, mem_start, naddrc, nsizec, measure_only); -if (rc) - goto out; +int rc =0 ; rc =finish_node_interrupts (np, mem_start, measure_only);if (rc) goto out; -/* Look for #address-cells and #size-cells properties. */ - ip = (int *)get_property (np,"#address-cells" ,NULL ); -if (ip !=NULL ) - naddrc = *ip; - ip = (int *)get_property (np,"#size-cells" ,NULL ); -if (ip !=NULL ) - nsizec = *ip; - -if (!strcmp (np->name,"device-tree" ) || np->parent ==NULL ) - ifunc = interpret_root_props; -else if (np->type ==0 ) - ifunc =NULL ; -else if (!strcmp (np->type,"pci" ) || !strcmp (np->type,"vci" )) - ifunc = interpret_pci_props; -else if (!strcmp (np->type,"dbdma" )) - ifunc = interpret_dbdma_props; -else if (!strcmp (np->type,"mac-io" ) || ifunc == interpret_macio_props) - ifunc = interpret_macio_props; -else if (!strcmp (np->type,"isa" )) - ifunc = interpret_isa_props; -else if (!strcmp (np->name,"uni-n" ) || !strcmp (np->name,"u3" )) - ifunc = interpret_root_props; -else if (!((ifunc == interpret_dbdma_props - || ifunc == interpret_macio_props) - && (!strcmp (np->type,"escc" ) - || !strcmp (np->type,"media-bay" )))) - ifunc =NULL ; -for (child = np->child; child !=NULL ; child = child->sibling) { - rc =finish_node (child, mem_start, ifunc, - naddrc, nsizec, measure_only); + rc =finish_node (child, mem_start, measure_only);if (rc) goto out; }
@@ -702,10 +469,10 @@ void __init finish_device_tree(void)* reason and then remove those additional 16 bytes */ size =16 ; -finish_node (allnodes, &size,NULL ,0 ,0 ,1 ); +finish_node (allnodes, &size,1 ); size -=16 ; end = start = (unsigned long )__va (lmb_alloc (size,128 )); -finish_node (allnodes, &end,NULL ,0 ,0 ,0 ); +finish_node (allnodes, &end,0 );BUG_ON (end != start + size);DBG (" <- finish_device_tree\n" );
@@ -1822,7 +1589,6 @@ static void of_node_release(struct kref prop = next; }kfree (node->intrs); -kfree (node->addrs);kfree (node->full_name);kfree (node->data);kfree (node);
@@ -1904,9 +1670,7 @@ void of_detach_node(const struct device_* This should probably be split up into smaller chunks. */ -static int of_finish_dynamic_node (struct device_node *node, -unsigned long *unused1,int unused2, -int unused3,int unused4) +static int of_finish_dynamic_node (struct device_node *node) {struct device_node *parent =of_get_parent (node);int err =0 ;
@@ -1927,7 +1691,8 @@ static int of_finish_dynamic_node(structreturn -ENODEV ;/* fix up new node's linux_phandle field */ -if ((ibm_phandle = (unsigned int *)get_property (node,"ibm,phandle" ,NULL ))) +if ((ibm_phandle = (unsigned int *)get_property (node, +"ibm,phandle" ,NULL ))) node->linux_phandle = *ibm_phandle; out:
@@ -1942,7 +1707,9 @@ static int prom_reconfig_notifier(structswitch (action) {case PSERIES_RECONFIG_ADD : - err =finish_node (node,NULL , of_finish_dynamic_node,0 ,0 ,0 ); + err =of_finish_dynamic_node (node); +if (!err) +finish_node (node,NULL ,0 );if (err <0 ) {printk (KERN_ERR "finish_node returned %d\n" , err); err =NOTIFY_BAD ;
@@ -2016,175 +1783,4 @@ int prom_add_property(struct device_nodereturn 0 ; } -/* I quickly hacked that one, check against spec ! */ -static inline unsigned long -bus_space_to_resource_flags (unsigned int bus_space) -{ -u8 space = (bus_space >>24 ) &0xf ; -if (space ==0 ) - space =0x02 ; -if (space ==0x02 ) -return IORESOURCE_MEM ; -else if (space ==0x01 ) -return IORESOURCE_IO ; -else { -printk (KERN_WARNING "prom.c: bus_space_to_resource_flags(), space: %x\n" , - bus_space); -return 0 ; - } -} - -#ifdef CONFIG_PCI -static struct resource *find_parent_pci_resource (struct pci_dev * pdev, -struct address_range *range) -{ -unsigned long mask; -int i; - -/* Check this one */ - mask =bus_space_to_resource_flags (range->space); -for (i=0 ; i<DEVICE_COUNT_RESOURCE ; i++) { -if ((pdev->resource[i].flags & mask) == mask && - pdev->resource[i].start <= range->address && - pdev->resource[i].end > range->address) { -if ((range->address + range->size -1 ) > pdev->resource[i].end) { -/* Add better message */ -printk (KERN_WARNING "PCI/OF resource overlap !\n" ); -return NULL ; - } -break ; - } - } -if (i ==DEVICE_COUNT_RESOURCE ) -return NULL ; -return &pdev->resource[i]; -} - -/* -* Request an OF device resource. Currently handles child of PCI devices, -* or other nodes attached to the root node. Ultimately, put some -* link to resources in the OF node. -*/ -struct resource *request_OF_resource (struct device_node * node,int index, -const char * name_postfix) -{ -struct pci_dev * pcidev; -u8 pci_bus, pci_devfn; -unsigned long iomask; -struct device_node * nd; -struct resource * parent; -struct resource *res =NULL ; -int nlen, plen; - -if (index >= node->n_addrs) - goto fail; - -/* Sanity check on bus space */ - iomask =bus_space_to_resource_flags (node->addrs[index].space); -if (iomask &IORESOURCE_MEM ) - parent = &iomem_resource; -else if (iomask &IORESOURCE_IO ) - parent = &ioport_resource; -else - goto fail; - -/* Find a PCI parent if any */ - nd = node; - pcidev =NULL ; -while (nd) { -if (!pci_device_from_OF_node (nd, &pci_bus, &pci_devfn)) - pcidev =pci_find_slot (pci_bus, pci_devfn); -if (pcidev)break ; - nd = nd->parent; - } -if (pcidev) - parent =find_parent_pci_resource (pcidev, &node->addrs[index]); -if (!parent) { -printk (KERN_WARNING "request_OF_resource(%s), parent not found\n" , - node->name); - goto fail; - } - - res =__request_region (parent, node->addrs[index].address, - node->addrs[index].size,NULL ); -if (!res) - goto fail; - nlen =strlen (node->name); - plen = name_postfix ?strlen (name_postfix) :0 ; - res->name = (const char *)kmalloc (nlen+plen+1 ,GFP_KERNEL ); -if (res->name) { -strcpy ((char *)res->name, node->name); -if (plen) -strcpy ((char *)res->name+nlen, name_postfix); - } -return res; -fail: -return NULL ; -} -EXPORT_SYMBOL (request_OF_resource); -int release_OF_resource (struct device_node *node,int index) -{ -struct pci_dev * pcidev; -u8 pci_bus, pci_devfn; -unsigned long iomask, start, end; -struct device_node * nd; -struct resource * parent; -struct resource *res =NULL ; - -if (index >= node->n_addrs) -return -EINVAL ; - -/* Sanity check on bus space */ - iomask =bus_space_to_resource_flags (node->addrs[index].space); -if (iomask &IORESOURCE_MEM ) - parent = &iomem_resource; -else if (iomask &IORESOURCE_IO ) - parent = &ioport_resource; -else -return -EINVAL ; - -/* Find a PCI parent if any */ - nd = node; - pcidev =NULL ; -while (nd) { -if (!pci_device_from_OF_node (nd, &pci_bus, &pci_devfn)) - pcidev =pci_find_slot (pci_bus, pci_devfn); -if (pcidev)break ; - nd = nd->parent; - } -if (pcidev) - parent =find_parent_pci_resource (pcidev, &node->addrs[index]); -if (!parent) { -printk (KERN_WARNING "release_OF_resource(%s), parent not found\n" , - node->name); -return -ENODEV ; - } - -/* Find us in the parent and its childs */ - res = parent->child; - start = node->addrs[index].address; - end = start + node->addrs[index].size -1 ; -while (res) { -if (res->start == start && res->end == end && - (res->flags &IORESOURCE_BUSY )) -break ; -if (res->start <= start && res->end >= end) - res = res->child; -else - res = res->sibling; - } -if (!res) -return -ENODEV ; - -if (res->name) { -kfree (res->name); - res->name =NULL ; - } -release_resource (res); -kfree (res); - -return 0 ; -} -EXPORT_SYMBOL (release_OF_resource); -#endif /* CONFIG_PCI */
include/asm-powerpc/prom.h +0 -40
@@ -65,49 +65,11 @@ struct boot_param_headertypedef u32 phandle ;typedef u32 ihandle ; -struct address_range { -unsigned long space; -unsigned long address; -unsigned long size; -}; -struct interrupt_info {int line;int sense;/* +ve/-ve logic, edge or level, etc. */ }; -struct pci_address { -u32 a_hi; -u32 a_mid; -u32 a_lo; -}; - -struct isa_address { -u32 a_hi; -u32 a_lo; -}; - -struct isa_range { -struct isa_address isa_addr; -struct pci_address pci_addr; -unsigned int size; -}; - -struct reg_property { -unsigned long address; -unsigned long size; -}; - -struct reg_property32 { -unsigned int address; -unsigned int size; -}; - -struct reg_property64 { -u64 address; -u64 size; -}; -struct property {char *name;int length;
@@ -120,8 +82,6 @@ struct device_node {char *type;phandle node;phandle linux_phandle; -int n_addrs; -struct address_range *addrs;int n_intrs;struct interrupt_info *intrs;char *full_name;
arch/powerpc/platforms/powermac/feature.c +44 -29
90 lines not on this page · raw message
arch/powerpc/platforms/powermac/pic.c +246 -210
577 lines not on this page · raw message
drivers/macintosh/via-cuda.c +0 -4
@@ -193,10 +193,6 @@ static int __init via_cuda_start(void)if (via ==NULL )return -ENODEV ; -#ifdef CONFIG_PPC -request_OF_resource (vias,0 ,NULL ); -#endif -if (request_irq (CUDA_IRQ , cuda_interrupt,0 ,"ADB" , cuda_interrupt)) {printk (KERN_ERR "cuda_init: can't get irq %d\n" ,CUDA_IRQ );return -EAGAIN ;
drivers/macintosh/via-pmu.c +3 -6
@@ -298,7 +298,7 @@ static struct backlight_controller pmu_bint __init find_via_pmu (void ) { -phys_addr_t taddr; +u64 taddr;u32 *reg;if (via !=0 )
@@ -337,7 +337,7 @@ int __init find_via_pmu(void)else if (device_is_compatible (vias->parent,"Keylargo" ) ||device_is_compatible (vias->parent,"K2-Keylargo" )) {struct device_node *gpiop; -phys_addr_t gaddr =0 ; +u64 gaddr =OF_BAD_ADDR ; pmu_kind =PMU_KEYLARGO_BASED ; pmu_has_adb = (find_type_devices ("adb" ) !=NULL );
@@ -352,7 +352,7 @@ int __init find_via_pmu(void) reg = (u32 *)get_property (gpiop,"reg" ,NULL );if (reg) gaddr =of_translate_address (gpiop, reg); -if (gaddr !=0 ) +if (gaddr !=OF_BAD_ADDR ) gpio_reg =ioremap (gaddr,0x10 ); }if (gpio_reg ==NULL )
@@ -479,9 +479,6 @@ static int __init via_pmu_dev_init(void)if (vias ==NULL )return -ENODEV ; -#ifndef CONFIG_PPC64 -request_OF_resource (vias,0 ,NULL ); -#endif #ifdef CONFIG_PMAC_BACKLIGHT /* Enable backlight */ register_backlight_controller (&pmu_backlight_controller,NULL ,"pmu" );
arch/powerpc/platforms/powermac/nvram.c +34 -18
95 lines not on this page · raw message
arch/powerpc/platforms/powermac/pci.c +44 -43
189 lines not on this page · raw message
arch/powerpc/platforms/powermac/pmac.h +1 -5
@@ -42,10 +42,6 @@ extern void pmac_ide_init_hwif_ports(hw_ unsigned long data_port, unsigned long ctrl_port, int *irq);extern int pmac_nvram_init (void ); - -extern struct hw_interrupt_type pmac_pic; - -void pmac_pic_init (void ); -int pmac_get_irq (struct pt_regs *regs); +extern void pmac_pic_init (void );#endif /* __PMAC_H__ */
arch/powerpc/platforms/powermac/setup.c +1 -2
@@ -75,7 +75,6 @@#include <asm/iommu.h> #include <asm/smu.h> #include <asm/pmc.h> -#include <asm/mpic.h> #include <asm/lmb.h> #include <asm/udbg.h>
@@ -751,7 +750,7 @@ struct machdep_calls __initdata pmac_md .init_early = pmac_init_early, .show_cpuinfo = pmac_show_cpuinfo, .init_IRQ = pmac_pic_init, - .get_irq = mpic_get_irq, /* changed later */ + .get_irq = NULL, /* changed later */ .pcibios_fixup = pmac_pcibios_fixup, .restart = pmac_restart, .power_off = pmac_power_off,
arch/powerpc/platforms/powermac/time.c +10 -5
@@ -258,15 +258,20 @@ int __init via_calibrate_decr(void)volatile unsigned char __iomem *via;int count =VIA_TIMER_FREQ_6 /100 ;unsigned int dstart, dend; +struct resource rsrc; - vias =find_devices ("via-cuda" ); + vias =of_find_node_by_name (NULL ,"via-cuda" );if (vias ==0 ) - vias =find_devices ("via-pmu" ); + vias =of_find_node_by_name (NULL ,"via-pmu" );if (vias ==0 ) - vias =find_devices ("via" ); -if (vias ==0 || vias->n_addrs ==0 ) + vias =of_find_node_by_name (NULL ,"via" ); +if (vias ==0 ||of_address_to_resource (vias,0 , &rsrc))return 0 ; - via =ioremap (vias->addrs[0 ].address, vias->addrs[0 ].size); + via =ioremap (rsrc.start, rsrc.end - rsrc.start +1 ); +if (via ==NULL ) { +printk (KERN_ERR "Failed to map VIA for timer calibration !\n" ); +return 0 ; + }/* set timer 1 for continuous interrupts */ out_8 (&via[ACR ], (via[ACR ] & ~T1MODE ) |T1MODE_CONT );
drivers/macintosh/macio_asic.c +13 -13
@@ -256,42 +256,42 @@ static int macio_resource_quirks(struct {if (res->flags &IORESOURCE_MEM ) {/* Grand Central has too large resource 0 on some machines */ -if (index ==0 && !strcmp (np->name,"gc" )) { - np->addrs[0 ].size =0x20000 ; +if (index ==0 && !strcmp (np->name,"gc" )) res->end = res->start +0x1ffff ; - } +/* Airport has bogus resource 2 */ if (index >=2 && !strcmp (np->name,"radio" ))return 1 ; + +#ifndef CONFIG_PPC64 /* DBDMAs may have bogus sizes */ -if ((res->start &0x0001f000 ) ==0x00008000 ) { - np->addrs[index].size =0x100 ; +if ((res->start &0x0001f000 ) ==0x00008000 ) res->end = res->start +0xff ; - } +#endif /* CONFIG_PPC64 */ +/* ESCC parent eats child resources. We could have added a * level of hierarchy, but I don't really feel the need * for it */ if (!strcmp (np->name,"escc" ))return 1 ; +/* ESCC has bogus resources >= 3 */ if (index >=3 && !(strcmp (np->name,"ch-a" ) &&strcmp (np->name,"ch-b" )))return 1 ; +/* Media bay has too many resources, keep only first one */ if (index >0 && !strcmp (np->name,"media-bay" ))return 1 ; +/* Some older IDE resources have bogus sizes */ if (!(strcmp (np->name,"IDE" ) &&strcmp (np->name,"ATA" ) &&strcmp (np->type,"ide" ) &&strcmp (np->type,"ata" ))) { -if (index ==0 && np->addrs[0 ].size >0x1000 ) { - np->addrs[0 ].size =0x1000 ; +if (index ==0 && (res->end - res->start) >0xfff ) res->end = res->start +0xfff ; - } -if (index ==1 && np->addrs[1 ].size >0x100 ) { - np->addrs[1 ].size =0x100 ; +if (index ==1 && (res->end - res->start) >0xff ) res->end = res->start +0xff ; - } } }return 0 ;
@@ -349,7 +349,7 @@ static void macio_setup_resources(struct/* Currently, we consider failure as harmless, this may * change in the future, once I've found all the device * tree bugs in older machines & worked around them -l */ +*/ if (insert_resource (parent_res, res)) { printk(KERN_WARNING "Can't request resource " "%d for MacIO device %s\n",
drivers/macintosh/mediabay.c +5 -3
@@ -647,6 +647,7 @@ static int __devinit media_bay_attach(ststruct media_bay_info * bay;u32 __iomem *regbase;struct device_node *ofnode; +unsigned long base;int i; ofnode = mdev->ofdev.node;
@@ -656,10 +657,11 @@ static int __devinit media_bay_attach(stif (macio_request_resources (mdev,"media-bay" ))return -EBUSY ;/* Media bay registers are located at the beginning of the -* mac-io chip, we get the parent address for now (hrm...) +* mac-io chip, for now, we trick and align down the first +* resource passed in */ - regbase = (u32 __iomem *) -ioremap (ofnode->parent->addrs[0 ].address,0x100 ); + base =macio_resource_start (mdev,0 ) &0xffff0000u ; + regbase = (u32 __iomem *)ioremap (base,0x100 );if (regbase ==NULL ) {macio_release_resources (mdev);return -ENOMEM ;
drivers/ide/ppc/pmac.c +2 -2
@@ -1271,7 +1271,7 @@ static int pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) {struct device_node *np = pmif->node; -int *bidp, i; +int *bidp; pmif->cable_80 =0 ; pmif->broken_dma = pmif->broken_dma_warn =0 ;
@@ -1430,7 +1430,7 @@ pmac_ide_macio_attach(struct macio_dev * pmif = &pmac_ide[i]; hwif = &ide_hwifs[i]; -if (mdev->ofdev.node->n_addrs ==0 ) { +if (macio_resource_count (mdev) ==0 ) {printk (KERN_WARNING "ide%d: no address for %s\n" , i, mdev->ofdev.node->full_name);return -ENXIO ;
drivers/scsi/mac53c94.c +14 -8
@@ -432,11 +432,12 @@ static int mac53c94_probe(struct macio_dstruct Scsi_Host *host;void *dma_cmd_space;unsigned char *clkprop; -int proplen; +int proplen, rc = -ENODEV ;if (macio_resource_count (mdev) !=2 ||macio_irq_count (mdev) !=2 ) { -printk (KERN_ERR "mac53c94: expected 2 addrs and intrs (got %d/%d)\n" , - node->n_addrs, node->n_intrs); +printk (KERN_ERR "mac53c94: expected 2 addrs and intrs" +" (got %d/%d)\n" , +macio_resource_count (mdev),macio_irq_count (mdev));return -ENODEV ; }
@@ -448,6 +449,7 @@ static int mac53c94_probe(struct macio_d host =scsi_host_alloc (&mac53c94_template,sizeof (struct fsc_state ));if (host ==NULL ) {printk (KERN_ERR "mac53c94: couldn't register host" ); + rc = -ENOMEM ; goto out_release; }
@@ -486,6 +488,7 @@ static int mac53c94_probe(struct macio_dif (dma_cmd_space ==0 ) {printk (KERN_ERR "mac53c94: couldn't allocate dma " "command space for %s\n" , node->full_name); + rc = -ENOMEM ; goto out_free; } state->dma_cmds = (struct dbdma_cmd *)DBDMA_ALIGN (dma_cmd_space);
@@ -495,18 +498,21 @@ static int mac53c94_probe(struct macio_dmac53c94_init (state); -if (request_irq (state->intr, do_mac53c94_interrupt,0 ,"53C94" , state)) { +if (request_irq (state->intr, do_mac53c94_interrupt,0 ,"53C94" ,state)) {printk (KERN_ERR "mac53C94: can't get irq %d for %s\n" , state->intr, node->full_name); goto out_free_dma; } -/* XXX FIXME: handle failure */ -scsi_add_host (host, &mdev->ofdev.dev); -scsi_scan_host (host); + rc =scsi_add_host (host, &mdev->ofdev.dev); +if (rc !=0 ) + goto out_release_irq; +scsi_scan_host (host);return 0 ; + out_release_irq: +free_irq (state->intr, state); out_free_dma:kfree (state->dma_cmd_space); out_free:
@@ -518,7 +524,7 @@ static int mac53c94_probe(struct macio_d out_release:macio_release_resources (mdev); -return -ENODEV ; +return rc; }static int mac53c94_remove (struct macio_dev *mdev)
drivers/scsi/mesh.c +2 -1
@@ -1869,7 +1869,8 @@ static int mesh_probe(struct macio_dev *if (macio_resource_count (mdev) !=2 ||macio_irq_count (mdev) !=2 ) {printk (KERN_ERR "mesh: expected 2 addrs and 2 intrs" -" (got %d,%d)\n" , mesh->n_addrs, mesh->n_intrs); +" (got %d,%d)\n" ,macio_resource_count (mdev), +macio_irq_count (mdev));return -ENODEV ; }
drivers/video/offb.c +64 -58
185 lines not on this page · raw message
arch/powerpc/kernel/btext.c +0 -2
@@ -211,8 +211,6 @@ int __init btext_find_display(int allow_struct device_node *np =NULL ;int rc = -ENODEV ; -printk ("trying to initialize btext ...\n" ); - name = (char *)get_property (of_chosen,"linux,stdout-path" ,NULL );if (name !=NULL ) { np =of_find_node_by_path (name);
drivers/serial/pmac_zilog.c +11 -4
@@ -1431,11 +1431,14 @@ static int __init pmz_init_port(struct uchar name[1 ]; } *slots;int len; +struct resource r_ports, r_rxdma, r_txdma;/* * Request & map chip registers */ - uap->port.mapbase = np->addrs[0 ].address; +if (of_address_to_resource (np,0 , &r_ports)) +return -ENODEV ; + uap->port.mapbase = r_ports.start; uap->port.membase =ioremap (uap->port.mapbase,0x1000 ); uap->control_reg = uap->port.membase;
@@ -1445,16 +1448,20 @@ static int __init pmz_init_port(struct u* Request & map DBDMA registers */ #ifdef HAS_DBDMA -if (np->n_addrs >=3 && np->n_intrs >=3 ) +if (of_address_to_resource (np,1 , &r_txdma) ==0 && +of_address_to_resource (np,2 , &r_rxdma) ==0 ) uap->flags |=PMACZILOG_FLAG_HAS_DMA ; +#else +memset (&r_txdma,0 ,sizeof (struct resource )); +memset (&r_rxdma,0 ,sizeof (struct resource ));#endif if (ZS_HAS_DMA (uap)) { - uap->tx_dma_regs =ioremap (np->addrs[np->n_addrs -2 ].address,0x1000 ); + uap->tx_dma_regs =ioremap (r_txdma.start,0x100 );if (uap->tx_dma_regs ==NULL ) { uap->flags &= ~PMACZILOG_FLAG_HAS_DMA ; goto no_dma; } - uap->rx_dma_regs =ioremap (np->addrs[np->n_addrs -1 ].address,0x1000 ); + uap->rx_dma_regs =ioremap (r_rxdma.start,0x100 );if (uap->rx_dma_regs ==NULL ) {iounmap (uap->tx_dma_regs); uap->tx_dma_regs =NULL ;
arch/powerpc/kernel/pci_64.c +22 -2
@@ -896,6 +896,25 @@ static void __devinit pci_process_ISA_OFunsigned long phb_io_base_phys, void __iomem * phb_io_base_virt) { + /* Remove these asap */ + + struct pci_address { + u32 a_hi; +u32 a_mid; +u32 a_lo; + }; + +struct isa_address { +u32 a_hi; +u32 a_lo; + }; + +struct isa_range { +struct isa_address isa_addr; +struct pci_address pci_addr; +unsigned int size; + }; +struct isa_range *range;unsigned long pci_addr;unsigned int isa_addr;
@@ -1330,8 +1349,9 @@ unsigned int pci_address_to_pio(phys_addlist_for_each_entry_safe (hose, tmp, &hose_list, list_node) {if (address >= hose->io_base_phys && address < (hose->io_base_phys + hose->pci_io_size)) -return (unsigned int )hose->io_base_virt + - (address - hose->io_base_phys); +return (unsigned int ) + ((unsigned long )hose->io_base_virt + + (address - hose->io_base_phys)); }return (unsigned int )-1 ; }
sound/ppc/pmac.c +63 -37
145 lines not on this page · raw message
sound/ppc/pmac.h +2 -1
@@ -122,7 +122,8 @@ struct snd_pmac { unsigned int initialized : 1; unsigned int feature_is_set : 1; -unsigned int of_requested; +unsigned int requested; +struct resource rsrc[3 ];int num_freqs;int *freq_table;
include/asm-powerpc/keylargo.h +9 -1
@@ -232,10 +232,12 @@#define K2_FCR1_I2S0_RESET 0x00000800#define K2_FCR1_I2S0_CLK_ENABLE_BIT 0x00001000#define K2_FCR1_I2S0_ENABLE 0x00002000 -#define K2_FCR1_PCI1_CLK_ENABLE 0x00004000#define K2_FCR1_FW_CLK_ENABLE 0x00008000#define K2_FCR1_FW_RESET_N 0x00010000 +#define K2_FCR1_I2S1_CELL_ENABLE 0x00020000 +#define K2_FCR1_I2S1_CLK_ENABLE_BIT 0x00080000 +#define K2_FCR1_I2S1_ENABLE 0x00100000#define K2_FCR1_GMAC_CLK_ENABLE 0x00400000#define K2_FCR1_GMAC_POWER_DOWN 0x00800000#define K2_FCR1_GMAC_RESET_N 0x01000000
@@ -246,3 +248,9 @@#define K2_FCR1_UATA_RESET_N 0x40000000#define K2_FCR1_UATA_CHOOSE_CLK66 0x80000000 +/* Shasta definitions */ +#define SH_FCR1_I2S2_CELL_ENABLE 0x00000010 +#define SH_FCR1_I2S2_CLK_ENABLE_BIT 0x00000040 +#define SH_FCR1_I2S2_ENABLE 0x00000080 +#define SH_FCR3_I2S2_CLK18_ENABLE 0x00008000 +
drivers/video/platinumfb.c +46 -40
146 lines not on this page · raw message
drivers/video/controlfb.c +50 -64
147 lines not on this page · raw message
sound/oss/dmasound/dmasound_awacs.c +49 -32
130 lines not on this page · raw message
drivers/video/valkyriefb.c +6 -6
@@ -342,19 +342,19 @@ int __init valkyriefb_init(void)#else /* ppc (!CONFIG_MAC) */ {struct device_node *dp; +struct resource r; - dp =find_devices ("valkyrie" ); + dp =of_find_node_by_name (NULL ,"valkyrie" );if (dp ==0 )return 0 ; -if (dp->n_addrs !=1 ) { -printk (KERN_ERR "expecting 1 address for valkyrie (got %d)\n" , - dp->n_addrs); +if (of_address_to_resource (dp,0 , &r)) { +printk (KERN_ERR "can't find address for valkyrie\n" );return 0 ; } - frame_buffer_phys = dp->addrs[0 ].address; - cmap_regs_phys = dp->addrs[0 ].address+0x304000 ; + frame_buffer_phys = r.start; + cmap_regs_phys = r.start +0x304000 ; flags = _PAGE_WRITETHRU; }#endif /* ppc (!CONFIG_MAC) */
drivers/block/swim3.c +23 -15
@@ -1083,23 +1083,33 @@ static int swim3_add_device(struct devic {struct device_node *mediabay;struct floppy_state *fs = &floppy_states[floppy_count]; +struct resource res_reg, res_dma; -if (swim->n_addrs <2 ) - { -printk (KERN_INFO "swim3: expecting 2 addrs (n_addrs:%d, n_intrs:%d)\n" , - swim->n_addrs, swim->n_intrs); +if (of_address_to_resource (swim,0 , &res_reg) || +of_address_to_resource (swim,1 , &res_dma)) { +printk (KERN_ERR "swim3: Can't get addresses\n" );return -EINVAL ; } - -if (swim->n_intrs <2 ) - { -printk (KERN_INFO "swim3: expecting 2 intrs (n_addrs:%d, n_intrs:%d)\n" , - swim->n_addrs, swim->n_intrs); +if (request_mem_region (res_reg.start, res_reg.end - res_reg.start +1 , +" (reg)" ) ==NULL ) { +printk (KERN_ERR "swim3: Can't request register space\n" ); +return -EINVAL ; + } +if (request_mem_region (res_dma.start, res_dma.end - res_dma.start +1 , +" (dma)" ) ==NULL ) { +release_mem_region (res_reg.start, + res_reg.end - res_reg.start +1 ); +printk (KERN_ERR "swim3: Can't request DMA space\n" );return -EINVAL ; } -if (!request_OF_resource (swim,0 ,NULL )) { -printk (KERN_INFO "swim3: can't request IO resource !\n" ); +if (swim->n_intrs <2 ) { +printk (KERN_INFO "swim3: expecting 2 intrs (n_intrs:%d)\n" , + swim->n_intrs); +release_mem_region (res_reg.start, + res_reg.end - res_reg.start +1 ); +release_mem_region (res_dma.start, + res_dma.end - res_dma.start +1 );return -EINVAL ; }
@@ -1110,10 +1120,8 @@ static int swim3_add_device(struct devicmemset (fs,0 ,sizeof (*fs));spin_lock_init (&fs->lock); fs->state = idle; - fs->swim3 = (struct swim3 __iomem *) -ioremap (swim->addrs[0 ].address,0x200 ); - fs->dma = (struct dbdma_regs __iomem *) -ioremap (swim->addrs[1 ].address,0x200 ); + fs->swim3 = (struct swim3 __iomem *)ioremap (res_reg.start,0x200 ); + fs->dma = (struct dbdma_regs __iomem *)ioremap (res_dma.start,0x200 ); fs->swim3_intr = swim->intrs[0 ].line; fs->dma_intr = swim->intrs[1 ].line; fs->cur_cyl =-1 ;
arch/powerpc/kernel/prom_init.c +2 -1
@@ -558,7 +558,8 @@ unsigned long prom_memparse(const char *static void __init early_cmdline_parse (void ) {struct prom_t *_prom = &RELOC (prom); -char *opt, *p; +const char *opt; +char *p;int l =0 ;RELOC (prom_cmd_line[0 ]) =0 ;
arch/powerpc/kernel/rtas_pci.c +12 -37
102 lines not on this page · raw message
arch/powerpc/mm/numa.c +4 -2
@@ -432,7 +432,8 @@ static int __init parse_numa_properties(if (!memcell_buf || len <=0 )continue ; - ranges = memory->n_addrs; +/* ranges in cell */ + ranges = (len >>2 ) / (n_mem_addr_cells + n_mem_size_cells); new_range:/* these are order-sensitive, and modify the buffer pointer */ start =read_n_cells (n_mem_addr_cells, &memcell_buf);
@@ -746,7 +747,8 @@ int hot_add_scn_to_nid(unsigned long scnif (!memcell_buf || len <=0 )continue ; - ranges = memory->n_addrs;/* ranges in cell */ +/* ranges in cell */ + ranges = (len >>2 ) / (n_mem_addr_cells + n_mem_size_cells); ha_new_range: start =read_n_cells (n_mem_addr_cells, &memcell_buf); size =read_n_cells (n_mem_size_cells, &memcell_buf);
Quoted 10 lines · Benjamin Herrenschmidt
The pre-parsed addrs/n_addrs fields in struct
device_nodeare finally gone. Remove the dodgy heuristics that did that parsing at boot and remove the fields themselves since we now have a good replacement with the new OF parsing code. This patch also fixes a bunch of drivers to use the new code instead, so that at least pmac32, pseries, iseries and g5 defconfigs build.+++
linux-work/include/asm-powerpc/prom.h2005-12-13 17:51:20.000000000 +1100
include/asm-powerpc/prom.h struct device_node { · line 87
Quoted 8 lines
include/asm-powerpc/prom.h +0
-2@@ -120,8 +82,6 @@ struct device_node {char *type;phandle node;phandle linux_phandle; -int n_addrs; -struct address_range *addrs;int n_intrs;struct interrupt_info *intrs;char *full_name;
Is this patch supposed to be complete? I will find references to n_addrs in arch/powerpc:
hydra_init, chrp_find_bridges, chrp_find_openpic, comment in of_finish_dynamic_node.
Signature · 2 lines
short story of a lazy sysadmin: alias appserv=wotan
Quoted 24 lines · Olaf Hering
Quoted 10 lines · Benjamin Herrenschmidt
The pre-parsed addrs/n_addrs fields in struct
device_nodeare finally gone. Remove the dodgy heuristics that did that parsing at boot and remove the fields themselves since we now have a good replacement with the new OF parsing code. This patch also fixes a bunch of drivers to use the new code instead, so that at least pmac32, pseries, iseries and g5 defconfigs build.+++
linux-work/include/asm-powerpc/prom.h2005-12-13 17:51:20.000000000 +1100include/asm-powerpc/prom.h struct device_node { · line 87
Quoted 8 lines
include/asm-powerpc/prom.h +0
-2@@ -120,8 +82,6 @@ struct device_node {char *type;phandle node;phandle linux_phandle; -int n_addrs; -struct address_range *addrs;int n_intrs;struct interrupt_info *intrs;char *full_name;Is this patch supposed to be complete? I will find references to
n_addrsinarch/powerpc:
Quoted 2 lines
hydra_init,chrp_find_bridges,chrp_find_openpic, comment inof_finish_dynamic_node.
No, it's complete as far as powermac is concerned. I'll deal with the remaining bits this week.
Ben.