/* * oplib.h: Describes the interface and available routines in the * Linux Prom library. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) */ #ifndef __SPARC_OPLIB_H #define __SPARC_OPLIB_H #include /* The master romvec pointer... */ extern struct linux_romvec *romvec; /* Enumeration to describe the prom major version we have detected. */ enum prom_major_version { PROM_V0, /* Original sun4c V0 prom */ PROM_V2, /* sun4c and early sun4m V2 prom */ PROM_V3, /* sun4m and later, up to sun4d/sun4e machines V3 */ PROM_P1275, /* IEEE compliant ISA based Sun PROM, only sun4u */ }; extern enum prom_major_version prom_vers; /* Revision, and firmware revision. */ extern unsigned int prom_rev, prom_prev; /* Root node of the prom device tree, this stays constant after * initialization is complete. */ extern int prom_root_node; /* Pointer to prom structure containing the device tree traversal * and usage utility functions. Only prom-lib should use these, * users use the interface defined by the library only! */ extern struct linux_nodeops *prom_nodeops; /* The functions... */ /* You must call prom_init() before using any of the library services, * preferably as early as possible. Pass it the romvec pointer. */ extern void prom_init(struct linux_romvec *rom_ptr); /* Boot argument acquisition, returns the boot command line string. */ extern char *prom_getbootargs(void); /* Device utilities. */ /* Map and unmap devices in IO space at virtual addresses. Note that the * virtual address you pass is a request and the prom may put your mappings * somewhere else, so check your return value as that is where your new * mappings really are! * * Another note, these are only available on V2 or higher proms! */ extern char *prom_mapio(char *virt_hint, int io_space, unsigned int phys_addr, unsigned int num_bytes); extern void prom_unmapio(char *virt_addr, unsigned int num_bytes); /* Device operations. */ /* Open the device described by the passed string. Note, that the format * of the string is different on V0 vs. V2->higher proms. The caller must * know what he/she is doing! Returns the device descriptor, an int. */ extern int prom_devopen(char *device_string); /* Close a previously opened device described by the passed integer * descriptor. */ extern int prom_devclose(int device_handle); /* Do a seek operation on the device described by the passed integer * descriptor. */ extern void prom_seek(int device_handle, unsigned int seek_hival, unsigned int seek_lowval); /* Machine memory configuration routine. */ /* This function returns a V0 format memory descriptor table, it has three * entries. One for the total amount of physical ram on the machine, one * for the amount of physical ram available, and one describing the virtual * areas which are allocated by the prom. So, in a sense the physical * available is a calculation of the total physical minus the physical mapped * by the prom with virtual mappings. * * These lists are returned pre-sorted, this should make your life easier * since the prom itself is way too lazy to do such nice things. */ extern struct linux_mem_v0 *prom_meminfo(void); /* Miscellaneous routines, don't really fit in any category per se. */ /* Reboot the machine with the command line passed. */ extern void prom_reboot(char *boot_command); /* Evaluate the forth string passed. */ extern void prom_feval(char *forth_string); /* Enter the prom, with possibility of continuation with the 'go' * command in newer proms. */ extern void prom_cmdline(void); /* Enter the prom, with no chance of continuation for the stand-alone * which calls this. */ extern void prom_halt(void); /* Set the PROM 'sync' callback function to the passed function pointer. * When the user gives the 'sync' command at the prom prompt while the * kernel is still active, the prom will call this routine. * * XXX The arguments are different on V0 vs. V2->higher proms, grrr! XXX */