Last active
November 4, 2019 18:35
-
-
Save tsutsui/1bd631ebf47f5985563a7ed48d0f593c to your computer and use it in GitHub Desktop.
(updated) Make NetBSD/zaurus -current diff to use kernel symbols loaded by zbsdmod.o, and fix for zaudio(4) (PR/54658)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: conf/GENERIC | |
=================================================================== | |
RCS file: /cvsroot/src/sys/arch/zaurus/conf/GENERIC,v | |
retrieving revision 1.88 | |
diff -u -p -d -r1.88 GENERIC | |
--- conf/GENERIC 2 Nov 2019 23:13:00 -0000 1.88 | |
+++ conf/GENERIC 4 Nov 2019 18:33:48 -0000 | |
@@ -150,11 +150,10 @@ options WSDISPLAY_COMPAT_RAWKBD # can | |
options DIAGNOSTIC # internal consistency checks | |
#options DEBUG | |
#options VERBOSE_INIT_ARM # verbose bootstraping messages | |
-#options DDB # in-kernel debugger | |
-#options DDB_HISTORY_SIZE=100 # Enable history editing in DDB | |
+options DDB # in-kernel debugger | |
+options DDB_HISTORY_SIZE=100 # Enable history editing in DDB | |
#options KGDB | |
#makeoptions DEBUG="-g" # compile full symbol table | |
-makeoptions COPY_SYMTAB=1 | |
# Kernel root file system and dump configuration. | |
Index: conf/INSTALL | |
=================================================================== | |
RCS file: /cvsroot/src/sys/arch/zaurus/conf/INSTALL,v | |
retrieving revision 1.39 | |
diff -u -p -d -r1.39 INSTALL | |
--- conf/INSTALL 7 Feb 2019 20:56:27 -0000 1.39 | |
+++ conf/INSTALL 4 Nov 2019 18:33:48 -0000 | |
@@ -59,7 +59,6 @@ options RASOPS_SMALL | |
no options DIAGNOSTIC | |
no options DDB | |
no options DDB_HISTORY_SIZE | |
-no makeoptions COPY_SYMTAB | |
no options PXA2X0_DMAC_DMOVER_CONCURRENCY | |
Index: stand/zbsdmod/zbsdmod.c | |
=================================================================== | |
RCS file: /cvsroot/src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c,v | |
retrieving revision 1.11 | |
diff -u -p -d -r1.11 zbsdmod.c | |
--- stand/zbsdmod/zbsdmod.c 28 Oct 2019 15:26:09 -0000 1.11 | |
+++ stand/zbsdmod/zbsdmod.c 4 Nov 2019 18:33:48 -0000 | |
@@ -139,8 +139,8 @@ elf32bsdboot(void) | |
if (maxv < posv) | |
maxv = posv; | |
} | |
- if (IS_DATA(phdr[i]) && IS_BSS(phdr[i])) { | |
- posv += phdr[i].p_memsz; | |
+ if (IS_BSS(phdr[i])) { | |
+ posv += phdr[i].p_memsz - phdr[i].p_filesz; | |
if (maxv < posv) | |
maxv = posv; | |
} | |
Index: zaurus/machdep.c | |
=================================================================== | |
RCS file: /cvsroot/src/sys/arch/zaurus/zaurus/machdep.c,v | |
retrieving revision 1.44 | |
diff -u -p -d -r1.44 machdep.c | |
--- zaurus/machdep.c 4 Nov 2019 10:36:18 -0000 1.44 | |
+++ zaurus/machdep.c 4 Nov 2019 18:33:49 -0000 | |
@@ -247,6 +247,12 @@ struct bootinfo _bootinfo; | |
struct bootinfo *bootinfo; | |
struct btinfo_howto *bi_howto; | |
+extern char etext[], end[]; | |
+extern void *esym; | |
+#if NKSYMS || defined(DDB) || defined(MODULAR) | |
+#include <sys/exec_elf.h> | |
+#endif | |
+ | |
#define KERNEL_BASE_PHYS ((paddr_t)&KERNEL_BASE_phys) | |
#define BOOTINFO_PAGE (KERNEL_BASE_PHYS - PAGE_SIZE) | |
@@ -647,6 +653,9 @@ initarm(void *arg) | |
psize_t memsize; | |
struct pxa2x0_gpioconf **zaurus_gpioconf; | |
u_int *magicaddr; | |
+#if NKSYMS || defined(DDB) || defined(MODULAR) | |
+ u_int symbolsize; | |
+#endif | |
/* Get ready for zaurus_restart() */ | |
pxa2x0_memctl_bootstrap(PXA2X0_MEMCTL_BASE); | |
@@ -917,6 +926,48 @@ initarm(void *arg) | |
pmap_curmaxkvaddr = | |
KERNEL_VM_BASE + (KERNEL_PT_VMDATA_NUM * 0x00400000); | |
+ /* check symbol table loaded by bootloader (zbsdmod.o) */ | |
+ esym = end; | |
+#if NKSYMS || defined(DDB) || defined(MODULAR) | |
+ symbolsize = 0; | |
+ Elf_Ehdr *eh = (Elf_Ehdr *)end; | |
+#ifdef VERBOSE_INIT_ARM | |
+ printf("Checking ELF MAGIC at end: %02x %02x %02x %02x\n", | |
+ end[0], end[1], end[2], end[3]); | |
+#endif | |
+ if (memcmp(eh->e_ident, ELFMAG, SELFMAG) == 0) { | |
+ Elf_Shdr *sh; | |
+#ifdef VERBOSE_INIT_ARM | |
+ printf("ELF header found at end\n"); | |
+#endif | |
+ sh = (Elf_Shdr *)((char *)end + eh->e_shoff); | |
+ for (loop = 0; loop < eh->e_shnum; loop++, sh++) { | |
+#ifdef VERBOSE_INIT_ARM | |
+ printf("Checking ELF header %d\n", loop); | |
+#endif | |
+ if (sh->sh_type != SHT_SYMTAB && | |
+ sh->sh_type != SHT_STRTAB) { | |
+ continue; | |
+ } | |
+#ifdef VERBOSE_INIT_ARM | |
+ printf("Section[%2d]: offset = %d, size = %d\n", | |
+ loop, sh->sh_offset, sh->sh_size); | |
+#endif | |
+ if (sh->sh_offset > 0 && | |
+ (sh->sh_offset + sh->sh_size) > symbolsize) { | |
+ symbolsize = sh->sh_offset + sh->sh_size; | |
+ } | |
+#ifdef VERBOSE_INIT_ARM | |
+ printf("Updating symbolsize = %d\n", symbolsize); | |
+#endif | |
+ } | |
+ esym = (char *)esym + symbolsize; | |
+ } | |
+#ifdef VERBOSE_INIT_ARM | |
+ printf("symbolsize = %d\n", symbolsize); | |
+#endif | |
+#endif | |
+ | |
#ifdef VERBOSE_INIT_ARM | |
printf("Mapping kernel\n"); | |
#endif | |
@@ -924,9 +975,9 @@ initarm(void *arg) | |
/* Now we fill in the L2 pagetable for the kernel static code/data | |
* and the symbol table. */ | |
{ | |
- extern char etext[], _end[]; | |
+ | |
size_t textsize = (uintptr_t) etext - KERNEL_TEXT_BASE; | |
- size_t totalsize = (uintptr_t) _end - KERNEL_TEXT_BASE; | |
+ size_t totalsize = (uintptr_t) esym - KERNEL_TEXT_BASE; | |
u_int logical; | |
textsize = (textsize + PGOFSET) & ~PGOFSET; | |
@@ -1012,10 +1063,9 @@ initarm(void *arg) | |
* variables. | |
*/ | |
{ | |
- extern char _end[]; | |
physical_freestart = physical_start + | |
- ((((uintptr_t) _end + PGOFSET) & ~PGOFSET) - KERNEL_BASE); | |
+ ((((uintptr_t) esym + PGOFSET) & ~PGOFSET) - KERNEL_BASE); | |
physical_freeend = physical_end; | |
free_pages = | |
(physical_freeend - physical_freestart) / PAGE_SIZE; | |
@@ -1109,13 +1159,9 @@ initarm(void *arg) | |
md_root_setconf(memory_disk, sizeof memory_disk); | |
#endif | |
-#if NKSYMS || defined(MODULAR) | |
-# ifdef DDB | |
- ddb_init(0, NULL, NULL); | |
-# else | |
- /* Firmware doesn't load symbols. */ | |
- ksyms_addsyms_elf(0, NULL, NULL); | |
-# endif | |
+#if NKSYMS || defined(DDB) || defined(MODULAR) | |
+ if (symbolsize > 0) | |
+ ksyms_addsyms_elf(symbolsize, &end, esym); | |
#endif | |
#ifdef KGDB | |
Index: zaurus/autoconf.c | |
=================================================================== | |
RCS file: /cvsroot/src/sys/arch/zaurus/zaurus/autoconf.c,v | |
retrieving revision 1.12 | |
diff -u -p -d -r1.12 autoconf.c | |
--- zaurus/autoconf.c 29 Jul 2012 18:05:47 -0000 1.12 | |
+++ zaurus/autoconf.c 4 Nov 2019 18:33:49 -0000 | |
@@ -43,6 +43,8 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v | |
#include <sys/disk.h> | |
#include <sys/kauth.h> | |
+#include <dev/i2c/i2cvar.h> | |
+ | |
#include <machine/intr.h> | |
#include <machine/bootconfig.h> | |
#include <machine/bootinfo.h> | |
@@ -219,5 +221,13 @@ void | |
device_register(device_t dev, void *aux) | |
{ | |
- /* Nothing to do */ | |
+ /* | |
+ * I2C bus conntected to pxaiic(4) for zaudio(4) devices has | |
+ * limited capabilities. | |
+ */ | |
+ if (device_is_a(dev, "iic") && | |
+ device_is_a(dev->dv_parent, "ziic")) { | |
+ (void)prop_dictionary_set_cstring_nocopy(device_properties(dev), | |
+ I2C_PROP_INDIRECT_PROBE_STRATEGY, I2C_PROBE_STRATEGY_NONE); | |
+ } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment