阅读:3564回复:1
pci_alloc_consistent 竟然不能多次申请内存????
我在内核为2.6.18中使用pci_alloc_consistent()申请内存时,发现竟然不能多次申请,会出错,而代码在内核为2.4.13中又是OK的,搞得我都糊涂了,你们帮看看代码那里有问题????????
#define MAX_BUFFER_COUNT 16 static int __devinit drv_dm642_probe(struct pci_dev *pcidev, const struct pci_device_id *devid) { static u32 *cpu_zeroes[MAX_BUFFER_COUNT]; static dma_addr_t zeroes[MAX_BUFFER_COUNT]; ..... //略 ulLen = 20+(128+128*1024); printk("drv_dm642_probe() module enable irq ok\n"); for(i = 0; i < MAX_BUFFER_COUNT; ++i) { printk("::::::::::::::::::::::pci_alloc_consistent :: start \n"); cpu_zeroes = pci_alloc_consistent(pcidev, ulLen, &(zeroes)); printk("::::::::::::::::::::::::::::::::pci_alloc_consistent :: end \n"); if(NULL == cpu_zeroes ) { printk("11::s->video_buf_info_addr[%d] pci_alloc_consistent error\n",i); goto fail3; } printk("i[%d] :: cpu_zeroes[0x%8x], zeroes[0x%8x]\n", i, (unsigned int) cpu_zeroes, (unsigned int) zeroes); memset(cpu_zeroes, 0, ulLen); } fail3: ....... //略 } 打印信息如下: drv_dm642_probe() module enable irq ok ::::::::::::::::::::::pci_alloc_consistent :: start ::::::::::::::::::::::::::::::::pci_alloc_consistent :: end i[0] :: cpu_zeroes[0xff103000], zeroes[0x ee00000] ::::::::::::::::::::::pci_alloc_consistent :: start ::::::::::::::::::::::::::::::::pci_alloc_consistent :: end i[1] :: cpu_zeroes[0xff124000], zeroes[0x e100000] ::::::::::::::::::::::pci_alloc_consistent :: start ::::::::::::::::::::::::::::::::pci_alloc_consistent :: end i[2] :: cpu_zeroes[0xff145000], zeroes[0x 540000] ::::::::::::::::::::::pci_alloc_consistent :: start ::::::::::::::::::::::::::::::::pci_alloc_consistent :: end i[3] :: cpu_zeroes[0xff166000], zeroes[0x e140000] ::::::::::::::::::::::pci_alloc_consistent :: start ::::::::::::::::::::::::::::::::pci_alloc_consistent :: end i[4] :: cpu_zeroes[0xff187000], zeroes[0x e680000] ::::::::::::::::::::::pci_alloc_consistent :: start ::::::::::::::::::::::::::::::::pci_alloc_consistent :: end i[5] :: cpu_zeroes[0xff1a8000], zeroes[0x e6c0000] ::::::::::::::::::::::pci_alloc_consistent :: start ::::::::::::::::::::::::::::::::pci_alloc_consistent :: end i[6] :: cpu_zeroes[0xff1c9000], zeroes[0x ea00000] ::::::::::::::::::::::pci_alloc_consistent :: start kernel BUG in __dma_alloc_coherent at arch/ppc/kernel/dma-mapping.c:233! Oops: Exception in kernel mode, sig: 5 [#1] NIP: C0004D3C LR: C0004D08 CTR: 00000000 REGS: cea8fc70 TRAP: 0700 Not tainted (2.6.18-rc2) MSR: 00029000 <EE,ME> CR: 84084084 XER: 00000000 TASK = cfe67090[53] 'insmod' THREAD: cea8e000 GPR00: 00000001 CEA8FD20 CFE67090 C04CD100 0000003F 0000001F CEA60FFC 00029000 GPR08: 00000000 00000000 CFF13020 00000400 24084028 1008C868 00000000 00000000 GPR16: 00000000 00000000 00000124 00000000 D5099BDE C02D0000 C0260000 00000006 GPR24: CEE99E80 C025E40C FF2DF000 D1067750 C04CD100 CFF2E000 C04CCBC0 0000B000 NIP [C0004D3C] __dma_alloc_coherent+0x220/0x2ec LR [C0004D08] __dma_alloc_coherent+0x1ec/0x2ec Call Trace: [CEA8FD20] [C0004C60] __dma_alloc_coherent+0x144/0x2ec (unreliable) [CEA8FD60] [D10691D4] drv_dm642_probe+0xac/0x660 [dm642drv] [CEA8FD90] [C011B3A0] pci_device_probe+0x80/0xa0 [CEA8FDB0] [C0133670] driver_probe_device+0x60/0x118 [CEA8FDD0] [C01338A8] __driver_attach+0xcc/0xf8 [CEA8FDF0] [C0132AFC] bus_for_each_dev+0x54/0x90 [CEA8FE20] [C01334D8] driver_attach+0x24/0x34 [CEA8FE30] [C0132F3C] bus_add_driver+0x84/0x144 [CEA8FE50] [C0133D90] driver_register+0x70/0xb8 [CEA8FE60] [C011B030] __pci_register_driver+0x44/0x54 [CEA8FE70] [D1069030] drv_dm642_init+0x30/0x128 [dm642drv] [CEA8FE90] [C00345F8] sys_init_module+0xe8/0x157c [CEA8FF40] [C0001C88] ret_from_syscall+0x0/0x3c Instruction dump: 3d20c02d 8169c0dc 7c00f050 54003826 7c005a14 901b0000 815d0004 39200000 7d205379 38000000 41820008 38000001 <0f000000> 38000400 7d60f028 7d6b0378 Trace/breakpoint trap |
|
沙发#
发布于:2007-03-28 18:04
内存信息如下:
~ # lspci 00:0c.0 Class 0400: 104c:a002 (rev 01) //本人PCI设备信息 ~ # cat /proc/iomem 50000100-5000017f : musbhsfc.0 a0000000-afffffff : PCI host bridge af000000-af7fffff : 0000:00:0c.0 afc00000-afffffff : 0000:00:0c.0 ef601000-ef60107f : ppc-soc-ohci.0 ef601000-ef60107f : ohci_hcd ~ # cat /proc/meminfo MemTotal: 257004 kB MemFree: 186288 kB Buffers: 64000 kB Cached: 1836 kB SwapCached: 0 kB Active: 2528 kB Inactive: 64040 kB HighTotal: 0 kB HighFree: 0 kB LowTotal: 257004 kB LowFree: 186288 kB SwapTotal: 0 kB SwapFree: 0 kB Dirty: 0 kB Writeback: 0 kB AnonPages: 776 kB Mapped: 1076 kB Slab: 1768 kB PageTables: 136 kB NFS Unstable: 0 kB Bounce: 0 kB CommitLimit: 128500 kB Committed_AS: 3156 kB VmallocTotal: 737200 kB VmallocUsed: 65964 kB VmallocChunk: 671148 kB ~ # free total used free shared buffers Mem: 257004 70716 186288 0 64000 Swap: 0 0 0 Total: 257004 70716 186288 |
|