Commit e35e7f30 authored by Anton Blanchard's avatar Anton Blanchard Committed by Linus Torvalds

[PATCH] ppc64: remove phb_set_model

phb_set_model does a lot of work just to set up a text string that almost
nothing uses.  Replace this all with an is_python() check.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6998d718
...@@ -256,7 +256,7 @@ unsigned long __init find_and_init_phbs(void) ...@@ -256,7 +256,7 @@ unsigned long __init find_and_init_phbs(void)
int ret = HvCallXm_testBus(bus); int ret = HvCallXm_testBus(bus);
if (ret == 0) { if (ret == 0) {
printk("bus %d appears to exist\n", bus); printk("bus %d appears to exist\n", bus);
phb = pci_alloc_pci_controller(phb_type_hypervisor); phb = pci_alloc_pci_controller();
if (phb == NULL) if (phb == NULL)
return -1; return -1;
phb->pci_mem_offset = phb->local_number = bus; phb->pci_mem_offset = phb->local_number = bus;
......
...@@ -325,7 +325,7 @@ static int __init add_bridge(struct device_node *dev) ...@@ -325,7 +325,7 @@ static int __init add_bridge(struct device_node *dev)
dev->full_name); dev->full_name);
} }
hose = pci_alloc_pci_controller(phb_type_apple); hose = pci_alloc_pci_controller();
if (!hose) if (!hose)
return -ENOMEM; return -ENOMEM;
hose->arch_data = dev; hose->arch_data = dev;
......
...@@ -149,6 +149,16 @@ struct pci_ops rtas_pci_ops = { ...@@ -149,6 +149,16 @@ struct pci_ops rtas_pci_ops = {
rtas_pci_write_config rtas_pci_write_config
}; };
static int is_python(struct device_node *dev)
{
char *model = (char *)get_property(dev, "model", NULL);
if (model && strstr(model, "Python"))
return 1;
return 0;
}
static void python_countermeasures(unsigned long addr) static void python_countermeasures(unsigned long addr)
{ {
void __iomem *chip_regs; void __iomem *chip_regs;
...@@ -218,33 +228,6 @@ unsigned long __devinit get_phb_buid (struct device_node *phb) ...@@ -218,33 +228,6 @@ unsigned long __devinit get_phb_buid (struct device_node *phb)
return buid; return buid;
} }
static enum phb_types get_phb_type(struct device_node *dev)
{
enum phb_types type;
char *model;
model = (char *)get_property(dev, "model", NULL);
if (!model) {
printk(KERN_ERR "%s: phb has no model property\n",
__FUNCTION__);
model = "<empty>";
}
if (strstr(model, "Python")) {
type = phb_type_python;
} else if (strstr(model, "Speedwagon")) {
type = phb_type_speedwagon;
} else if (strstr(model, "Winnipeg")) {
type = phb_type_winnipeg;
} else {
printk(KERN_ERR "%s: unknown PHB %s\n", __FUNCTION__, model);
type = phb_type_unknown;
}
return type;
}
static int get_phb_reg_prop(struct device_node *dev, static int get_phb_reg_prop(struct device_node *dev,
unsigned int addr_size_words, unsigned int addr_size_words,
struct reg_property64 *reg) struct reg_property64 *reg)
...@@ -288,21 +271,18 @@ static struct pci_controller *alloc_phb(struct device_node *dev, ...@@ -288,21 +271,18 @@ static struct pci_controller *alloc_phb(struct device_node *dev,
{ {
struct pci_controller *phb; struct pci_controller *phb;
struct reg_property64 reg_struct; struct reg_property64 reg_struct;
enum phb_types phb_type;
struct property *of_prop; struct property *of_prop;
int rc; int rc;
phb_type = get_phb_type(dev);
rc = get_phb_reg_prop(dev, addr_size_words, &reg_struct); rc = get_phb_reg_prop(dev, addr_size_words, &reg_struct);
if (rc) if (rc)
return NULL; return NULL;
phb = pci_alloc_pci_controller(phb_type); phb = pci_alloc_pci_controller();
if (phb == NULL) if (phb == NULL)
return NULL; return NULL;
if (phb_type == phb_type_python) if (is_python(dev))
python_countermeasures(reg_struct.address); python_countermeasures(reg_struct.address);
rc = phb_set_bus_ranges(dev, phb); rc = phb_set_bus_ranges(dev, phb);
...@@ -336,20 +316,17 @@ static struct pci_controller * __devinit alloc_phb_dynamic(struct device_node *d ...@@ -336,20 +316,17 @@ static struct pci_controller * __devinit alloc_phb_dynamic(struct device_node *d
{ {
struct pci_controller *phb; struct pci_controller *phb;
struct reg_property64 reg_struct; struct reg_property64 reg_struct;
enum phb_types phb_type;
int rc; int rc;
phb_type = get_phb_type(dev);
rc = get_phb_reg_prop(dev, addr_size_words, &reg_struct); rc = get_phb_reg_prop(dev, addr_size_words, &reg_struct);
if (rc) if (rc)
return NULL; return NULL;
phb = pci_alloc_phb_dynamic(phb_type); phb = pci_alloc_phb_dynamic();
if (phb == NULL) if (phb == NULL)
return NULL; return NULL;
if (phb_type == phb_type_python) if (is_python(dev))
python_countermeasures(reg_struct.address); python_countermeasures(reg_struct.address);
rc = phb_set_bus_ranges(dev, phb); rc = phb_set_bus_ranges(dev, phb);
......
...@@ -181,43 +181,10 @@ void pcibios_align_resource(void *data, struct resource *res, ...@@ -181,43 +181,10 @@ void pcibios_align_resource(void *data, struct resource *res,
res->start = start; res->start = start;
} }
static void phb_set_model(struct pci_controller *hose,
enum phb_types controller_type)
{
char *model;
switch(controller_type) {
#ifdef CONFIG_PPC_ISERIES
case phb_type_hypervisor:
model = "PHB HV";
break;
#endif
case phb_type_python:
model = "PHB PY";
break;
case phb_type_speedwagon:
model = "PHB SW";
break;
case phb_type_winnipeg:
model = "PHB WP";
break;
case phb_type_apple:
model = "PHB APPLE";
break;
default:
model = "PHB UK";
break;
}
if(strlen(model) < 8)
strcpy(hose->what,model);
else
memcpy(hose->what,model,7);
}
/* /*
* Allocate pci_controller(phb) initialized common variables. * Allocate pci_controller(phb) initialized common variables.
*/ */
struct pci_controller * __init pci_alloc_pci_controller(enum phb_types controller_type) struct pci_controller * __init pci_alloc_pci_controller()
{ {
struct pci_controller *hose; struct pci_controller *hose;
...@@ -233,10 +200,7 @@ struct pci_controller * __init pci_alloc_pci_controller(enum phb_types controlle ...@@ -233,10 +200,7 @@ struct pci_controller * __init pci_alloc_pci_controller(enum phb_types controlle
} }
memset(hose, 0, sizeof(struct pci_controller)); memset(hose, 0, sizeof(struct pci_controller));
phb_set_model(hose, controller_type);
hose->is_dynamic = 0; hose->is_dynamic = 0;
hose->type = controller_type;
hose->global_number = global_phb_number++; hose->global_number = global_phb_number++;
list_add_tail(&hose->list_node, &hose_list); list_add_tail(&hose->list_node, &hose_list);
...@@ -247,7 +211,7 @@ struct pci_controller * __init pci_alloc_pci_controller(enum phb_types controlle ...@@ -247,7 +211,7 @@ struct pci_controller * __init pci_alloc_pci_controller(enum phb_types controlle
/* /*
* Dymnamically allocate pci_controller(phb), initialize common variables. * Dymnamically allocate pci_controller(phb), initialize common variables.
*/ */
struct pci_controller * pci_alloc_phb_dynamic(enum phb_types controller_type) struct pci_controller * pci_alloc_phb_dynamic()
{ {
struct pci_controller *hose; struct pci_controller *hose;
...@@ -259,10 +223,7 @@ struct pci_controller * pci_alloc_phb_dynamic(enum phb_types controller_type) ...@@ -259,10 +223,7 @@ struct pci_controller * pci_alloc_phb_dynamic(enum phb_types controller_type)
} }
memset(hose, 0, sizeof(struct pci_controller)); memset(hose, 0, sizeof(struct pci_controller));
phb_set_model(hose, controller_type);
hose->is_dynamic = 1; hose->is_dynamic = 1;
hose->type = controller_type;
hose->global_number = global_phb_number++; hose->global_number = global_phb_number++;
list_add_tail(&hose->list_node, &hose_list); list_add_tail(&hose->list_node, &hose_list);
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
extern unsigned long isa_io_base; extern unsigned long isa_io_base;
extern struct pci_controller* pci_alloc_pci_controller(enum phb_types controller_type); extern struct pci_controller* pci_alloc_pci_controller(void);
extern struct pci_controller* pci_alloc_phb_dynamic(enum phb_types controller_type); extern struct pci_controller* pci_alloc_phb_dynamic(void);
extern void pci_setup_phb_io(struct pci_controller *hose, int primary); extern void pci_setup_phb_io(struct pci_controller *hose, int primary);
extern struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node); extern struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node);
...@@ -50,7 +50,8 @@ void pci_addr_cache_remove_device(struct pci_dev *dev); ...@@ -50,7 +50,8 @@ void pci_addr_cache_remove_device(struct pci_dev *dev);
void init_pci_config_tokens (void); void init_pci_config_tokens (void);
unsigned long get_phb_buid (struct device_node *); unsigned long get_phb_buid (struct device_node *);
extern int pci_probe_only; extern unsigned long pci_probe_only;
extern unsigned long pci_assign_all_buses;
extern int pci_read_irq_line(struct pci_dev *pci_dev); extern int pci_read_irq_line(struct pci_dev *pci_dev);
#endif /* __PPC_KERNEL_PCI_H__ */ #endif /* __PPC_KERNEL_PCI_H__ */
...@@ -614,7 +614,7 @@ static int __init add_bridge(struct device_node *dev) ...@@ -614,7 +614,7 @@ static int __init add_bridge(struct device_node *dev)
dev->full_name); dev->full_name);
} }
hose = pci_alloc_pci_controller(phb_type_apple); hose = pci_alloc_pci_controller();
if (!hose) if (!hose)
return -ENOMEM; return -ENOMEM;
hose->arch_data = dev; hose->arch_data = dev;
......
...@@ -18,21 +18,11 @@ struct pci_controller; ...@@ -18,21 +18,11 @@ struct pci_controller;
extern struct pci_controller* extern struct pci_controller*
pci_find_hose_for_OF_device(struct device_node* node); pci_find_hose_for_OF_device(struct device_node* node);
enum phb_types {
phb_type_unknown = 0x0,
phb_type_hypervisor = 0x1,
phb_type_python = 0x10,
phb_type_speedwagon = 0x11,
phb_type_winnipeg = 0x12,
phb_type_apple = 0xff
};
/* /*
* Structure of a PCI controller (host bridge) * Structure of a PCI controller (host bridge)
*/ */
struct pci_controller { struct pci_controller {
char what[8]; /* Eye catcher */ char what[8]; /* Eye catcher */
enum phb_types type; /* Type of hardware */
struct pci_bus *bus; struct pci_bus *bus;
char is_dynamic; char is_dynamic;
void *arch_data; void *arch_data;
......
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