Date: Fri, 9 Dec 2005 23:15:56 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 87982 for review Message-ID: <200512092315.jB9NFuZT048107@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=87982 Change 87982 by imp@imp_Speedy on 2005/12/09 23:15:26 o Turn off all the LEDs at the top of console init for debugging purposes. o use DBGU instead of USART0 for the KB9202, since that's what the boot roms use. o 115200 since that's the bootrom speed. Affected files ... .. //depot/projects/arm/src/sys/arm/arm/locore.S#10 edit .. //depot/projects/arm/src/sys/arm/at91/kb920x_machdep.c#3 edit .. //depot/projects/arm/src/sys/arm/at91/uart_cpu_at91rm92usart.c#3 edit .. //depot/projects/arm/src/sys/conf/options#7 edit .. //depot/projects/arm/src/sys/sys/sysctl.h#4 edit Differences ... ==== //depot/projects/arm/src/sys/arm/arm/locore.S#10 (text+ko) ==== @@ -68,6 +68,43 @@ ASENTRY_NP(_start) +#define R7SYS \ + mov r7, #0 ; \ + add r7, r7, #0xfffff000 + +#define LED1OFF \ + mov r6, #262144 /* 18 */ ; \ + str r6, [r7, #2096] /* SODR */ +#define LED2OFF \ + mov r6, #524288 /* 19 */ ; \ + str r6, [r7, #2096] /* SODR */ +#define LED3OFF \ + mov r6, #1048576 /* 20 */ ; \ + str r6, [r7, #2096] /* SODR */ +#define LED1ON \ + mov r6, #262144 /* 18 */ ; \ + str r6, [r7, #2100] /* CODR */ +#define LED2ON \ + mov r6, #524288 /* 19 */ ; \ + str r6, [r7, #2100] /* CODR */ +#define LED3ON \ + mov r6, #1048576 /* 20 */ ; \ + str r6, [r7, #2100] /* CODR */ + + R7SYS + mov r6, #262144 /* 18 */ + str r6, [r7, #2048] /* PER */ + str r6, [r7, #2064] /* OER */ + str r6, [r7, #2096] /* SODR */ + mov r6, #524288 /* 19 */ + str r6, [r7, #2048] /* PER */ + str r6, [r7, #2064] /* OER */ + str r6, [r7, #2096] /* SODR */ + mov r6, #1048576 /* 20 */ + str r6, [r7, #2048] /* PER */ + str r6, [r7, #2064] /* OER */ + str r6, [r7, #2096] /* SODR */ + /* Check if we are running on RAM, if not move ourself to RAM */ #if 0 cmp pc, #PHYSADDR @@ -117,6 +154,8 @@ mov pc, r7 Lunmapped: + R7SYS + LED1ON #ifdef STARTUP_PAGETABLE_ADDR /* build page table from scratch */ ldr r0, Lstartup_pagetable @@ -180,12 +219,14 @@ #endif virt_done: nop + LED2ON mov fp, #0 /* trace back starts here */ bl _C_LABEL(initarm) /* Off we go */ /* init arm will return the new stack pointer. */ mov sp, r0 + LED3ON bl _C_LABEL(mi_startup) /* call mi_startup()! */ adr r0, .Lmainreturned @@ -209,6 +250,8 @@ MMU_INIT(PHYSADDR, PHYSADDR , 64, L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW)) /* map VA 0xc0000000..0xc3ffffff to PA */ MMU_INIT(KERNBASE, PHYSADDR, 64, L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW)) + /* Map in the system devices */ + MMU_INIT(0xfff00000, 0xfff00000, 1, L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW)) .word 0 /* end of table */ #endif ==== //depot/projects/arm/src/sys/arm/at91/kb920x_machdep.c#3 (text+ko) ==== @@ -185,10 +185,23 @@ uint32_t fake_preload[35]; uint32_t memsize = 32 * 1024 * 1024; + int pc; +#if 0 + volatile uint32_t *ptr = (uint32_t *)(0xfffff830); /* PIOC_SODR */ + *ptr = AT91RM92_PIO_PC18; + *ptr = AT91RM92_PIO_PC19; + *ptr = AT91RM92_PIO_PC20; + ptr = (uint32_t *)(0xfffff834); /* PIOC_CODR */ +#endif + i = 0; set_cpufuncs(); cninit(); + printf("CNINIT DONE\n"); + + __asm __volatile("mov %0, pc" : "=r" (pc)); + printf("pc is %x\n", pc); fake_preload[i++] = MODINFO_NAME; fake_preload[i++] = strlen("elf kernel") + 1; strcpy((char*)&fake_preload[i++], "elf kernel"); @@ -214,9 +227,16 @@ #define KERNEL_TEXT_BASE (KERNBASE) freemempos = ((vm_offset_t)&end + PAGE_MASK) & ~PAGE_MASK; /* Define a macro to simplify memory allocation */ + printf("freemempos %x\n", freemempos); +#if 0 #define valloc_pages(var, np) \ alloc_pages((var).pv_pa, (np)); \ (var).pv_va = (var).pv_pa + (KERNVIRTADDR - KERNPHYSADDR); +#else +#define valloc_pages(var, np) \ + alloc_pages((var).pv_va, (np)); \ + (var).pv_pa = (var).pv_va + (KERNPHYSADDR - KERNVIRTADDR); +#endif #define alloc_pages(var, np) \ (var) = freemempos; \ @@ -258,7 +278,7 @@ * We start by mapping the L2 page tables into the L1. * This means that we can replace L1 mappings later on if necessary */ - l1pagetable = kernel_l1pt.pv_va; + l1pagetable = kernel_l1pt.pv_pa; /* Map the L2 pages tables in the L1 page table */ pmap_link_l2pt(l1pagetable, ARM_VECTORS_LOW, @@ -269,6 +289,10 @@ pmap_map_chunk(l1pagetable, KERNBASE, KERNPHYSADDR, (((uint32_t)(&end) - KERNBASE) + PAGE_SIZE) & ~(PAGE_SIZE - 1), VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); + /* XXX PA == VA XXX */ + pmap_map_chunk(l1pagetable, KERNPHYSADDR, KERNPHYSADDR, + (((uint32_t)(&end) - KERNBASE) + L1_S_SIZE) & ~(L1_S_SIZE - 1), + VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); afterkern = round_page(((vm_offset_t)&end + L1_S_SIZE) & ~(L1_S_SIZE - 1)); for (i = 0; i < KERNEL_PT_AFKERNEL_NUM; i++) { @@ -304,11 +328,18 @@ VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE); } + printf("pa is %x va is %x\n", kernel_l1pt.pv_pa, kernel_l1pt.pv_va); pmap_devmap_bootstrap(l1pagetable, kb920x_devmap); + printf("1"); cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT); + printf("1"); setttb(kernel_l1pt.pv_pa); + printf("1"); cpu_tlb_flushID(); + printf("1"); cpu_domains(DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)); + printf("1"); + /* * Pages were allocated during the secondary bootstrap for the * stacks for different CPU modes. @@ -318,7 +349,6 @@ * of the stack memory. */ - cpu_control(CPU_CONTROL_MMU_ENABLE, CPU_CONTROL_MMU_ENABLE); set_stackptr(PSR_IRQ32_MODE, irqstack.pv_va + IRQ_STACK_SIZE * PAGE_SIZE); @@ -343,6 +373,7 @@ /* Set stack for exception handlers */ + printf("9"); data_abort_handler_address = (u_int)data_abort_handler; prefetch_abort_handler_address = (u_int)prefetch_abort_handler; undefined_handler_address = (u_int)undefinedinstruction_bounce; @@ -359,6 +390,7 @@ arm_vector_init(ARM_VECTORS_LOW, ARM_VEC_ALL); + printf("a"); pmap_curmaxkvaddr = freemempos - KERNPHYSADDR + KERNVIRTADDR; pmap_curmaxkvaddr = afterkern + 0x100000 * (KERNEL_PT_KERN_NUM - 1); @@ -369,6 +401,7 @@ msgbufinit(msgbufp, MSGBUF_SIZE); mutex_init(); + printf("b"); i = 0; dump_avail[0] = KERNPHYSADDR; dump_avail[1] = KERNPHYSADDR + memsize; @@ -383,7 +416,9 @@ init_param1(); init_param2(memsize / PAGE_SIZE); avail_end = KERNPHYSADDR + memsize - 1; + printf("c"); kdb_init(); + printf("d"); return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP - sizeof(struct pcb))); } ==== //depot/projects/arm/src/sys/arm/at91/uart_cpu_at91rm92usart.c#3 (text+ko) ==== @@ -54,6 +54,11 @@ int uart_cpu_getdev(int devtype, struct uart_devinfo *di) { + uint32_t *ptr = (uint32_t *)(AT91RM92_BASE + AT91RM92_SYS_BASE); + *(uint32_t *)((char *)ptr + PIOC_SODR) = AT91RM92_PIO_PC18; + *(uint32_t *)((char *)ptr + PIOC_SODR) = AT91RM92_PIO_PC19; + *(uint32_t *)((char *)ptr + PIOC_SODR) = AT91RM92_PIO_PC20; + #ifdef CONSOLE_USART di->ops = usart_at91rm92_ops; di->bas.chan = 0; @@ -63,10 +68,10 @@ * for some devices. */ di->bas.bsh = AT91RM92_BASE + AT91RM92_USART0_BASE; - di->bas.bsh = AT91RM92_SYS_BASE + DBGU_CR; + di->bas.bsh = AT91RM92_BASE + AT91RM92_SYS_BASE + DBGU_CR; di->bas.regshft = 0; di->bas.rclk = 0; - di->baudrate = 38400; + di->baudrate = 115200; di->databits = 8; di->stopbits = 1; di->parity = UART_PARITY_NONE; ==== //depot/projects/arm/src/sys/conf/options#7 (text+ko) ==== @@ -56,6 +56,8 @@ KDB_UNATTENDED opt_kdb.h SYSCTL_DEBUG opt_sysctl.h +SYSCTL_OMIT_DESCR opt_global.h + # Miscellaneous options. ADAPTIVE_GIANT opt_adaptive_mutexes.h NO_ADAPTIVE_MUTEXES opt_adaptive_mutexes.h ==== //depot/projects/arm/src/sys/sys/sysctl.h#4 (text+ko) ==== @@ -204,15 +204,21 @@ #define SYSCTL_NODE_CHILDREN(parent, name) \ sysctl_##parent##_##name##_children +#ifndef SYSCTL_OMIT_DESCR +#define __DESCR(d) d +#else +#define __DESCR(d) "" +#endif + /* This constructs a "raw" MIB oid. */ #define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ static struct sysctl_oid sysctl__##parent##_##name = { \ &sysctl_##parent##_children, { 0 }, \ - nbr, kind, a1, a2, #name, handler, fmt, 0, descr }; \ + nbr, kind, a1, a2, #name, handler, fmt, 0, __DESCR(descr) }; \ DATA_SET(sysctl_set, sysctl__##parent##_##name) #define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ - sysctl_add_oid(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) + sysctl_add_oid(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, __DESCR(descr)) /* This constructs a node from which other oids can hang. */ #define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \ @@ -223,7 +229,7 @@ #define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr) \ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access), \ - 0, 0, handler, "N", descr) + 0, 0, handler, "N", __DESCR(descr)) /* Oid for a string. len can be 0 to indicate '\0' termination. */ #define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \ @@ -232,7 +238,7 @@ #define SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr) \ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING|(access), \ - arg, len, sysctl_handle_string, "A", descr) + arg, len, sysctl_handle_string, "A", __DESCR(descr)) /* Oid for an int. If ptr is NULL, val is returned. */ #define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \ @@ -241,7 +247,7 @@ #define SYSCTL_ADD_INT(ctx, parent, nbr, name, access, ptr, val, descr) \ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_INT|(access), \ - ptr, val, sysctl_handle_int, "I", descr) + ptr, val, sysctl_handle_int, "I", __DESCR(descr)) /* Oid for an unsigned int. If ptr is NULL, val is returned. */ #define SYSCTL_UINT(parent, nbr, name, access, ptr, val, descr) \ @@ -250,7 +256,7 @@ #define SYSCTL_ADD_UINT(ctx, parent, nbr, name, access, ptr, val, descr) \ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_UINT|(access), \ - ptr, val, sysctl_handle_int, "IU", descr) + ptr, val, sysctl_handle_int, "IU", __DESCR(descr)) /* Oid for a long. The pointer must be non NULL. */ #define SYSCTL_LONG(parent, nbr, name, access, ptr, val, descr) \ @@ -259,16 +265,16 @@ #define SYSCTL_ADD_LONG(ctx, parent, nbr, name, access, ptr, descr) \ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_LONG|(access), \ - ptr, 0, sysctl_handle_long, "L", descr) + ptr, 0, sysctl_handle_long, "L", __DESCR(descr)) /* Oid for an unsigned long. The pointer must be non NULL. */ #define SYSCTL_ULONG(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_OID(parent, nbr, name, CTLTYPE_ULONG|(access), \ - ptr, val, sysctl_handle_long, "LU", descr) + ptr, val, sysctl_handle_long, "LU", __DESCR(descr)) #define SYSCTL_ADD_ULONG(ctx, parent, nbr, name, access, ptr, descr) \ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_ULONG|(access), \ - ptr, 0, sysctl_handle_long, "LU", descr) + ptr, 0, sysctl_handle_long, "LU", __DESCR(descr)) /* Oid for an opaque object. Specified by a pointer and a length. */ #define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \ @@ -277,7 +283,7 @@ #define SYSCTL_ADD_OPAQUE(ctx, parent, nbr, name, access, ptr, len, fmt, descr)\ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \ - ptr, len, sysctl_handle_opaque, fmt, descr) + ptr, len, sysctl_handle_opaque, fmt, __DESCR(descr)) /* Oid for a struct. Specified by a pointer and a type. */ #define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \ @@ -287,7 +293,7 @@ #define SYSCTL_ADD_STRUCT(ctx, parent, nbr, name, access, ptr, type, descr) \ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \ - ptr, sizeof(struct type), sysctl_handle_opaque, "S," #type, descr) + ptr, sizeof(struct type), sysctl_handle_opaque, "S," #type, __DESCR(descr)) /* Oid for a procedure. Specified by a pointer and an arg. */ #define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \ @@ -296,7 +302,7 @@ #define SYSCTL_ADD_PROC(ctx, parent, nbr, name, access, ptr, arg, handler, fmt, descr) \ sysctl_add_oid(ctx, parent, nbr, name, (access), \ - ptr, arg, handler, fmt, descr) + ptr, arg, handler, fmt, __DESCR(descr)) #endif /* _KERNEL */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200512092315.jB9NFuZT048107>