xref: /openbmc/linux/arch/sparc/include/asm/prom.h (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
12874c5fdSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
29d24c888SGrant Likely #include <linux/of.h>	/* linux/of.h gets to determine #include ordering */
3a439fe51SSam Ravnborg #ifndef _SPARC_PROM_H
4a439fe51SSam Ravnborg #define _SPARC_PROM_H
5a439fe51SSam Ravnborg #ifdef __KERNEL__
6a439fe51SSam Ravnborg 
7a439fe51SSam Ravnborg /*
8a439fe51SSam Ravnborg  * Definitions for talking to the Open Firmware PROM on
9a439fe51SSam Ravnborg  * Power Macintosh computers.
10a439fe51SSam Ravnborg  *
11a439fe51SSam Ravnborg  * Copyright (C) 1996-2005 Paul Mackerras.
12a439fe51SSam Ravnborg  *
13a439fe51SSam Ravnborg  * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
14a439fe51SSam Ravnborg  * Updates for SPARC by David S. Miller
15a439fe51SSam Ravnborg  */
16a439fe51SSam Ravnborg #include <linux/types.h>
173cfc535cSAndres Salomon #include <linux/of_pdt.h>
18a439fe51SSam Ravnborg #include <linux/proc_fs.h>
192481d766SDavid S. Miller #include <linux/mutex.h>
2060063497SArun Sharma #include <linux/atomic.h>
21d593f25fSGrant Likely #include <linux/irqdomain.h>
22*1dd5474eSRob Herring #include <linux/spinlock.h>
23a439fe51SSam Ravnborg 
24a439fe51SSam Ravnborg #define of_compat_cmp(s1, s2, l)	strncmp((s1), (s2), (l))
25a439fe51SSam Ravnborg #define of_prop_cmp(s1, s2)		strcasecmp((s1), (s2))
26a439fe51SSam Ravnborg #define of_node_cmp(s1, s2)		strcmp((s1), (s2))
27a439fe51SSam Ravnborg 
28*1dd5474eSRob Herring extern raw_spinlock_t devtree_lock;
29*1dd5474eSRob Herring 
30a439fe51SSam Ravnborg struct of_irq_controller {
31a439fe51SSam Ravnborg 	unsigned int	(*irq_build)(struct device_node *, unsigned int, void *);
32a439fe51SSam Ravnborg 	void		*data;
33a439fe51SSam Ravnborg };
34a439fe51SSam Ravnborg 
35f05a6865SSam Ravnborg struct device_node *of_find_node_by_cpuid(int cpuid);
36f05a6865SSam Ravnborg int of_set_property(struct device_node *node, const char *name, void *val, int len);
372481d766SDavid S. Miller extern struct mutex of_set_property_mutex;
38f05a6865SSam Ravnborg int of_getintprop_default(struct device_node *np,
39a439fe51SSam Ravnborg 			  const char *name,
40a439fe51SSam Ravnborg 				 int def);
41f05a6865SSam Ravnborg int of_find_in_proplist(const char *list, const char *match, int len);
42a439fe51SSam Ravnborg 
43f05a6865SSam Ravnborg void prom_build_devicetree(void);
44f05a6865SSam Ravnborg void of_populate_present_mask(void);
45f05a6865SSam Ravnborg void of_fill_in_cpu_data(void);
46a439fe51SSam Ravnborg 
4729596042SGrant Likely struct resource;
48f05a6865SSam Ravnborg void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
49f05a6865SSam Ravnborg void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
5029596042SGrant Likely 
51a439fe51SSam Ravnborg extern struct device_node *of_console_device;
52a439fe51SSam Ravnborg extern char *of_console_path;
53a439fe51SSam Ravnborg extern char *of_console_options;
54a439fe51SSam Ravnborg 
55f05a6865SSam Ravnborg void irq_trans_init(struct device_node *dp);
56f05a6865SSam Ravnborg char *build_path_component(struct device_node *dp);
570fd7ef1fSKonrad Eisele 
58a439fe51SSam Ravnborg #endif /* __KERNEL__ */
59a439fe51SSam Ravnborg #endif /* _SPARC_PROM_H */
60