static void __init setup_machine_fdt(phys_addr_t dt_phys) { unsigned long dt_root; if (!dt_phys || !early_init_dt_scan(phys_to_virt(dt_phys))) { early_print("\n" "Error: invalid device tree blob at physical address 0x%p (virtual address 0x%p)\n" "The dtb must be 8-byte aligned and passed in the first 512MB of memory\n" "\nPlease check your bootloader.\n", dt_phys, phys_to_virt(dt_phys)); while (true) cpu_relax(); } dt_root = of_get_flat_dt_root(); /* for hacking machine desc, not upstream */ machine_desc = get_machine_desc_compatible(); if (machine_desc) early_print("find compat machine_desc %s\n", machine_desc->name); machine_name = of_get_flat_dt_prop(dt_root, "model", NULL); if (!machine_name) machine_name = of_get_flat_dt_prop(dt_root, "compatible", NULL); if (!machine_name) machine_name = "<unknown>"; pr_info("Machine: %s\n", machine_name); }
struct machine_desc * __init setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr) { struct tag *tags = (struct tag *)&default_tags; struct machine_desc *mdesc = NULL, *p; char *from = default_command_line; default_tags.mem.start = PHYS_OFFSET; /* * locate machine in the list of supported machines. */ for_each_machine_desc(p) if (machine_nr == p->nr) { printk("Machine: %s\n", p->name); mdesc = p; break; } if (!mdesc) { early_print("\nError: unrecognized/unsupported machine ID" " (r1 = 0x%08x).\n\n", machine_nr); dump_machine_table(); /* does not return */ } if (__atags_pointer) tags = phys_to_virt(__atags_pointer); else if (mdesc->atag_offset) tags = (void *)(PAGE_OFFSET + mdesc->atag_offset); #if defined(CONFIG_DEPRECATED_PARAM_STRUCT) /* * If we have the old style parameters, convert them to * a tag list. */ if (tags->hdr.tag != ATAG_CORE) convert_to_tag_list(tags); #endif if (tags->hdr.tag != ATAG_CORE) { early_print("Warning: Neither atags nor dtb found\n"); tags = (struct tag *)&default_tags; } if (mdesc->fixup) mdesc->fixup(tags, &from, &meminfo); if (tags->hdr.tag == ATAG_CORE) { if (meminfo.nr_banks != 0) squash_mem_tags(tags); save_atags(tags); parse_tags(tags); } /* parse_early_param needs a boot_command_line */ strlcpy(boot_command_line, from, COMMAND_LINE_SIZE); return mdesc; }
static void __init setup_machine_fdt(phys_addr_t dt_phys) { struct boot_param_header *devtree; unsigned long dt_root; cpuinfo_store_cpu(); /* Check we have a non-NULL DT pointer */ if (!dt_phys) { early_print("\n" "Error: NULL or invalid device tree blob\n" "The dtb must be 8-byte aligned and passed in the first 512MB of memory\n" "\nPlease check your bootloader.\n"); while (true) cpu_relax(); } devtree = phys_to_virt(dt_phys); /* Check device tree validity */ if (be32_to_cpu(devtree->magic) != OF_DT_HEADER) { early_print("\n" "Error: invalid device tree blob at physical address 0x%p (virtual address 0x%p)\n" "Expected 0x%x, found 0x%x\n" "\nPlease check your bootloader.\n", dt_phys, devtree, OF_DT_HEADER, be32_to_cpu(devtree->magic)); while (true) cpu_relax(); } initial_boot_params = devtree; dt_root = of_get_flat_dt_root(); machine_name = of_get_flat_dt_prop(dt_root, "model", NULL); if (!machine_name) machine_name = of_get_flat_dt_prop(dt_root, "compatible", NULL); if (!machine_name) machine_name = "<unknown>"; pr_info("Machine: %s\n", machine_name); /* Retrieve various information from the /chosen node */ of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line); /* Initialize {size,address}-cells info */ of_scan_flat_dt(early_init_dt_scan_root, NULL); /* Setup memory, calling early_init_dt_add_memory_arch */ of_scan_flat_dt(early_init_dt_scan_memory, NULL); }
long get_cmos_time(void) { unsigned int year, mon, day, hour, min, sec; do { sec = CMOS_READ(RTC_SECONDS); min = CMOS_READ(RTC_MINUTES); hour = CMOS_READ(RTC_HOURS); day = CMOS_READ(RTC_DAY_OF_MONTH); mon = CMOS_READ(RTC_MONTH); year = CMOS_READ(RTC_YEAR); } while (sec != CMOS_READ(RTC_SECONDS)); BCD_TO_BIN(sec); BCD_TO_BIN(min); BCD_TO_BIN(hour); BCD_TO_BIN(day); BCD_TO_BIN(mon); BCD_TO_BIN(year); if ((year += 1900) < 1970) year += 100; early_print("%d/%d/%d, %d:%d:%d\n", year, mon, day, hour, min, sec); return mktime(year, mon, day, hour, min, sec); }
static void __init tl7689_dt_init(void) { /* * Finished with the static registrations now; fill in the missing * devices */ early_print("%d at %s\n",__LINE__,__func__); // irq_domain_generate_simple(tl7689_dt_gic_match, TL7689_GIC_DIST_BASE, IRQ_TL7689_GIC_START); common_init(); of_tl7689_int_pinmux(); #ifdef CONFIG_SND_SOC_ALC5631 //rt5631_gpio_ref_init(); of_tl7689_init_gpio_mute_amp(); #endif // TL7689_PINMUX_INIT(pad_refboard); of_platform_populate(NULL, tl7689_dt_match_table, tl7689_auxdata_lookup, NULL); soc_plat_register_devices(plat_devs, ARRAY_SIZE(plat_devs)); ext_i2c_register_devices(extend_i2c_devs,ARRAY_SIZE(extend_i2c_devs)); printk("on2_base = 0x%x, on2_size = 0x%x\n lcd_base = 0x%x, \ lcd_size = 0x%x\n gpu_size = 0x%x, ump_size = 0x%x\n",\ nusmart_on2_base(), nusmart_on2_len(), nusmart_lcd_base(), nusmart_lcd_len(), nusmart_mali_len(), nusmart_mali_ump_len()); }
void print_mmap(struct mm_struct *mm) { struct vm_area_struct *vma; for (vma = mm->mmap; vma; vma = vma->vm_next) { early_print("%x, %x, ", vma->vm_start, vma->vm_end); char c1, c2; if (vma->vm_flags & VM_WRITE) c1 = 'w'; else if (vma->vm_flags & (VM_READ | VM_EXEC)) c1 = 'r'; else c1 = 'o'; if (vma->vm_flags & VM_SHARED) c2 = 'S'; else c2 = 'P'; early_print("%c, %c\n", c1, c2); } }
static int of_tl7689_int_pinmux() { struct device_node *of_pinmux = NULL; const __be32 *list; u32 size=0,pin_setting[TL7689_PINMUX_SIZE] = {0}; u32 i=0; of_pinmux = of_find_node_by_path("/pinmux"); if (!of_pinmux) { early_print("can not find pinmux in dtb\n"); while (1); } if (of_device_is_compatible(of_pinmux, pinmux_compat)) { list = of_get_property(of_pinmux,"setting_table",&size); if(size == 0 || size > TL7689_PINMUX_SIZE * sizeof(int) || list == NULL) { early_print("can not find setting_table or size err in pinmux node,size:%d,0x%x\n",size,list); while (1); } size /= sizeof(*list); early_print("find pinmux of node size is %d\n",size); if (size != TL7689_PINMUX_SIZE) size = TL7689_PINMUX_SIZE; while (i < size) { *(pin_setting+i) = be32_to_cpup(list++); early_print("pin(%d~%d) setting 0x%x\n",i*4,i*4+3,*(pin_setting+i)); i ++; } pinmux_init(pin_setting,size); return 0; } else { early_print("can not find compatible pinmux\n"); while (1); } return 0; }
void insert_vm_struct(struct mm_struct *mm, struct vm_area_struct *vma) { struct vm_area_struct **p, *mpnt; p = &mm->mmap; while ((mpnt = *p) != NULL) { if (mpnt->vm_start > vma->vm_start) break; if (mpnt->vm_end > vma->vm_start) early_print("%s: overlapping vm_areas\n", __FUNCTION__); p = &mpnt->vm_next; } vma->vm_next = mpnt; *p = vma; }
static void __init setup_machine_fdt(phys_addr_t dt_phys) { if (!dt_phys || !early_init_dt_scan(phys_to_virt(dt_phys))) { early_print("\n" "Error: invalid device tree blob at physical address 0x%p (virtual address 0x%p)\n" "The dtb must be 8-byte aligned and passed in the first 512MB of memory\n" "\nPlease check your bootloader.\n", dt_phys, phys_to_virt(dt_phys)); while (true) cpu_relax(); } machine_name = of_flat_dt_get_machine_name(); }
/** * setup_machine_fdt - Machine setup when an dtb was passed to the kernel * @dt_phys: physical address of dt blob * * If a dtb was passed to the kernel in r2, then use it to choose the * correct machine_desc and to setup the system. */ struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) { struct boot_param_header *devtree; struct machine_desc *mdesc, *mdesc_best = NULL; unsigned int score, mdesc_score = ~1; unsigned long dt_root; const char *model; devtree = phys_to_virt(dt_phys); /* check device tree validity */ if (be32_to_cpu(devtree->magic) != OF_DT_HEADER) return NULL; /* Search the mdescs for the 'best' compatible value match */ initial_boot_params = devtree; dt_root = of_get_flat_dt_root(); for_each_machine_desc(mdesc) { score = of_flat_dt_match(dt_root, mdesc->dt_compat); if (score > 0 && score < mdesc_score) { mdesc_best = mdesc; mdesc_score = score; } } if (!mdesc_best) { const char *prop; long size; early_print("\nError: unrecognized/unsupported " "device tree compatible list:\n[ "); prop = of_get_flat_dt_prop(dt_root, "compatible", &size); while (size > 0) { early_print("'%s' ", prop); size -= strlen(prop) + 1; prop += strlen(prop) + 1; } early_print("]\n\n"); dump_machine_table(); /* does not return */ } model = of_get_flat_dt_prop(dt_root, "model", NULL); if (!model) model = of_get_flat_dt_prop(dt_root, "compatible", NULL); if (!model) model = "<unknown>"; pr_info("Machine: %s, model: %s\n", mdesc_best->name, model); /* Retrieve various information from the /chosen node */ of_scan_flat_dt(early_init_dt_scan_chosen, NULL); /* Initialize {size,address}-cells info */ of_scan_flat_dt(early_init_dt_scan_root, NULL); /* Setup memory, calling early_init_dt_add_memory_arch */ of_scan_flat_dt(early_init_dt_scan_memory, NULL); /* Save command line for /proc/cmdline */ strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE); /* Change machine number to match the mdesc we're using */ __machine_arch_type = mdesc_best->nr; return mdesc_best; }
struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) { struct boot_param_header *devtree; struct machine_desc *mdesc, *mdesc_best = NULL; unsigned int score, mdesc_score = ~1; unsigned long dt_root; const char *model; printk("kinson:[%s]-[%d] dt_phys:0x%08x\n",__FUNCTION__,__LINE__,dt_phys); if (!dt_phys) return NULL; debug_step_dt=1; devtree = phys_to_virt(dt_phys); printk("kinson:[%s]-[%d] devtree:0x%08x devtree->magic:0x%x 0x%x 0x%x 0x%x\n",__FUNCTION__,__LINE__,devtree,be32_to_cpu(devtree->magic),devtree->totalsize, devtree->off_dt_struct,devtree->off_dt_strings); /* check device tree validity */ if (be32_to_cpu(devtree->magic) != OF_DT_HEADER) { printk("kinson:[%s]-[%d] devtree->magic error!\n",__FUNCTION__,__LINE__); return NULL; } /* Search the mdescs for the 'best' compatible value match */ initial_boot_params = devtree; dt_root = of_get_flat_dt_root(); for_each_machine_desc(mdesc) { #if 0 score = of_flat_dt_match(dt_root, mdesc->dt_compat); if (score > 0 && score < mdesc_score) { mdesc_best = mdesc; mdesc_score = score; } #else //kinson mdesc_best = mdesc; #endif } debug_step_dt=2; if (!mdesc_best) { const char *prop; long size; early_print("\nError: unrecognized/unsupported " "device tree compatible list:\n[ "); debug_step_dt=3; prop = of_get_flat_dt_prop(dt_root, "compatible", &size); while (size > 0) { early_print("'%s' ", prop); size -= strlen(prop) + 1; prop += strlen(prop) + 1; } early_print("]\n\n"); debug_step_dt=4; dump_machine_table(); /* does not return */ } debug_step_dt=7; model = of_get_flat_dt_prop(dt_root, "model", NULL); if (!model) model = of_get_flat_dt_prop(dt_root, "compatible", NULL); if (!model) model = "<unknown>"; pr_info("Machine: %s, model: %s\n", mdesc_best->name, model); debug_step_dt=8; /* Retrieve various information from the /chosen node */ of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line); /* Initialize {size,address}-cells info */ debug_step_dt=9; of_scan_flat_dt(early_init_dt_scan_root, NULL); debug_step_dt=10; /* Setup memory, calling early_init_dt_add_memory_arch */ of_scan_flat_dt(early_init_dt_scan_memory, NULL); debug_step_dt=11; /* Change machine number to match the mdesc we're using */ __machine_arch_type = mdesc_best->nr; return mdesc_best; }
static struct machine_desc * __init setup_machine_fdt(phys_addr_t dt_phys) { struct boot_param_header *devtree; struct machine_desc *mdesc, *mdesc_best = NULL; unsigned int score, mdesc_score = ~1; unsigned long dt_root; /* Check we have a non-NULL DT pointer */ if (!dt_phys) { early_print("\n" "Error: NULL or invalid device tree blob\n" "The dtb must be 8-byte aligned and passed in the first 512MB of memory\n" "\nPlease check your bootloader.\n"); while (true) cpu_relax(); } devtree = phys_to_virt(dt_phys); /* Check device tree validity */ if (be32_to_cpu(devtree->magic) != OF_DT_HEADER) { early_print("\n" "Error: invalid device tree blob at physical address 0x%p (virtual address 0x%p)\n" "Expected 0x%x, found 0x%x\n" "\nPlease check your bootloader.\n", dt_phys, devtree, OF_DT_HEADER, be32_to_cpu(devtree->magic)); while (true) cpu_relax(); } initial_boot_params = devtree; dt_root = of_get_flat_dt_root(); for_each_machine_desc(mdesc) { score = of_flat_dt_match(dt_root, mdesc->dt_compat); if (score > 0 && score < mdesc_score) { mdesc_best = mdesc; mdesc_score = score; } } if (!mdesc_best) { const char *prop; long size; pr_info("\nError: unrecognized/unsupported " "device tree compatible list:\n[ "); prop = of_get_flat_dt_prop(dt_root, "compatible", &size); while (size > 0) { pr_info("'%s' ", prop); size -= strlen(prop) + 1; prop += strlen(prop) + 1; } pr_info("]\n\n"); while (true) /* can't use cpu_relax() here as it may require MMU setup */; } machine_name = of_get_flat_dt_prop(dt_root, "model", NULL); if (!machine_name) machine_name = of_get_flat_dt_prop(dt_root, "compatible", NULL); if (!machine_name) machine_name = "<unknown>"; pr_info("Machine: %s\n", machine_name); /* Retrieve various information from the /chosen node */ of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line); /* Initialize {size,address}-cells info */ of_scan_flat_dt(early_init_dt_scan_root, NULL); /* Setup memory, calling early_init_dt_add_memory_arch */ of_scan_flat_dt(early_init_dt_scan_memory, NULL); return mdesc_best; }