Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ */
0002 /*
0003  * Definitions for building a device tree by calling into the
0004  * Open Firmware PROM.
0005  *
0006  * Copyright (C) 2010  Andres Salomon <dilinger@queued.net>
0007  */
0008 
0009 #ifndef _LINUX_OF_PDT_H
0010 #define _LINUX_OF_PDT_H
0011 
0012 /* overridable operations for calling into the PROM */
0013 struct of_pdt_ops {
0014     /*
0015      * buf should be 32 bytes; return 0 on success.
0016      * If prev is NULL, the first property will be returned.
0017      */
0018     int (*nextprop)(phandle node, char *prev, char *buf);
0019 
0020     /* for both functions, return proplen on success; -1 on error */
0021     int (*getproplen)(phandle node, const char *prop);
0022     int (*getproperty)(phandle node, const char *prop, char *buf,
0023             int bufsize);
0024 
0025     /* phandles are 0 if no child or sibling exists */
0026     phandle (*getchild)(phandle parent);
0027     phandle (*getsibling)(phandle node);
0028 
0029     /* return 0 on success; fill in 'len' with number of bytes in path */
0030     int (*pkg2path)(phandle node, char *buf, const int buflen, int *len);
0031 };
0032 
0033 extern void *prom_early_alloc(unsigned long size);
0034 
0035 /* for building the device tree */
0036 extern void of_pdt_build_devicetree(phandle root_node, struct of_pdt_ops *ops);
0037 
0038 #endif /* _LINUX_OF_PDT_H */