162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci#include <linux/of.h>	/* linux/of.h gets to determine #include ordering */
362306a36Sopenharmony_ci#ifndef _SPARC_PROM_H
462306a36Sopenharmony_ci#define _SPARC_PROM_H
562306a36Sopenharmony_ci#ifdef __KERNEL__
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci/*
862306a36Sopenharmony_ci * Definitions for talking to the Open Firmware PROM on
962306a36Sopenharmony_ci * Power Macintosh computers.
1062306a36Sopenharmony_ci *
1162306a36Sopenharmony_ci * Copyright (C) 1996-2005 Paul Mackerras.
1262306a36Sopenharmony_ci *
1362306a36Sopenharmony_ci * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
1462306a36Sopenharmony_ci * Updates for SPARC by David S. Miller
1562306a36Sopenharmony_ci */
1662306a36Sopenharmony_ci#include <linux/types.h>
1762306a36Sopenharmony_ci#include <linux/of_pdt.h>
1862306a36Sopenharmony_ci#include <linux/proc_fs.h>
1962306a36Sopenharmony_ci#include <linux/mutex.h>
2062306a36Sopenharmony_ci#include <linux/atomic.h>
2162306a36Sopenharmony_ci#include <linux/irqdomain.h>
2262306a36Sopenharmony_ci#include <linux/spinlock.h>
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci#define of_compat_cmp(s1, s2, l)	strncmp((s1), (s2), (l))
2562306a36Sopenharmony_ci#define of_prop_cmp(s1, s2)		strcasecmp((s1), (s2))
2662306a36Sopenharmony_ci#define of_node_cmp(s1, s2)		strcmp((s1), (s2))
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ciextern raw_spinlock_t devtree_lock;
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_cistruct of_irq_controller {
3162306a36Sopenharmony_ci	unsigned int	(*irq_build)(struct device_node *, unsigned int, void *);
3262306a36Sopenharmony_ci	void		*data;
3362306a36Sopenharmony_ci};
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_cistruct device_node *of_find_node_by_cpuid(int cpuid);
3662306a36Sopenharmony_ciint of_set_property(struct device_node *node, const char *name, void *val, int len);
3762306a36Sopenharmony_ciextern struct mutex of_set_property_mutex;
3862306a36Sopenharmony_ciint of_getintprop_default(struct device_node *np,
3962306a36Sopenharmony_ci			  const char *name,
4062306a36Sopenharmony_ci				 int def);
4162306a36Sopenharmony_ciint of_find_in_proplist(const char *list, const char *match, int len);
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_civoid prom_build_devicetree(void);
4462306a36Sopenharmony_civoid of_populate_present_mask(void);
4562306a36Sopenharmony_civoid of_fill_in_cpu_data(void);
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_cistruct resource;
4862306a36Sopenharmony_civoid __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
4962306a36Sopenharmony_civoid of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ciextern struct device_node *of_console_device;
5262306a36Sopenharmony_ciextern char *of_console_path;
5362306a36Sopenharmony_ciextern char *of_console_options;
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_civoid irq_trans_init(struct device_node *dp);
5662306a36Sopenharmony_cichar *build_path_component(struct device_node *dp);
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci#endif /* __KERNEL__ */
5962306a36Sopenharmony_ci#endif /* _SPARC_PROM_H */
60