int __init mmio_nvram_init(void)
{ struct device_node *nvram_node; unsignedlong nvram_addr; struct resource r; int ret;
nvram_node = of_find_node_by_type(NULL, "nvram"); if (!nvram_node)
nvram_node = of_find_compatible_node(NULL, NULL, "nvram"); if (!nvram_node) {
printk(KERN_WARNING "nvram: no node found in device-tree\n"); return -ENODEV;
}
ret = of_address_to_resource(nvram_node, 0, &r); if (ret) {
printk(KERN_WARNING "nvram: failed to get address (err %d)\n",
ret); goto out;
}
nvram_addr = r.start;
mmio_nvram_len = resource_size(&r); if ( (!mmio_nvram_len) || (!nvram_addr) ) {
printk(KERN_WARNING "nvram: address or length is 0\n");
ret = -EIO; goto out;
}
mmio_nvram_start = ioremap(nvram_addr, mmio_nvram_len); if (!mmio_nvram_start) {
printk(KERN_WARNING "nvram: failed to ioremap\n");
ret = -ENOMEM; goto out;
}
printk(KERN_INFO "mmio NVRAM, %luk at 0x%lx mapped to %p\n",
mmio_nvram_len >> 10, nvram_addr, mmio_nvram_start);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.