上次是因为fdt或者atags传的不对,后来内核编译成支持fdt的,也把fdt传进去了,但和kernel里编译的machine_desc对应不上。fdt的用法必须要看了。不过现在没去看这个,直接把kernel里的machine_desc直接给过去了,因为这个kernel里只有一个arndale的machine_desc。
-
877 void __init setup_arch(char **cmdline_p)
-
878 {
-
879 struct machine_desc *mdesc;
-
880
-
881 unwind_init();
-
882
-
883 setup_processor();
-
884 // uty: test
-
885 //mdesc = setup_machine_fdt(__atags_pointer);
-
886 //if (!mdesc)
-
887 // mdesc = setup_machine_tags(machine_arch_type);
-
888 mdesc = __arch_info_begin;
-
889 machine_desc = mdesc;
-
890 machine_name = mdesc->name;
888行,直接赋值machine_desc。
这部分就跑过去了,还没看到什么问题,不知道因为启用了fdt,kernel后面还会不会出和这个有关的问题。
后面跑没多远,又停了,加了些输出。
跑到这里
-
(XEN) 3... 2... 1...
-
(XEN) *** Serial input -> DOM0 (type 'CTRL-a' three times to switch input to Xen)
-
(XEN) Freed 264kB init memory.
-
(XEN) DOM0: Uncompressing Linux... done, booting the kernel.
-
(XEN) DOM0: <6>Initializing cgroup subsys cpu
-
(XEN) DOM0: <5>Linux version 3.0.31-g3370a7c-dirty (uty@localhost.localdomain) (gcc version 4.6.x-google 20120106 (prerelease) (GCC) ) #12
-
(XEN) DOM0: SMP PREEMPT Wed Dec 17 09:32:10 CST 2014
-
(XEN) DOM0: CPU: ARMv7 Processor [410fc0f4] revision 4 (ARMv7), cr=10c5387d
-
(XEN) DOM0: CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache
-
(XEN) DOM0: Memory policy: ECC disabled, Data cache writealloc
-
(XEN) DOM0: uty: build_mem_type_table end
-
(XEN) DOM0: uty: build_mem_type_table end
-
(XEN) DOM0: uty: prepare_page_table end
-
(XEN) DOM0: uty: prepare_page_table end
-
(XEN) DOM0: uty: map_lowmem end
-
(XEN) DOM0: uty: map_lowmem end
出错在 arch\arm\mm\mmu.c devicemaps_init(mdesc);
确实,这里跑不过去是正常的。。
-
922 /*
-
923 * Set up device the mappings. Since we clear out the page tables for all
-
924 * mappings above VMALLOC_END, we will remove any debug device mappings.
-
925 * This means you have to be careful how you debug this function, or any
-
926 * called function. This means you can't use any function or debugging
-
927 * method which may touch any device, otherwise the kernel _will_ crash.
-
928 */
-
929 static void __init devicemaps_init(struct machine_desc *mdesc)
-
930 {
-
931 struct map_desc map;
-
932 unsigned long addr;
-
933
-
934 /*
-
935 * Allocate the vector page early.
-
936 */
-
937 vectors_page = early_alloc(PAGE_SIZE);
-
938
-
939 for (addr = VMALLOC_END; addr; addr += PMD_SIZE)
-
940 pmd_clear(pmd_off_k(addr));
-
941
-
942 /*
-
943 * Map the kernel if it is XIP.
-
944 * It is always first in the modulearea.
-
945 */
-
946 #ifdef CONFIG_XIP_KERNEL
-
947 map.pfn = __phys_to_pfn(CONFIG_XIP_PHYS_ADDR & SECTION_MASK);
-
948 map.virtual = MODULES_VADDR;
-
949 map.length = ((unsigned long)_etext - map.virtual + ~SECTION_MASK) & SECTION_MASK;
-
950 map.type = MT_ROM;
-
951 create_mapping(&map);
-
952 #endif
-
953
-
954 /*
-
955 * Map the cache flushing regions.
-
956 */
-
957 #ifdef FLUSH_BASE
-
958 map.pfn = __phys_to_pfn(FLUSH_BASE_PHYS);
-
959 map.virtual = FLUSH_BASE;
-
960 map.length = SZ_1M;
-
961 map.type = MT_CACHECLEAN;
-
962 create_mapping(&map);
-
963 #endif
-
964 #ifdef FLUSH_BASE_MINICACHE
-
965 map.pfn = __phys_to_pfn(FLUSH_BASE_PHYS + SZ_1M);
-
966 map.virtual = FLUSH_BASE_MINICACHE;
-
967 map.length = SZ_1M;
-
968 map.type = MT_MINICLEAN;
-
969 create_mapping(&map);
-
970 #endif
-
971
-
972 /*
-
973 * Create a mapping for the machine vectors at the high-vectors
-
974 * location (0xffff0000). If we aren't using high-vectors, also
-
975 * create a mapping at the low-vectors virtual address.
-
976 */
-
977 map.pfn = __phys_to_pfn(virt_to_phys(vectors_page));
-
978 map.virtual = 0xffff0000;
-
979 map.length = PAGE_SIZE;
-
980 map.type = MT_HIGH_VECTORS;
-
981 create_mapping(&map);
-
982
-
983 if (!vectors_high()) {
-
984 map.virtual = 0;
-
985 map.type = MT_LOW_VECTORS;
-
986 create_mapping(&map);
-
987 }
-
988
-
989 /*
-
990 * Ask the machine support to map in the statically mapped devices.
-
991 */
-
992 if (mdesc->map_io)
-
993 mdesc->map_io();
-
994
-
995 /*
-
996 * Finally flush the caches and tlb to ensure that we're in a
-
997 * consistent state wrt the writebuffer. This also ensures that
-
998 * any write-allocated cache lines in the vector page are written
-
999 * back. After this point, we can start to touch devices again.
-
1000 */
-
1001 local_flush_tlb_all();
-
1002 flush_cache_all();
-
1003 }
chinaunix贴代码怎么烂成这样。。。
这个函数是初始化所有IO地址的。开头的注释说的挺郁闷,不能调式什么的,因为一上来就把VMALLOC_END
后的也表全删了。不过printk应该还能用,因为create_mapping里就用了,奇怪create_mapping里不会用到任何io吗?early_print应该可以用,因为是直接用物理地址的。试试就知道了。
这里面还调用了machine_desc->map_io()。因为xen是对内存布局作了修改的,本来是通过修改fdt再传给linux。比如内存已经不是0x40000000开始了,而是从0x80000000开始的512MB,并且这个地址的确定也是xen动态生成的。
-
1648 static void __init arndale_fixup(struct machine_desc *desc,
-
1649 struct tag *tags, char **cmdline,
-
1650 struct meminfo *mi)
-
1651 {
-
1652 mi->bank[0].start = 0x40000000;
-
1653 mi->bank[0].size = 1024 * SZ_1M;
-
1654
-
1655 mi->bank[1].start = 0x80000000;
-
1656 mi->bank[1].size = 1023 * SZ_1M;
-
1657
-
1658 mi->nr_banks = 2;
-
1659 }
这里就需要改,因为0x40000000不在是内存,而linux不知道,再访问这里就会出错。
而map_io里,也要看看xen改了哪里,哪里不能碰。至少uart是不能初始化了,因为xen没有把uart的物理地址映射到dom0里。
-
1285 static void __init arndale_map_io(void)
-
1286 {
-
1287 clk_xxti.rate = 24000000;
-
1288 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
-
1289 s3c24xx_init_clocks(24000000);
-
1290 s3c24xx_init_uarts(arndale_uartcfgs, ARRAY_SIZE(arndale_uartcfgs));
-
1291 exynos_reserve_mem();
-
1292 }
s5p_init_io(NULL, 0, S5P_VA_CHIPID); 里面初始化minimal的io,这部分在arch/arm/plat-s5p/cpu.c里
-
99 /* minimal IO mapping */
-
100
-
101 static struct map_desc s5p_iodesc[] __initdata = {
-
102 {
-
103 .virtual = (unsigned long)S5P_VA_CHIPID,
-
104 .pfn = __phys_to_pfn(S5P_PA_CHIPID),
-
105 .length = SZ_4K,
-
106 .type = MT_DEVICE,
-
107 }, {
-
108 .virtual = (unsigned long)S3C_VA_SYS,
-
109 .pfn = __phys_to_pfn(S5P_PA_SYSCON),
-
110 .length = SZ_64K,
-
111 .type = MT_DEVICE,
-
112 }, {
-
113 .virtual = (unsigned long)S3C_VA_TIMER,
-
114 .pfn = __phys_to_pfn(S5P_PA_TIMER),
-
115 .length = SZ_16K,
-
116 .type = MT_DEVICE,
-
117 }, {
-
118 .virtual = (unsigned long)S3C_VA_WATCHDOG,
-
119 .pfn = __phys_to_pfn(S3C_PA_WDT),
-
120 .length = SZ_4K,
-
121 .type = MT_DEVICE,
-
122 }, {
-
123 .virtual = (unsigned long)S5P_VA_SROMC,
-
124 .pfn = __phys_to_pfn(S5P_PA_SROMC),
-
125 .length = SZ_4K,
-
126 .type = MT_DEVICE,
-
127 },
-
128 };
-
129
-
130 /* read cpu identification code */
-
131
-
132 void __init s5p_init_io(struct map_desc *mach_desc,
-
133 int size, void __iomem *cpuid_addr)
-
134 {
-
135 /* initialize the io descriptors we need for initialization */
-
136 iotable_init(s5p_iodesc, ARRAY_SIZE(s5p_iodesc));
-
137 if (mach_desc)
-
138 iotable_init(mach_desc, size);
-
139
-
140 /* detect cpu id and rev. */
-
141 s5p_init_cpu(cpuid_addr);
-
142
-
143 s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
-
144 }
下面就该看每个io物理地址都是干什么用的,xen都改了哪些,地址空间该怎样映射了。
3.15的kernel里用的是fdt,所以arch\arm\mach-exynos目录下变化非常大,因为描述设备的代码都被fdt配置文件替换了。所以,我想如果在arndale的fdt里能正确的描述LCD,并且kernel对应的驱动也存在,应该能把屏幕驱动起来。
哎,糊里糊涂的点错了,幸亏草稿箱里还有,要不可不想再敲一遍。。。
阅读(479) | 评论(0) | 转发(0) |