本文整理汇总了C++中prom_searchsiblings函数的典型用法代码示例。如果您正苦于以下问题:C++ prom_searchsiblings函数的具体用法?C++ prom_searchsiblings怎么用?C++ prom_searchsiblings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prom_searchsiblings函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: auxio_power_probe
void __init auxio_power_probe(void)
{
struct linux_prom_registers regs;
int node;
struct resource r;
/* Attempt to find the sun4m power control node. */
node = prom_getchild(prom_root_node);
node = prom_searchsiblings(node, "obio");
node = prom_getchild(node);
node = prom_searchsiblings(node, "power");
if (node == 0 || node == -1)
return;
/* Map the power control register. */
if (prom_getproperty(node, "reg", (char *)®s, sizeof(regs)) <= 0)
return;
prom_apply_obio_ranges(®s, 1);
memset(&r, 0, sizeof(r));
r.flags = regs.which_io & 0xF;
r.start = regs.phys_addr;
r.end = regs.phys_addr + regs.reg_size - 1;
auxio_power_register = (unsigned char *) of_ioremap(&r, 0,
regs.reg_size, "auxpower");
/* Display a quick message on the console. */
if (auxio_power_register)
printk(KERN_INFO "Power off control detected.\n");
}
示例2: auxio_power_probe
void __init auxio_power_probe(void)
{
struct linux_prom_registers regs;
phandle node;
struct resource r;
node = prom_getchild(prom_root_node);
node = prom_searchsiblings(node, "obio");
node = prom_getchild(node);
node = prom_searchsiblings(node, "power");
if (node == 0 || (s32)node == -1)
return;
if (prom_getproperty(node, "reg", (char *)®s, sizeof(regs)) <= 0)
return;
prom_apply_obio_ranges(®s, 1);
memset(&r, 0, sizeof(r));
r.flags = regs.which_io & 0xF;
r.start = regs.phys_addr;
r.end = regs.phys_addr + regs.reg_size - 1;
auxio_power_register = (unsigned char *) of_ioremap(&r, 0,
regs.reg_size, "auxpower");
if (auxio_power_register)
printk(KERN_INFO "Power off control detected.\n");
}
示例3: auxio_probe
void __init auxio_probe(void)
{
int node, auxio_nd;
struct linux_prom_registers auxregs[1];
struct resource r;
switch (sparc_cpu_model) {
case sun4d:
case sun4:
auxio_register = 0;
return;
default:
break;
}
node = prom_getchild(prom_root_node);
auxio_nd = prom_searchsiblings(node, "auxiliary-io");
if(!auxio_nd) {
node = prom_searchsiblings(node, "obio");
node = prom_getchild(node);
auxio_nd = prom_searchsiblings(node, "auxio");
if(!auxio_nd) {
#ifdef CONFIG_PCI
/* There may be auxio on Ebus */
auxio_register = 0;
return;
#else
if(prom_searchsiblings(node, "leds")) {
/* VME chassis sun4m machine, no auxio exists. */
auxio_register = 0;
return;
}
prom_printf("Cannot find auxio node, cannot continue...\n");
prom_halt();
#endif
}
}
prom_getproperty(auxio_nd, "reg", (char *) auxregs, sizeof(auxregs));
prom_apply_obio_ranges(auxregs, 0x1);
/* Map the register both read and write */
r.flags = auxregs[0].which_io & 0xF;
r.start = auxregs[0].phys_addr;
r.end = auxregs[0].phys_addr + auxregs[0].reg_size - 1;
auxio_register = (unsigned char *) sbus_ioremap(&r, 0,
auxregs[0].reg_size, "auxio");
/* Fix the address on sun4m and sun4c. */
if((((unsigned long) auxregs[0].phys_addr) & 3) == 3 ||
sparc_cpu_model == sun4c)
auxio_register = (unsigned char *) ((int)auxio_register | 3);
TURN_ON_LED;
}
示例4: auxio_probe
void __init auxio_probe(void)
{
phandle node, auxio_nd;
struct linux_prom_registers auxregs[1];
struct resource r;
switch (sparc_cpu_model) {
case sparc_leon:
case sun4d:
case sun4:
return;
default:
break;
}
node = prom_getchild(prom_root_node);
auxio_nd = prom_searchsiblings(node, "auxiliary-io");
if(!auxio_nd) {
node = prom_searchsiblings(node, "obio");
node = prom_getchild(node);
auxio_nd = prom_searchsiblings(node, "auxio");
if(!auxio_nd) {
#ifdef CONFIG_PCI
return;
#else
if(prom_searchsiblings(node, "leds")) {
return;
}
prom_printf("Cannot find auxio node, cannot continue...\n");
prom_halt();
#endif
}
}
if(prom_getproperty(auxio_nd, "reg", (char *) auxregs, sizeof(auxregs)) <= 0)
return;
prom_apply_obio_ranges(auxregs, 0x1);
r.flags = auxregs[0].which_io & 0xF;
r.start = auxregs[0].phys_addr;
r.end = auxregs[0].phys_addr + auxregs[0].reg_size - 1;
auxio_register = of_ioremap(&r, 0, auxregs[0].reg_size, "auxio");
if((((unsigned long) auxregs[0].phys_addr) & 3) == 3 ||
sparc_cpu_model == sun4c)
auxio_register += (3 - ((unsigned long)auxio_register & 3));
set_auxio(AUXIO_LED, 0);
}
示例5: pci_controller_scan
static int pci_controller_scan(int (*handler)(char *, int, int))
{
char namebuf[64];
int node;
int count = 0;
node = prom_getchild(prom_root_node);
while ((node = prom_searchsiblings(node, "pci")) != 0) {
int len;
if ((len = prom_getproperty(node, "model", namebuf, sizeof(namebuf))) > 0 ||
(len = prom_getproperty(node, "compatible", namebuf, sizeof(namebuf))) > 0) {
int item_len = 0;
/* Our value may be a multi-valued string in the
* case of some compatible properties. For sanity,
* only try the first one. */
while (namebuf[item_len] && len) {
len--;
item_len++;
}
if (handler(namebuf, item_len, node))
count++;
}
node = prom_getsibling(node);
if (!node)
break;
}
return count;
}
示例6: pci_controller_probe
/* Find each controller in the system, attach and initialize
* software state structure for each and link into the
* pci_controller_root. Setup the controller enough such
* that bus scanning can be done.
*/
static void pci_controller_probe(void)
{
char namebuf[16];
int node;
printk("PCI: Probing for controllers.\n");
node = prom_getchild(prom_root_node);
while ((node = prom_searchsiblings(node, "pci")) != 0) {
int len;
len = prom_getproperty(node, "model",
namebuf, sizeof(namebuf));
if (len > 0)
pci_controller_init(namebuf, len, node);
else {
len = prom_getproperty(node, "compatible",
namebuf, sizeof(namebuf));
if (len > 0)
pci_controller_init(namebuf, len, node);
}
node = prom_getsibling(node);
if (!node)
break;
}
}
示例7: prom_finddevice
int prom_finddevice(char *name)
{
char nbuf[128];
char *s = name, *d;
int node = prom_root_node, node2;
unsigned int which_io, phys_addr;
struct linux_prom_registers reg[PROMREG_MAX];
while (*s++) {
if (!*s) return node; /* path '.../' is legal */
node = prom_getchild(node);
for (d = nbuf; *s != 0 && *s != '@' && *s != '/';)
*d++ = *s++;
*d = 0;
node = prom_searchsiblings(node, nbuf);
if (!node)
return 0;
if (*s == '@') {
if (isxdigit(s[1]) && s[2] == ',') {
which_io = simple_strtoul(s+1, NULL, 16);
phys_addr = simple_strtoul(s+3, &d, 16);
if (d != s + 3 && (!*d || *d == '/')
&& d <= s + 3 + 8) {
node2 = node;
while (node2 && node2 != -1) {
if (prom_getproperty (node2, "reg", (char *)reg, sizeof (reg)) > 0) {
if (which_io == reg[0].which_io && phys_addr == reg[0].phys_addr) {
node = node2;
break;
}
}
node2 = prom_getsibling(node2);
if (!node2 || node2 == -1)
break;
node2 = prom_searchsiblings(prom_getsibling(node2), nbuf);
}
}
}
while (*s != 0 && *s != '/') s++;
}
}
return node;
}
示例8: d7s_obpflipped
static inline int d7s_obpflipped(void)
{
int opt_node;
opt_node = prom_getchild(prom_root_node);
opt_node = prom_searchsiblings(opt_node, "options");
return ((-1 != prom_getintdefault(opt_node, "d7s-flipped?", -1)) ? 0 : 1);
}
示例9: prom_ranges_init
void
prom_ranges_init(void)
{
int node, obio_node, sbus_node;
int success;
num_obio_ranges = 0;
num_sbus_ranges = 0;
/* Check for obio and sbus ranges. */
node = prom_getchild(prom_root_node);
obio_node = prom_searchsiblings(node, "obio");
sbus_node = prom_searchsiblings(node, "iommu");
if(sbus_node) {
sbus_node = prom_getchild(sbus_node);
sbus_node = prom_searchsiblings(sbus_node, "sbus");
}
if(obio_node) {
success = prom_getproperty(obio_node, "ranges",
(char *) promlib_obio_ranges,
sizeof(promlib_obio_ranges));
if(success != -1)
num_obio_ranges = (success/sizeof(struct linux_prom_ranges));
}
if(sbus_node) {
success = prom_getproperty(sbus_node, "ranges",
(char *) promlib_sbus_ranges,
sizeof(promlib_sbus_ranges));
if(success != -1)
num_sbus_ranges = (success/sizeof(struct linux_prom_ranges));
}
if(num_obio_ranges || num_sbus_ranges)
prom_printf("PROMLIB: obio_ranges %d sbus_ranges %d\n",
num_obio_ranges, num_sbus_ranges);
return;
}
示例10: __initfunc
__initfunc(void auxio_power_probe(void))
{
struct linux_prom_registers regs;
int node;
/* Attempt to find the sun4m power control node. */
node = prom_getchild(prom_root_node);
node = prom_searchsiblings(node, "obio");
node = prom_getchild(node);
node = prom_searchsiblings(node, "power");
if (node == 0 || node == -1)
return;
/* Map the power control register. */
prom_getproperty(node, "reg", (char *)®s, sizeof(regs));
prom_apply_obio_ranges(®s, 1);
auxio_power_register = (volatile unsigned char *)
sparc_alloc_io(regs.phys_addr, 0, regs.reg_size,
"power off control", regs.which_io, 0);
/* Display a quick message on the console. */
if (auxio_power_register)
printk(KERN_INFO "Power off control detected.\n");
}
示例11: prom_getchild
static char *serial(char *buffer)
{
int node = prom_getchild(prom_root_node);
int len;
node = prom_searchsiblings(node, "options");
*buffer = 0;
len = prom_getproperty(node, "system-board-serial#", buffer, 256);
if(len > 0)
buffer[len] = 0;
if (!*buffer)
return "4512348717234";
else
return buffer;
}
示例12: prom_meminit_v2
static int __init prom_meminit_v2(void)
{
struct linux_prom_registers reg[64];
int node, size, num_ents, i;
node = prom_searchsiblings(prom_getchild(prom_root_node), "memory");
size = prom_getproperty(node, "available", (char *) reg, sizeof(reg));
num_ents = size / sizeof(struct linux_prom_registers);
for (i = 0; i < num_ents; i++) {
sp_banks[i].base_addr = reg[i].phys_addr;
sp_banks[i].num_bytes = reg[i].reg_size;
}
return num_ents;
}
示例13: sun4c_init_IRQ
void __init sun4c_init_IRQ(void)
{
struct linux_prom_registers int_regs[2];
int ie_node;
if (ARCH_SUN4) {
interrupt_enable = (char *)
ioremap(sun4_ie_physaddr, PAGE_SIZE);
} else {
struct resource phyres;
ie_node = prom_searchsiblings (prom_getchild(prom_root_node),
"interrupt-enable");
if(ie_node == 0)
panic("Cannot find /interrupt-enable node");
/* Depending on the "address" property is bad news... */
prom_getproperty(ie_node, "reg", (char *) int_regs, sizeof(int_regs));
memset(&phyres, 0, sizeof(struct resource));
phyres.flags = int_regs[0].which_io;
phyres.start = int_regs[0].phys_addr;
interrupt_enable = (char *) sbus_ioremap(&phyres, 0,
int_regs[0].reg_size, "sun4c_intr");
}
BTFIXUPSET_CALL(sbint_to_irq, sun4c_sbint_to_irq, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(enable_irq, sun4c_enable_irq, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(disable_irq, sun4c_disable_irq, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(enable_pil_irq, sun4c_enable_irq, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(disable_pil_irq, sun4c_disable_irq, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(clear_clock_irq, sun4c_clear_clock_irq, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(clear_profile_irq, sun4c_clear_profile_irq, BTFIXUPCALL_NOP);
BTFIXUPSET_CALL(load_profile_irq, sun4c_load_profile_irq, BTFIXUPCALL_NOP);
BTFIXUPSET_CALL(__irq_itoa, sun4m_irq_itoa, BTFIXUPCALL_NORM);
sparc_init_timers = sun4c_init_timers;
#ifdef CONFIG_SMP
BTFIXUPSET_CALL(set_cpu_int, sun4c_nop, BTFIXUPCALL_NOP);
BTFIXUPSET_CALL(clear_cpu_int, sun4c_nop, BTFIXUPCALL_NOP);
BTFIXUPSET_CALL(set_irq_udt, sun4c_nop, BTFIXUPCALL_NOP);
#endif
*interrupt_enable = (SUN4C_INT_ENABLE);
/* Cannot enable interrupts until OBP ticker is disabled. */
}
示例14: openprom_init
static int __init openprom_init(void)
{
int error;
error = misc_register(&openprom_dev);
if (error) {
printk(KERN_ERR "openprom: unable to get misc minor\n");
return error;
}
options_node = prom_getchild(prom_root_node);
options_node = prom_searchsiblings(options_node,"options");
if (options_node == 0 || options_node == -1) {
printk(KERN_ERR "openprom: unable to find options node\n");
misc_deregister(&openprom_dev);
return -EIO;
}
return 0;
}
示例15: prom_getchild
const char *promcon_startup(void)
{
const char *display_desc = "PROM";
int node;
char buf[40];
node = prom_getchild(prom_root_node);
node = prom_searchsiblings(node, "options");
if (prom_getproperty(node, "screen-#columns", buf, 40) != -1) {
pw = simple_strtoul(buf, NULL, 0);
if (pw < 10 || pw > 256)
pw = 80;
pw--;
}
if (prom_getproperty(node, "screen-#rows", buf, 40) != -1) {
ph = simple_strtoul(buf, NULL, 0);
if (ph < 10 || ph > 256)
ph = 34;
ph--;
}
promcon_puts("\033[H\033[J", 6);
return display_desc;
}