#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/init.h>
-#include <linux/version.h>
#include <linux/threads.h>
#include <linux/spinlock.h>
#include <linux/ioport.h>
#include <linux/pci.h>
#include <linux/slab.h>
+#include <linux/bitops.h>
#include <asm/sections.h>
#include <asm/prom.h>
#include <asm/system.h>
#include <asm/mmu.h>
#include <asm/pgtable.h>
-#include <asm/bitops.h>
#include <asm/bootinfo.h>
#include <asm/btext.h>
#include <asm/pci-bridge.h>
struct device_node *dflt_interrupt_controller;
int num_interrupt_controllers;
-int pmac_newworld;
-
extern unsigned int rtas_entry; /* physical pointer */
extern struct device_node *allnodes;
extern boot_infos_t *boot_infos;
unsigned long dev_tree_size;
-void __openfirmware
+void
phys_call_rtas(int service, int nargs, int nret, ...)
{
va_list list;
unsigned long mem = (unsigned long) klimit;
struct device_node *np;
- /* All newworld pmac machines and CHRPs now use the interrupt tree */
+ /* All CHRPs now use the interrupt tree */
for (np = allnodes; np != NULL; np = np->allnext) {
- if (get_property(np, "interrupt-parent", 0)) {
+ if (get_property(np, "interrupt-parent", NULL)) {
use_of_interrupt_tree = 1;
break;
}
}
- if (_machine == _MACH_Pmac && use_of_interrupt_tree)
- pmac_newworld = 1;
-
-#ifdef CONFIG_BOOTX_TEXT
- if (boot_infos && pmac_newworld) {
- prom_print("WARNING ! BootX/miBoot booting is not supported on this machine\n");
- prom_print(" You should use an Open Firmware bootloader\n");
- }
-#endif /* CONFIG_BOOTX_TEXT */
if (use_of_interrupt_tree) {
/*
struct device_node *child;
int *ip;
- np->name = get_property(np, "name", 0);
- np->type = get_property(np, "device_type", 0);
+ np->name = get_property(np, "name", NULL);
+ np->type = get_property(np, "device_type", NULL);
if (!np->name)
np->name = "<NULL>";
mem_start = finish_node_interrupts(np, mem_start);
/* Look for #address-cells and #size-cells properties. */
- ip = (int *) get_property(np, "#address-cells", 0);
+ ip = (int *) get_property(np, "#address-cells", NULL);
if (ip != NULL)
naddrc = *ip;
- ip = (int *) get_property(np, "#size-cells", 0);
+ ip = (int *) get_property(np, "#size-cells", NULL);
if (ip != NULL)
nsizec = *ip;
struct device_node *p, *ipar;
unsigned int *imap, *imask, *ip;
int i, imaplen, match;
- int newintrc, newaddrc;
+ int newintrc = 1, newaddrc = 1;
unsigned int *reg;
int naddrc;
* those machines, we want to offset interrupts from the
* second openpic by 128 -- BenH
*/
- if (_machine != _MACH_Pmac && num_interrupt_controllers > 1
+ if (num_interrupt_controllers > 1
&& ic != NULL
&& get_property(ic, "interrupt-parent", NULL) == NULL)
offset = 16;
- else if (_machine == _MACH_Pmac && num_interrupt_controllers > 1
- && ic != NULL && ic->parent != NULL) {
- char *name = get_property(ic->parent, "name", NULL);
- if (name && !strcmp(name, "u3"))
- offset = 128;
- }
np->intrs[i].line = irq[0] + offset;
if (n > 1)
do {
if (np->parent)
np = np->parent;
- ip = (int *) get_property(np, "#address-cells", 0);
+ ip = (int *) get_property(np, "#address-cells", NULL);
if (ip != NULL)
return *ip;
} while (np->parent);
do {
if (np->parent)
np = np->parent;
- ip = (int *) get_property(np, "#size-cells", 0);
+ ip = (int *) get_property(np, "#size-cells", NULL);
if (ip != NULL)
return *ip;
} while (np->parent);
prevp = &np->next;
}
}
- *prevp = 0;
+ *prevp = NULL;
return head;
}
prevp = &np->next;
}
}
- *prevp = 0;
+ *prevp = NULL;
return head;
}
/*
* Returns all nodes linked together
*/
-struct device_node * __openfirmware
+struct device_node *
find_all_nodes(void)
{
struct device_node *head, **prevp, *np;
*prevp = np;
prevp = &np->next;
}
- *prevp = 0;
+ *prevp = NULL;
return head;
}
prevp = &np->next;
}
}
- *prevp = 0;
+ *prevp = NULL;
return head;
}
*lenp = pp->length;
return pp->value;
}
- return 0;
+ return NULL;
}
/*
* Add a property to a node
*/
-void __openfirmware
+int
prom_add_property(struct device_node* np, struct property* prop)
{
struct property **next = &np->properties;
while (*next)
next = &(*next)->next;
*next = prop;
+
+ return 0;
}
/* I quickly hacked that one, check against spec ! */
-static inline unsigned long __openfirmware
+static inline unsigned long
bus_space_to_resource_flags(unsigned int bus_space)
{
u8 space = (bus_space >> 24) & 0xf;
}
}
-static struct resource* __openfirmware
+static struct resource*
find_parent_pci_resource(struct pci_dev* pdev, struct address_range *range)
{
unsigned long mask;
* or other nodes attached to the root node. Ultimately, put some
* link to resources in the OF node.
*/
-struct resource* __openfirmware
+struct resource*
request_OF_resource(struct device_node* node, int index, const char* name_postfix)
{
struct pci_dev* pcidev;
return NULL;
}
-int __openfirmware
+int
release_OF_resource(struct device_node* node, int index)
{
struct pci_dev* pcidev;
if (!res)
return -ENODEV;
- if (res->name) {
- kfree(res->name);
- res->name = NULL;
- }
+ kfree(res->name);
+ res->name = NULL;
release_resource(res);
kfree(res);
}
#if 0
-void __openfirmware
+void
print_properties(struct device_node *np)
{
struct property *pp;
}
#endif
-static spinlock_t rtas_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(rtas_lock);
/* this can be called after setup -- Cort */
-int __openfirmware
+int
call_rtas(const char *service, int nargs, int nret,
unsigned long *outputs, ...)
{