^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * oplib.h: Describes the interface and available routines in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Linux Prom library.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #ifndef __SPARC_OPLIB_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define __SPARC_OPLIB_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <asm/openprom.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) /* The master romvec pointer... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) extern struct linux_romvec *romvec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) /* Enumeration to describe the prom major version we have detected. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) enum prom_major_version {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) PROM_V0, /* Original sun4c V0 prom */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) PROM_V2, /* sun4c and early sun4m V2 prom */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) PROM_V3, /* sun4m and later, up to sun4d/sun4e machines V3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) PROM_P1275, /* IEEE compliant ISA based Sun PROM, only sun4u */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) extern enum prom_major_version prom_vers;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) /* Revision, and firmware revision. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) extern unsigned int prom_rev, prom_prev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) /* Root node of the prom device tree, this stays constant after
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * initialization is complete.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) extern int prom_root_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /* Pointer to prom structure containing the device tree traversal
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) * and usage utility functions. Only prom-lib should use these,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * users use the interface defined by the library only!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) extern struct linux_nodeops *prom_nodeops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) /* The functions... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) /* You must call prom_init() before using any of the library services,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * preferably as early as possible. Pass it the romvec pointer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) extern void prom_init(struct linux_romvec *rom_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) /* Boot argument acquisition, returns the boot command line string. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) extern char *prom_getbootargs(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) /* Device utilities. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) /* Map and unmap devices in IO space at virtual addresses. Note that the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) * virtual address you pass is a request and the prom may put your mappings
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) * somewhere else, so check your return value as that is where your new
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) * mappings really are!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) * Another note, these are only available on V2 or higher proms!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) extern char *prom_mapio(char *virt_hint, int io_space, unsigned int phys_addr, unsigned int num_bytes);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) extern void prom_unmapio(char *virt_addr, unsigned int num_bytes);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) /* Device operations. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) /* Open the device described by the passed string. Note, that the format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) * of the string is different on V0 vs. V2->higher proms. The caller must
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) * know what he/she is doing! Returns the device descriptor, an int.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) extern int prom_devopen(char *device_string);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) /* Close a previously opened device described by the passed integer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) * descriptor.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) extern int prom_devclose(int device_handle);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) /* Do a seek operation on the device described by the passed integer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) * descriptor.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) extern void prom_seek(int device_handle, unsigned int seek_hival,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) unsigned int seek_lowval);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) /* Machine memory configuration routine. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) /* This function returns a V0 format memory descriptor table, it has three
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) * entries. One for the total amount of physical ram on the machine, one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) * for the amount of physical ram available, and one describing the virtual
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) * areas which are allocated by the prom. So, in a sense the physical
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) * available is a calculation of the total physical minus the physical mapped
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) * by the prom with virtual mappings.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) * These lists are returned pre-sorted, this should make your life easier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) * since the prom itself is way too lazy to do such nice things.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) extern struct linux_mem_v0 *prom_meminfo(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) /* Miscellaneous routines, don't really fit in any category per se. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) /* Reboot the machine with the command line passed. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) extern void prom_reboot(char *boot_command);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) /* Evaluate the forth string passed. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) extern void prom_feval(char *forth_string);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) /* Enter the prom, with possibility of continuation with the 'go'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) * command in newer proms.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) extern void prom_cmdline(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) /* Enter the prom, with no chance of continuation for the stand-alone
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) * which calls this.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) extern void prom_halt(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) /* Set the PROM 'sync' callback function to the passed function pointer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) * When the user gives the 'sync' command at the prom prompt while the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) * kernel is still active, the prom will call this routine.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) * XXX The arguments are different on V0 vs. V2->higher proms, grrr! XXX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) typedef void (*sync_func_t)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) extern void prom_setsync(sync_func_t func_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) /* Acquire the IDPROM of the root node in the prom device tree. This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) * gets passed a buffer where you would like it stuffed. The return value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) * is the format type of this idprom or 0xff on error.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) extern unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) /* Get the prom major version. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) extern int prom_version(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) /* Get the prom plugin revision. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) extern int prom_getrev(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) /* Get the prom firmware revision. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) extern int prom_getprev(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) /* Character operations to/from the console.... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) /* Non-blocking get character from console. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) extern int prom_nbgetchar(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) /* Non-blocking put character to console. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) extern int prom_nbputchar(char character);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) /* Blocking get character from console. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) extern char prom_getchar(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) /* Blocking put character to console. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) extern void prom_putchar(char character);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) /* Prom's internal printf routine, don't use in kernel/boot code. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) void prom_printf(char *fmt, ...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) /* Query for input device type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) enum prom_input_device {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) PROMDEV_IKBD, /* input from keyboard */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) PROMDEV_ITTYA, /* input from ttya */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) PROMDEV_ITTYB, /* input from ttyb */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) PROMDEV_I_UNK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) extern enum prom_input_device prom_query_input_device(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) /* Query for output device type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) enum prom_output_device {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) PROMDEV_OSCREEN, /* to screen */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) PROMDEV_OTTYA, /* to ttya */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) PROMDEV_OTTYB, /* to ttyb */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) PROMDEV_O_UNK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) extern enum prom_output_device prom_query_output_device(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) /* Multiprocessor operations... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) /* Start the CPU with the given device tree node, context table, and context
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) * at the passed program counter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) extern int prom_startcpu(int cpunode, struct linux_prom_registers *context_table,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) int context, char *program_counter);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) /* Stop the CPU with the passed device tree node. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) extern int prom_stopcpu(int cpunode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) /* Idle the CPU with the passed device tree node. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) extern int prom_idlecpu(int cpunode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) /* Re-Start the CPU with the passed device tree node. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) extern int prom_restartcpu(int cpunode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) /* PROM memory allocation facilities... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) /* Allocated at possibly the given virtual address a chunk of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) * indicated size.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) extern char *prom_alloc(char *virt_hint, unsigned int size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) /* Free a previously allocated chunk. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) extern void prom_free(char *virt_addr, unsigned int size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) /* Sun4/sun4c specific memory-management startup hook. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) /* Map the passed segment in the given context at the passed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) * virtual address.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) extern void prom_putsegment(int context, unsigned long virt_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) int physical_segment);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) /* PROM device tree traversal functions... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) /* Get the child node of the given node, or zero if no child exists. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) extern int prom_getchild(int parent_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) /* Get the next sibling node of the given node, or zero if no further
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) * siblings exist.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) extern int prom_getsibling(int node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) /* Get the length, at the passed node, of the given property type.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) * Returns -1 on error (ie. no such property at this node).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) extern int prom_getproplen(int thisnode, char *property);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) /* Fetch the requested property using the given buffer. Returns
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) * the number of bytes the prom put into your buffer or -1 on error.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) extern int prom_getproperty(int thisnode, char *property,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) char *prop_buffer, int propbuf_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) /* Acquire an integer property. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) extern int prom_getint(int node, char *property);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) /* Acquire an integer property, with a default value. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) extern int prom_getintdefault(int node, char *property, int defval);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) /* Acquire a boolean property, 0=FALSE 1=TRUE. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) extern int prom_getbool(int node, char *prop);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) /* Acquire a string property, null string on error. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) extern void prom_getstring(int node, char *prop, char *buf, int bufsize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) /* Does the passed node have the given "name"? YES=1 NO=0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) extern int prom_nodematch(int thisnode, char *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) /* Search all siblings starting at the passed node for "name" matching
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) * the given string. Returns the node on success, zero on failure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) extern int prom_searchsiblings(int node_start, char *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) /* Return the first property type, as a string, for the given node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) * Returns a null string on error.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) extern char *prom_firstprop(int node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) /* Returns the next property after the passed property for the given
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) * node. Returns null string on failure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) extern char *prom_nextprop(int node, char *prev_property);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) /* Returns 1 if the specified node has given property. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) extern int prom_node_has_property(int node, char *property);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) /* Set the indicated property at the given node with the passed value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) * Returns the number of bytes of your value that the prom took.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) extern int prom_setprop(int node, char *prop_name, char *prop_value,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) int value_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) extern int prom_pathtoinode(char *path);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) extern int prom_inst2pkg(int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) /* Dorking with Bus ranges... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) /* Adjust reg values with the passed ranges. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) extern void prom_adjust_regs(struct linux_prom_registers *regp, int nregs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) struct linux_prom_ranges *rangep, int nranges);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) /* Adjust child ranges with the passed parent ranges. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) extern void prom_adjust_ranges(struct linux_prom_ranges *cranges, int ncranges,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) struct linux_prom_ranges *pranges, int npranges);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) /* Apply promlib probed OBIO ranges to registers. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) extern void prom_apply_obio_ranges(struct linux_prom_registers *obioregs, int nregs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) /* Apply ranges of any prom node (and optionally parent node as well) to registers. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) extern void prom_apply_generic_ranges(int node, int parent,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) struct linux_prom_registers *sbusregs, int nregs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) #endif /* !(__SPARC_OPLIB_H) */