本文整理汇总了C++中do_map_probe函数的典型用法代码示例。如果您正苦于以下问题:C++ do_map_probe函数的具体用法?C++ do_map_probe怎么用?C++ do_map_probe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了do_map_probe函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: armflash_cfi_init
static int __init armflash_cfi_init(void *base, u_int size)
{
int ret;
armflash_flash_init();
armflash_flash_wp(1);
/*
* look for CFI based flash parts fitted to this board
*/
armflash_map.size = size;
armflash_map.bankwidth = 4;
armflash_map.virt = (void __iomem *) base;
simple_map_init(&armflash_map);
/*
* Also, the CFI layer automatically works out what size
* of chips we have, and does the necessary identification
* for us automatically.
*/
mtd = do_map_probe("cfi_probe", &armflash_map);
if (!mtd)
return -ENXIO;
mtd->owner = THIS_MODULE;
ret = parse_mtd_partitions(mtd, probes, &parts, (void *)0);
if (ret > 0) {
ret = add_mtd_partitions(mtd, parts, ret);
if (ret)
printk(KERN_ERR "mtd partition registration "
"failed: %d\n", ret);
}
/*
* If we got an error, free all resources.
*/
if (ret < 0) {
del_mtd_partitions(mtd);
map_destroy(mtd);
}
return ret;
}
示例2: init_alteramap
int __init init_alteramap(void)
{
static const char *rom_probe_types[] = {"cfi_probe", "jedec_probe", 0 };
const char **type;
ndk_amd_map.virt = (unsigned long *)ioremap_nocache(WINDOW_ADDR, WINDOW_SIZE);
/*
if (!ndk_amd_map.virt) {
printk("Failed to ioremap\n");
return -EIO;
}
*/
simple_map_init(&ndk_amd_map);
mymtd = 0;
type = rom_probe_types;
for(; !mymtd && *type; type++) {
mymtd = do_map_probe(*type, &ndk_amd_map);
}
if (mymtd) {
mymtd->owner = THIS_MODULE;
mtd_parts_nb = parse_mtd_partitions(mymtd, part_probes,
&mtd_parts, 0);
if (mtd_parts_nb > 0)
{
mtd_device_register(mymtd, mtd_parts, mtd_parts_nb);
return 0;
}
if (NUM_PARTITIONS != 0)
{
printk(KERN_NOTICE
"Using Altera NDK partition definition\n");
mtd_device_register(mymtd, alteramap_partitions, NUM_PARTITIONS);
return 0;
}
return 0;
}
iounmap((void *)ndk_amd_map.virt);
return -ENXIO;
}
示例3: flash_init
static int __init flash_init(void)
{
/*
* Read the bootbus region 0 setup to determine the base
* address of the flash.
*/
union cvmx_mio_boot_reg_cfgx region_cfg;
region_cfg.u64 = cvmx_read_csr(CVMX_MIO_BOOT_REG_CFGX(0));
if (region_cfg.s.en) {
/*
* The bootloader always takes the flash and sets its
* address so the entire flash fits below
* 0x1fc00000. This way the flash aliases to
* 0x1fc00000 for booting. Software can access the
* full flash at the true address, while core boot can
* access 4MB.
*/
/* Use this name so old part lines work */
flash_map.name = "phys_mapped_flash";
flash_map.phys = region_cfg.s.base << 16;
flash_map.size = 0x1fc00000 - flash_map.phys;
flash_map.bankwidth = 1;
flash_map.virt = ioremap(flash_map.phys, flash_map.size);
pr_notice("Bootbus flash: Setting flash for %luMB flash at "
"0x%08llx\n", flash_map.size >> 20, flash_map.phys);
simple_map_init(&flash_map);
mymtd = do_map_probe("cfi_probe", &flash_map);
if (mymtd) {
mymtd->owner = THIS_MODULE;
#ifdef CONFIG_MTD_PARTITIONS
nr_parts = parse_mtd_partitions(mymtd,
part_probe_types,
&parts, 0);
if (nr_parts > 0)
add_mtd_partitions(mymtd, parts, nr_parts);
else
add_mtd_device(mymtd);
#else
add_mtd_device(mymtd);
#endif
} else {
pr_err("Failed to register MTD device for flash\n");
}
}
示例4: init_cdb89712_bootrom
static int __init init_cdb89712_bootrom (void)
{
int err;
if (request_resource (&ioport_resource, &cdb89712_bootrom_resource)) {
printk(KERN_NOTICE "Failed to reserve Cdb89712 BOOTROM space\n");
err = -EBUSY;
goto out;
}
cdb89712_bootrom_map.virt = ioremap(BOOTROM_START, BOOTROM_SIZE);
if (!cdb89712_bootrom_map.virt) {
printk(KERN_NOTICE "Failed to ioremap Cdb89712 BootROM space\n");
err = -EIO;
goto out_resource;
}
simple_map_init(&cdb89712_bootrom_map);
bootrom_mtd = do_map_probe("map_rom", &cdb89712_bootrom_map);
if (!bootrom_mtd) {
printk("BootROM probe failed\n");
err = -ENXIO;
goto out_ioremap;
}
bootrom_mtd->owner = THIS_MODULE;
bootrom_mtd->erasesize = 0x10000;
if (add_mtd_device(bootrom_mtd)) {
printk("BootROM device addition failed\n");
err = -ENOMEM;
goto out_probe;
}
return 0;
out_probe:
map_destroy(bootrom_mtd);
bootrom_mtd = 0;
out_ioremap:
iounmap((void *)cdb89712_bootrom_map.virt);
out_resource:
release_resource (&cdb89712_bootrom_resource);
out:
return err;
}
示例5: alchemy_mtd_init
int __init alchemy_mtd_init(void)
{
struct mtd_partition *parts;
int nb_parts = 0;
unsigned long window_addr;
unsigned long window_size;
/* Default flash buswidth */
alchemy_map.bankwidth = BOARD_FLASH_WIDTH;
window_addr = 0x20000000 - BOARD_FLASH_SIZE;
window_size = BOARD_FLASH_SIZE;
#ifdef CONFIG_MIPS_MIRAGE_WHY
/* Boot ROM flash bank only; no user bank */
window_addr = 0x1C000000;
window_size = 0x04000000;
/* USERFS from 0x1C00 0000 to 0x1FC00000 */
alchemy_partitions[0].size = 0x03C00000;
#endif
/*
* Static partition definition selection
*/
parts = alchemy_partitions;
nb_parts = NB_OF(alchemy_partitions);
alchemy_map.size = window_size;
/*
* Now let's probe for the actual flash. Do it here since
* specific machine settings might have been set above.
*/
printk(KERN_NOTICE BOARD_MAP_NAME ": probing %d-bit flash bus\n",
alchemy_map.bankwidth*8);
alchemy_map.virt = ioremap(window_addr, window_size);
mymtd = do_map_probe("cfi_probe", &alchemy_map);
if (!mymtd) {
iounmap(alchemy_map.virt);
return -ENXIO;
}
mymtd->owner = THIS_MODULE;
add_mtd_partitions(mymtd, parts, nb_parts);
return 0;
}
示例6: init_tsunami_flash
static int __init init_tsunami_flash(void)
{
static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", "map_rom", 0 };
char **type;
tsunami_tig_writeb(FLASH_ENABLE_BYTE, FLASH_ENABLE_PORT);
tsunami_flash_mtd = 0;
type = rom_probe_types;
for(; !tsunami_flash_mtd && *type; type++) {
tsunami_flash_mtd = do_map_probe(*type, &tsunami_flash_map);
}
if (tsunami_flash_mtd) {
tsunami_flash_mtd->module = THIS_MODULE;
add_mtd_device(tsunami_flash_mtd);
return 0;
}
return -ENXIO;
}
示例7: uclinux_mtd_init
static int __init uclinux_mtd_init(void)
{
struct mtd_info *mtd;
struct map_info *mapp;
mapp = &uclinux_ram_map;
if (!mapp->size)
mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(mapp->phys + 8))));
mapp->bankwidth = 4;
printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n",
(int) mapp->phys, (int) mapp->size);
/*
* The filesystem is guaranteed to be in direct mapped memory. It is
* directly following the kernels own bss region. Following the same
* mechanism used by architectures setting up traditional initrds we
* use phys_to_virt to get the virtual address of its start.
*/
mapp->virt = phys_to_virt(mapp->phys);
if (mapp->virt == 0) {
printk("uclinux[mtd]: no virtual mapping?\n");
return(-EIO);
}
simple_map_init(mapp);
mtd = do_map_probe("map_ram", mapp);
if (!mtd) {
printk("uclinux[mtd]: failed to find a mapping?\n");
return(-ENXIO);
}
mtd->owner = THIS_MODULE;
mtd->_point = uclinux_point;
mtd->priv = mapp;
uclinux_ram_mtdinfo = mtd;
mtd_device_register(mtd, uclinux_romfs, NUM_PARTITIONS);
return(0);
}
示例8: init_rpxlite
int __init init_rpxlite(void)
{
printk(KERN_NOTICE "RPX Lite or CLLF flash device: %x at %x\n", WINDOW_SIZE*4, WINDOW_ADDR);
rpxlite_map.map_priv_1 = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE * 4);
if (!rpxlite_map.map_priv_1) {
printk("Failed to ioremap\n");
return -EIO;
}
mymtd = do_map_probe("cfi_probe", &rpxlite_map);
if (mymtd) {
mymtd->module = THIS_MODULE;
add_mtd_device(mymtd);
return 0;
}
iounmap((void *)rpxlite_map.map_priv_1);
return -ENXIO;
}
示例9: init_impa7
static int __init init_impa7(void)
{
static const char *rom_probe_types[] = PROBETYPES;
const char **type;
int i;
static struct { u_long addr; u_long size; } pt[NUM_FLASHBANKS] = {
{ WINDOW_ADDR0, WINDOW_SIZE0 },
{ WINDOW_ADDR1, WINDOW_SIZE1 },
};
int devicesfound = 0;
for(i=0; i<NUM_FLASHBANKS; i++)
{
printk(KERN_NOTICE MSG_PREFIX "probing 0x%08lx at 0x%08lx\n",
pt[i].size, pt[i].addr);
impa7_map[i].phys = pt[i].addr;
impa7_map[i].virt = ioremap(pt[i].addr, pt[i].size);
if (!impa7_map[i].virt) {
printk(MSG_PREFIX "failed to ioremap\n");
return -EIO;
}
simple_map_init(&impa7_map[i]);
impa7_mtd[i] = 0;
type = rom_probe_types;
for(; !impa7_mtd[i] && *type; type++) {
impa7_mtd[i] = do_map_probe(*type, &impa7_map[i]);
}
if (impa7_mtd[i]) {
impa7_mtd[i]->owner = THIS_MODULE;
devicesfound++;
mtd_device_parse_register(impa7_mtd[i], NULL, NULL,
partitions,
ARRAY_SIZE(partitions));
}
else
iounmap((void *)impa7_map[i].virt);
}
return devicesfound == 0 ? -ENXIO : 0;
}
示例10: uclinux_mtd_init
static int __init uclinux_mtd_init(void)
{
struct mtd_info *mtd;
struct map_info *mapp;
mapp = &uclinux_ram_map;
if (!mapp->size)
mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(mapp->phys + 8))));
mapp->bankwidth = 4;
printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n",
(int) mapp->phys, (int) mapp->size);
mapp->virt = ioremap_nocache(mapp->phys, mapp->size);
if (mapp->virt == 0) {
printk("uclinux[mtd]: ioremap_nocache() failed\n");
return(-EIO);
}
simple_map_init(mapp);
mtd = do_map_probe("map_ram", mapp);
if (!mtd) {
printk("uclinux[mtd]: failed to find a mapping?\n");
iounmap(mapp->virt);
return(-ENXIO);
}
mtd->owner = THIS_MODULE;
mtd->point = uclinux_point;
mtd->priv = mapp;
uclinux_ram_mtdinfo = mtd;
#ifdef CONFIG_MTD_PARTITIONS
add_mtd_partitions(mtd, uclinux_romfs, NUM_PARTITIONS);
#else
add_mtd_device(mtd);
#endif
return(0);
}
示例11: init_rpxlite
static int __init init_rpxlite(void)
{
printk(KERN_NOTICE "RPX Lite or CLLF flash device: %x at %x\n", WINDOW_SIZE*4, WINDOW_ADDR);
rpxlite_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE * 4);
if (!rpxlite_map.virt) {
printk("Failed to ioremap\n");
return -EIO;
}
simple_map_init(&rpxlite_map);
mymtd = do_map_probe("cfi_probe", &rpxlite_map);
if (mymtd) {
mymtd->owner = THIS_MODULE;
mtd_device_register(mymtd, NULL, 0);
return 0;
}
iounmap((void *)rpxlite_map.virt);
return -ENXIO;
}
示例12: init_physmap
int __init init_physmap(void)
{
printk(KERN_NOTICE "physmap flash device: %x at %x\n", WINDOW_SIZE, WINDOW_ADDR);
physmap_map.map_priv_1 = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
if (!physmap_map.map_priv_1) {
printk("Failed to ioremap\n");
return -EIO;
}
mymtd = do_map_probe("cfi_probe", &physmap_map);
if (mymtd) {
mymtd->module = THIS_MODULE;
add_mtd_device(mymtd);
return 0;
}
iounmap((void *)physmap_map.map_priv_1);
return -ENXIO;
}
示例13: init_rrmap
static int __init init_rrmap(void)
{
void *ramroot_start;
unsigned long ramroot_size;
/* Check for supported rootfs types */
if (get_ramroot(&ramroot_start, &ramroot_size)) {
rr_map.phys = CPHYSADDR(ramroot_start);
rr_map.size = ramroot_size;
printk(KERN_NOTICE
"PMC embedded root device: 0x%08lx @ 0x%08lx\n",
rr_map.size, (unsigned long)rr_map.phys);
} else {
printk(KERN_ERR
"init_rrmap: no supported embedded rootfs detected!\n");
return -ENXIO;
}
/* Map rootfs to I/O space for block device driver */
rr_map.virt = ioremap(rr_map.phys, rr_map.size);
if (!rr_map.virt) {
printk(KERN_ERR "Failed to ioremap\n");
return -EIO;
}
simple_map_init(&rr_map);
rr_mtd = do_map_probe("map_ram", &rr_map);
if (rr_mtd) {
rr_mtd->owner = THIS_MODULE;
add_mtd_device(rr_mtd);
ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, rr_mtd->index);
return 0;
}
iounmap(rr_map.virt);
return -ENXIO;
}
示例14: init_sbc_gxx
static int __init init_sbc_gxx(void)
{
iomapadr = ioremap(WINDOW_START, WINDOW_LENGTH);
if (!iomapadr) {
printk( KERN_ERR"%s: failed to ioremap memory region\n",
sbc_gxx_map.name );
return -EIO;
}
if (!request_region( PAGE_IO, PAGE_IO_SIZE, "SBC-GXx flash")) {
printk( KERN_ERR"%s: IO ports 0x%x-0x%x in use\n",
sbc_gxx_map.name,
PAGE_IO, PAGE_IO+PAGE_IO_SIZE-1 );
iounmap(iomapadr);
return -EAGAIN;
}
#ifdef CONFIG_DEBUG_PRINTK
printk( KERN_INFO"%s: IO:0x%x-0x%x MEM:0x%x-0x%x\n",
sbc_gxx_map.name,
PAGE_IO, PAGE_IO+PAGE_IO_SIZE-1,
WINDOW_START, WINDOW_START+WINDOW_LENGTH-1 );
#else
;
#endif
/* Probe for chip. */
all_mtd = do_map_probe( "cfi_probe", &sbc_gxx_map );
if( !all_mtd ) {
cleanup_sbc_gxx();
return -ENXIO;
}
all_mtd->owner = THIS_MODULE;
/* Create MTD devices for each partition. */
mtd_device_register(all_mtd, partition_info, NUM_PARTITIONS);
return 0;
}
示例15: init_brcm_physmap
int __init init_brcm_physmap(void)
{
PFILE_TAG pTag = NULL;
u_int32_t rootfs_addr, kernel_addr;
FLASH_ADDR_INFO info;
kerSysFlashAddrInfoGet( &info );
/* Read the flash memory map from flash memory. */
if (!(pTag = kerSysImageTagGet())) {
printk("Failed to read image tag from flash\n");
return -EIO;
}
rootfs_addr = (u_int32_t) simple_strtoul(pTag->rootfsAddress, NULL, 10);
kernel_addr = (u_int32_t) simple_strtoul(pTag->kernelAddress, NULL, 10);
brcm_physmap_map.size = kernel_addr - rootfs_addr;
brcm_physmap_map.map_priv_1 = (unsigned long)rootfs_addr;
if (!brcm_physmap_map.map_priv_1) {
printk("Wrong rootfs starting address\n");
return -EIO;
}
if (brcm_physmap_map.size <= 0) {
printk("Wrong rootfs size\n");
return -EIO;
}
mymtd = do_map_probe("map_rom", &brcm_physmap_map);
if (mymtd) {
mymtd->module = THIS_MODULE;
add_mtd_device(mymtd);
return 0;
}
return -ENXIO;
}