|
@@ -115,3 +115,177 @@ extern void prom_halt(void);
|
|
|
*
|
|
|
* XXX The arguments are different on V0 vs. V2->higher proms, grrr! XXX
|
|
|
*/
|
|
|
+typedef void (*sync_func_t)(void);
|
|
|
+extern void prom_setsync(sync_func_t func_ptr);
|
|
|
+
|
|
|
+/* Acquire the IDPROM of the root node in the prom device tree. This
|
|
|
+ * gets passed a buffer where you would like it stuffed. The return value
|
|
|
+ * is the format type of this idprom or 0xff on error.
|
|
|
+ */
|
|
|
+extern unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size);
|
|
|
+
|
|
|
+/* Get the prom major version. */
|
|
|
+extern int prom_version(void);
|
|
|
+
|
|
|
+/* Get the prom plugin revision. */
|
|
|
+extern int prom_getrev(void);
|
|
|
+
|
|
|
+/* Get the prom firmware revision. */
|
|
|
+extern int prom_getprev(void);
|
|
|
+
|
|
|
+/* Character operations to/from the console.... */
|
|
|
+
|
|
|
+/* Non-blocking get character from console. */
|
|
|
+extern int prom_nbgetchar(void);
|
|
|
+
|
|
|
+/* Non-blocking put character to console. */
|
|
|
+extern int prom_nbputchar(char character);
|
|
|
+
|
|
|
+/* Blocking get character from console. */
|
|
|
+extern char prom_getchar(void);
|
|
|
+
|
|
|
+/* Blocking put character to console. */
|
|
|
+extern void prom_putchar(char character);
|
|
|
+
|
|
|
+/* Prom's internal printf routine, don't use in kernel/boot code. */
|
|
|
+void prom_printf(char *fmt, ...);
|
|
|
+
|
|
|
+/* Query for input device type */
|
|
|
+
|
|
|
+enum prom_input_device {
|
|
|
+ PROMDEV_IKBD, /* input from keyboard */
|
|
|
+ PROMDEV_ITTYA, /* input from ttya */
|
|
|
+ PROMDEV_ITTYB, /* input from ttyb */
|
|
|
+ PROMDEV_I_UNK,
|
|
|
+};
|
|
|
+
|
|
|
+extern enum prom_input_device prom_query_input_device(void);
|
|
|
+
|
|
|
+/* Query for output device type */
|
|
|
+
|
|
|
+enum prom_output_device {
|
|
|
+ PROMDEV_OSCREEN, /* to screen */
|
|
|
+ PROMDEV_OTTYA, /* to ttya */
|
|
|
+ PROMDEV_OTTYB, /* to ttyb */
|
|
|
+ PROMDEV_O_UNK,
|
|
|
+};
|
|
|
+
|
|
|
+extern enum prom_output_device prom_query_output_device(void);
|
|
|
+
|
|
|
+/* Multiprocessor operations... */
|
|
|
+
|
|
|
+/* Start the CPU with the given device tree node, context table, and context
|
|
|
+ * at the passed program counter.
|
|
|
+ */
|
|
|
+extern int prom_startcpu(int cpunode, struct linux_prom_registers *context_table,
|
|
|
+ int context, char *program_counter);
|
|
|
+
|
|
|
+/* Stop the CPU with the passed device tree node. */
|
|
|
+extern int prom_stopcpu(int cpunode);
|
|
|
+
|
|
|
+/* Idle the CPU with the passed device tree node. */
|
|
|
+extern int prom_idlecpu(int cpunode);
|
|
|
+
|
|
|
+/* Re-Start the CPU with the passed device tree node. */
|
|
|
+extern int prom_restartcpu(int cpunode);
|
|
|
+
|
|
|
+/* PROM memory allocation facilities... */
|
|
|
+
|
|
|
+/* Allocated at possibly the given virtual address a chunk of the
|
|
|
+ * indicated size.
|
|
|
+ */
|
|
|
+extern char *prom_alloc(char *virt_hint, unsigned int size);
|
|
|
+
|
|
|
+/* Free a previously allocated chunk. */
|
|
|
+extern void prom_free(char *virt_addr, unsigned int size);
|
|
|
+
|
|
|
+/* Sun4/sun4c specific memory-management startup hook. */
|
|
|
+
|
|
|
+/* Map the passed segment in the given context at the passed
|
|
|
+ * virtual address.
|
|
|
+ */
|
|
|
+extern void prom_putsegment(int context, unsigned long virt_addr,
|
|
|
+ int physical_segment);
|
|
|
+
|
|
|
+/* PROM device tree traversal functions... */
|
|
|
+
|
|
|
+/* Get the child node of the given node, or zero if no child exists. */
|
|
|
+extern int prom_getchild(int parent_node);
|
|
|
+
|
|
|
+/* Get the next sibling node of the given node, or zero if no further
|
|
|
+ * siblings exist.
|
|
|
+ */
|
|
|
+extern int prom_getsibling(int node);
|
|
|
+
|
|
|
+/* Get the length, at the passed node, of the given property type.
|
|
|
+ * Returns -1 on error (ie. no such property at this node).
|
|
|
+ */
|
|
|
+extern int prom_getproplen(int thisnode, char *property);
|
|
|
+
|
|
|
+/* Fetch the requested property using the given buffer. Returns
|
|
|
+ * the number of bytes the prom put into your buffer or -1 on error.
|
|
|
+ */
|
|
|
+extern int prom_getproperty(int thisnode, char *property,
|
|
|
+ char *prop_buffer, int propbuf_size);
|
|
|
+
|
|
|
+/* Acquire an integer property. */
|
|
|
+extern int prom_getint(int node, char *property);
|
|
|
+
|
|
|
+/* Acquire an integer property, with a default value. */
|
|
|
+extern int prom_getintdefault(int node, char *property, int defval);
|
|
|
+
|
|
|
+/* Acquire a boolean property, 0=FALSE 1=TRUE. */
|
|
|
+extern int prom_getbool(int node, char *prop);
|
|
|
+
|
|
|
+/* Acquire a string property, null string on error. */
|
|
|
+extern void prom_getstring(int node, char *prop, char *buf, int bufsize);
|
|
|
+
|
|
|
+/* Does the passed node have the given "name"? YES=1 NO=0 */
|
|
|
+extern int prom_nodematch(int thisnode, char *name);
|
|
|
+
|
|
|
+/* Search all siblings starting at the passed node for "name" matching
|
|
|
+ * the given string. Returns the node on success, zero on failure.
|
|
|
+ */
|
|
|
+extern int prom_searchsiblings(int node_start, char *name);
|
|
|
+
|
|
|
+/* Return the first property type, as a string, for the given node.
|
|
|
+ * Returns a null string on error.
|
|
|
+ */
|
|
|
+extern char *prom_firstprop(int node);
|
|
|
+
|
|
|
+/* Returns the next property after the passed property for the given
|
|
|
+ * node. Returns null string on failure.
|
|
|
+ */
|
|
|
+extern char *prom_nextprop(int node, char *prev_property);
|
|
|
+
|
|
|
+/* Returns 1 if the specified node has given property. */
|
|
|
+extern int prom_node_has_property(int node, char *property);
|
|
|
+
|
|
|
+/* Set the indicated property at the given node with the passed value.
|
|
|
+ * Returns the number of bytes of your value that the prom took.
|
|
|
+ */
|
|
|
+extern int prom_setprop(int node, char *prop_name, char *prop_value,
|
|
|
+ int value_size);
|
|
|
+
|
|
|
+extern int prom_pathtoinode(char *path);
|
|
|
+extern int prom_inst2pkg(int);
|
|
|
+
|
|
|
+/* Dorking with Bus ranges... */
|
|
|
+
|
|
|
+/* Adjust reg values with the passed ranges. */
|
|
|
+extern void prom_adjust_regs(struct linux_prom_registers *regp, int nregs,
|
|
|
+ struct linux_prom_ranges *rangep, int nranges);
|
|
|
+
|
|
|
+/* Adjust child ranges with the passed parent ranges. */
|
|
|
+extern void prom_adjust_ranges(struct linux_prom_ranges *cranges, int ncranges,
|
|
|
+ struct linux_prom_ranges *pranges, int npranges);
|
|
|
+
|
|
|
+/* Apply promlib probed OBIO ranges to registers. */
|
|
|
+extern void prom_apply_obio_ranges(struct linux_prom_registers *obioregs, int nregs);
|
|
|
+
|
|
|
+/* Apply ranges of any prom node (and optionally parent node as well) to registers. */
|
|
|
+extern void prom_apply_generic_ranges(int node, int parent,
|
|
|
+ struct linux_prom_registers *sbusregs, int nregs);
|
|
|
+
|
|
|
+
|
|
|
+#endif /* !(__SPARC_OPLIB_H) */
|