[BACK]Return to fdt_machdep.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / arch / evbarm / fdt

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/arch/evbarm/fdt/fdt_machdep.c between version 1.40 and 1.63

version 1.40, 2018/09/29 15:50:29 version 1.63, 2019/07/15 08:44:33
Line 36  __KERNEL_RCSID(0, "$NetBSD$");
Line 36  __KERNEL_RCSID(0, "$NetBSD$");
 #include "opt_arm_debug.h"  #include "opt_arm_debug.h"
 #include "opt_multiprocessor.h"  #include "opt_multiprocessor.h"
 #include "opt_cpuoptions.h"  #include "opt_cpuoptions.h"
   #include "opt_efi.h"
   
 #include "ukbd.h"  #include "ukbd.h"
 #include "wsdisplay.h"  #include "wsdisplay.h"
Line 54  __KERNEL_RCSID(0, "$NetBSD$");
Line 55  __KERNEL_RCSID(0, "$NetBSD$");
 #include <sys/proc.h>  #include <sys/proc.h>
 #include <sys/reboot.h>  #include <sys/reboot.h>
 #include <sys/termios.h>  #include <sys/termios.h>
 #include <sys/extent.h>  
 #include <sys/bootblock.h>  #include <sys/bootblock.h>
 #include <sys/disklabel.h>  #include <sys/disklabel.h>
 #include <sys/vnode.h>  #include <sys/vnode.h>
 #include <sys/kauth.h>  #include <sys/kauth.h>
 #include <sys/fcntl.h>  #include <sys/fcntl.h>
   #include <sys/uuid.h>
   #include <sys/disk.h>
 #include <sys/md5.h>  #include <sys/md5.h>
   #include <sys/pserialize.h>
   
   #include <net/if.h>
   #include <net/if_dl.h>
   
 #include <dev/cons.h>  #include <dev/cons.h>
 #include <uvm/uvm_extern.h>  #include <uvm/uvm_extern.h>
Line 79  __KERNEL_RCSID(0, "$NetBSD$");
Line 85  __KERNEL_RCSID(0, "$NetBSD$");
 #include <evbarm/include/autoconf.h>  #include <evbarm/include/autoconf.h>
 #include <evbarm/fdt/machdep.h>  #include <evbarm/fdt/machdep.h>
 #include <evbarm/fdt/platform.h>  #include <evbarm/fdt/platform.h>
   #include <evbarm/fdt/fdt_memory.h>
   
 #include <arm/fdt/arm_fdtvar.h>  #include <arm/fdt/arm_fdtvar.h>
   
   #ifdef EFI_RUNTIME
   #include <arm/arm/efi_runtime.h>
   #endif
   
 #if NUKBD > 0  #if NUKBD > 0
 #include <dev/usb/ukbdvar.h>  #include <dev/usb/ukbdvar.h>
 #endif  #endif
Line 105  char *boot_args = NULL;
Line 116  char *boot_args = NULL;
 u_long uboot_args[4] __attribute__((__section__(".data")));  u_long uboot_args[4] __attribute__((__section__(".data")));
 const uint8_t *fdt_addr_r __attribute__((__section__(".data")));  const uint8_t *fdt_addr_r __attribute__((__section__(".data")));
   
 static char fdt_memory_ext_storage[EXTENT_FIXED_STORAGE_SIZE(DRAM_BLOCKS)];  
 static struct extent *fdt_memory_ext;  
   
 static uint64_t initrd_start, initrd_end;  static uint64_t initrd_start, initrd_end;
   
 #include <libfdt.h>  #include <libfdt.h>
Line 125  static void fdt_cpu_rootconf(void);
Line 133  static void fdt_cpu_rootconf(void);
 static void fdt_reset(void);  static void fdt_reset(void);
 static void fdt_powerdown(void);  static void fdt_powerdown(void);
   
 static dev_type_cnputc(earlyconsputc);  
 static dev_type_cngetc(earlyconsgetc);  
   
 static struct consdev earlycons = {  
         .cn_putc = earlyconsputc,  
         .cn_getc = earlyconsgetc,  
         .cn_pollc = nullcnpollc,  
 };  
   
 static void  
 fdt_putchar(char c)  
 {  
         const struct arm_platform *plat = arm_fdt_platform();  
         if (plat && plat->ap_early_putchar) {  
                 plat->ap_early_putchar(c);  
         }  
 #ifdef EARLYCONS  
         else {  
 #define PLATFORM_EARLY_PUTCHAR ___CONCAT(EARLYCONS, _platform_early_putchar)  
                 void PLATFORM_EARLY_PUTCHAR(char);  
                 PLATFORM_EARLY_PUTCHAR(c);  
         }  
 #endif  
 }  
   
 static void  static void
 earlyconsputc(dev_t dev, int c)  earlyconsputc(dev_t dev, int c)
 {  {
         fdt_putchar(c);          uartputc(c);
 }  }
   
 static int  static int
 earlyconsgetc(dev_t dev)  earlyconsgetc(dev_t dev)
 {  {
         return 0;       /* XXX */          return 0;
 }  }
   
   static struct consdev earlycons = {
           .cn_putc = earlyconsputc,
           .cn_getc = earlyconsgetc,
           .cn_pollc = nullcnpollc,
   };
   
 #ifdef VERBOSE_INIT_ARM  #ifdef VERBOSE_INIT_ARM
 #define VPRINTF(...)    printf(__VA_ARGS__)  #define VPRINTF(...)    printf(__VA_ARGS__)
 #else  #else
 #define VPRINTF(...)    do { } while (/* CONSTCOND */ 0)  #define VPRINTF(...)    __nothing
 #endif  #endif
   
 /*  /*
  * ARM: Get the first physically contiguous region of memory.   * Get all of physical memory, including holes.
  * ARM64: Get all of physical memory, including holes.  
  */   */
 static void  static void
 fdt_get_memory(uint64_t *pstart, uint64_t *pend)  fdt_get_memory(uint64_t *pstart, uint64_t *pend)
Line 195  fdt_get_memory(uint64_t *pstart, uint64_
Line 183  fdt_get_memory(uint64_t *pstart, uint64_
                 VPRINTF("FDT /memory [%d] @ 0x%" PRIx64 " size 0x%" PRIx64 "\n",                  VPRINTF("FDT /memory [%d] @ 0x%" PRIx64 " size 0x%" PRIx64 "\n",
                     index, cur_addr, cur_size);                      index, cur_addr, cur_size);
   
 #ifdef __aarch64__  
                 if (cur_addr + cur_size > *pend)                  if (cur_addr + cur_size > *pend)
                         *pend = cur_addr + cur_size;                          *pend = cur_addr + cur_size;
 #else  
                 /* If subsequent entries follow the previous, append them. */  
                 if (*pend == cur_addr)  
                         *pend = cur_addr + cur_size;  
 #endif  
         }          }
 }  }
   
 void  void
 fdt_add_reserved_memory_range(uint64_t addr, uint64_t size)  fdt_add_reserved_memory_range(uint64_t addr, uint64_t size)
 {  {
         uint64_t start = trunc_page(addr);          fdt_memory_remove_range(addr, size);
         uint64_t end = round_page(addr + size);  
   
         int error = extent_free(fdt_memory_ext, start,  
              end - start, EX_NOWAIT);  
         if (error != 0)  
                 printf("MEM ERROR: res %" PRIx64 "-%" PRIx64 " failed: %d\n",  
                     start, end, error);  
         else  
                 VPRINTF("MEM: res %" PRIx64 "-%" PRIx64 "\n", start, end);  
 }  }
   
 /*  /*
Line 227  fdt_add_reserved_memory_range(uint64_t a
Line 200  fdt_add_reserved_memory_range(uint64_t a
 static void  static void
 fdt_add_reserved_memory(uint64_t min_addr, uint64_t max_addr)  fdt_add_reserved_memory(uint64_t min_addr, uint64_t max_addr)
 {  {
           uint64_t lstart = 0, lend = 0;
         uint64_t addr, size;          uint64_t addr, size;
         int index, error;          int index, error;
   
Line 234  fdt_add_reserved_memory(uint64_t min_add
Line 208  fdt_add_reserved_memory(uint64_t min_add
         for (index = 0; index <= num; index++) {          for (index = 0; index <= num; index++) {
                 error = fdt_get_mem_rsv(fdtbus_get_data(), index,                  error = fdt_get_mem_rsv(fdtbus_get_data(), index,
                     &addr, &size);                      &addr, &size);
                 if (error != 0 || size == 0)                  if (error != 0)
                           continue;
                   if (lstart <= addr && addr <= lend) {
                           size -= (lend - addr);
                           addr = lend;
                   }
                   if (size == 0)
                         continue;                          continue;
                 if (addr + size <= min_addr)                  if (addr + size <= min_addr)
                         continue;                          continue;
Line 247  fdt_add_reserved_memory(uint64_t min_add
Line 227  fdt_add_reserved_memory(uint64_t min_add
                 if (addr + size > max_addr)                  if (addr + size > max_addr)
                         size = max_addr - addr;                          size = max_addr - addr;
                 fdt_add_reserved_memory_range(addr, size);                  fdt_add_reserved_memory_range(addr, size);
                   lstart = addr;
                   lend = addr + size;
         }          }
 }  }
   
   static void
   fdt_add_dram_blocks(const struct fdt_memory *m, void *arg)
   {
           BootConfig *bc = arg;
   
           VPRINTF("  %" PRIx64 " - %" PRIx64 "\n", m->start, m->end - 1);
           bc->dram[bc->dramblocks].address = m->start;
           bc->dram[bc->dramblocks].pages =
               (m->end - m->start) / PAGE_SIZE;
           bc->dramblocks++;
   }
   
   #define MAX_PHYSMEM 64
   static int nfdt_physmem = 0;
   static struct boot_physmem fdt_physmem[MAX_PHYSMEM];
   
   static void
   fdt_add_boot_physmem(const struct fdt_memory *m, void *arg)
   {
           const paddr_t saddr = round_page(m->start);
           const paddr_t eaddr = trunc_page(m->end);
   
           VPRINTF("  %" PRIx64 " - %" PRIx64, m->start, m->end - 1);
           if (saddr >= eaddr) {
                   VPRINTF(" skipped\n");
                   return;
           }
           VPRINTF("\n");
   
           struct boot_physmem *bp = &fdt_physmem[nfdt_physmem++];
   
           KASSERT(nfdt_physmem <= MAX_PHYSMEM);
   
           bp->bp_start = atop(saddr);
           bp->bp_pages = atop(eaddr) - bp->bp_start;
           bp->bp_freelist = VM_FREELIST_DEFAULT;
   
   #ifdef _LP64
           if (m->end > 0x100000000)
                   bp->bp_freelist = VM_FREELIST_HIGHMEM;
   #endif
   
   #ifdef PMAP_NEED_ALLOC_POOLPAGE
           const uint64_t memory_size = *(uint64_t *)arg;
           if (atop(memory_size) > bp->bp_pages) {
                   arm_poolpage_vmfreelist = VM_FREELIST_DIRECTMAP;
                   bp->bp_freelist = VM_FREELIST_DIRECTMAP;
           }
   #endif
   }
   
 /*  /*
  * Define usable memory regions.   * Define usable memory regions.
  */   */
Line 258  fdt_build_bootconfig(uint64_t mem_start,
Line 291  fdt_build_bootconfig(uint64_t mem_start,
 {  {
         const int memory = OF_finddevice("/memory");          const int memory = OF_finddevice("/memory");
         BootConfig *bc = &bootconfig;          BootConfig *bc = &bootconfig;
         struct extent_region *er;  
         uint64_t addr, size;          uint64_t addr, size;
         int index, error;          int index;
   
         fdt_memory_ext = extent_create("FDT Memory", mem_start, mem_end,  
             fdt_memory_ext_storage, sizeof(fdt_memory_ext_storage), EX_EARLY);  
   
         for (index = 0;          for (index = 0;
              fdtbus_get_reg64(memory, index, &addr, &size) == 0;               fdtbus_get_reg64(memory, index, &addr, &size) == 0;
Line 273  fdt_build_bootconfig(uint64_t mem_start,
Line 302  fdt_build_bootconfig(uint64_t mem_start,
                 if (addr + size > mem_end)                  if (addr + size > mem_end)
                         size = mem_end - addr;                          size = mem_end - addr;
   
                 error = extent_alloc_region(fdt_memory_ext, addr, size,                  fdt_memory_add_range(addr, size);
                     EX_NOWAIT);  
                 if (error != 0)  
                         printf("MEM ERROR: add %" PRIx64 "-%" PRIx64 " failed: %d\n",  
                             addr, addr + size, error);  
                 VPRINTF("MEM: add %" PRIx64 "-%" PRIx64 "\n", addr, addr + size);  
         }          }
   
         fdt_add_reserved_memory(mem_start, mem_end);          fdt_add_reserved_memory(mem_start, mem_end);
   
         const uint64_t initrd_size = initrd_end - initrd_start;          const uint64_t initrd_size = initrd_end - initrd_start;
         if (initrd_size > 0)          if (initrd_size > 0)
                 fdt_add_reserved_memory_range(initrd_start, initrd_size);                  fdt_memory_remove_range(initrd_start, initrd_size);
   
           const int framebuffer = OF_finddevice("/chosen/framebuffer");
           if (framebuffer >= 0) {
                   for (index = 0;
                        fdtbus_get_reg64(framebuffer, index, &addr, &size) == 0;
                        index++) {
                           fdt_add_reserved_memory_range(addr, size);
                   }
           }
   
         VPRINTF("Usable memory:\n");          VPRINTF("Usable memory:\n");
         bc->dramblocks = 0;          bc->dramblocks = 0;
         LIST_FOREACH(er, &fdt_memory_ext->ex_regions, er_link) {          fdt_memory_foreach(fdt_add_dram_blocks, bc);
                 VPRINTF("  %lx - %lx\n", er->er_start, er->er_end);  
                 bc->dram[bc->dramblocks].address = er->er_start;  
                 bc->dram[bc->dramblocks].pages =  
                     (er->er_end - er->er_start) / PAGE_SIZE;  
                 bc->dramblocks++;  
         }  
 }  }
   
 static void  static void
Line 363  fdt_setup_initrd(void)
Line 390  fdt_setup_initrd(void)
 #endif  #endif
 }  }
   
   #ifdef EFI_RUNTIME
   static void
   fdt_map_efi_runtime(const char *prop, enum arm_efirt_mem_type type)
   {
           int len;
   
           const int chosen_off = fdt_path_offset(fdt_data, "/chosen");
           if (chosen_off < 0)
                   return;
   
           const uint64_t *map = fdt_getprop(fdt_data, chosen_off, prop, &len);
           if (map == NULL)
                   return;
   
           while (len >= 24) {
                   const paddr_t pa = be64toh(map[0]);
                   const vaddr_t va = be64toh(map[1]);
                   const uint64_t sz = be64toh(map[2]);
                   VPRINTF("%s: %s %lx-%lx (%lx-%lx)\n", __func__, prop, pa, pa+sz-1, va, va+sz-1);
                   arm_efirt_md_map_range(va, pa, sz, type);
                   map += 3;
                   len -= 24;
           }
   }
   #endif
   
 u_int initarm(void *arg);  u_int initarm(void *arg);
   
 u_int  u_int
Line 377  initarm(void *arg)
Line 430  initarm(void *arg)
         /* Load FDT */          /* Load FDT */
         int error = fdt_check_header(fdt_addr_r);          int error = fdt_check_header(fdt_addr_r);
         if (error == 0) {          if (error == 0) {
                   /* If the DTB is too big, try to pack it in place first. */
                   if (fdt_totalsize(fdt_addr_r) > sizeof(fdt_data))
                           (void)fdt_pack(__UNCONST(fdt_addr_r));
                 error = fdt_open_into(fdt_addr_r, fdt_data, sizeof(fdt_data));                  error = fdt_open_into(fdt_addr_r, fdt_data, sizeof(fdt_data));
                 if (error != 0)                  if (error != 0)
                         panic("fdt_move failed: %s", fdt_strerror(error));                          panic("fdt_move failed: %s", fdt_strerror(error));
Line 398  initarm(void *arg)
Line 454  initarm(void *arg)
                 OF_getprop(chosen, "bootargs", bootargs, sizeof(bootargs));                  OF_getprop(chosen, "bootargs", bootargs, sizeof(bootargs));
         boot_args = bootargs;          boot_args = bootargs;
   
         VPRINTF("devmap\n");  
         pmap_devmap_register(plat->ap_devmap());  
 #ifdef __aarch64__  
         pmap_devmap_bootstrap(plat->ap_devmap());  
 #endif  
   
         /* Heads up ... Setup the CPU / MMU / TLB functions. */          /* Heads up ... Setup the CPU / MMU / TLB functions. */
         VPRINTF("cpufunc\n");          VPRINTF("cpufunc\n");
         if (set_cpufuncs())          if (set_cpufuncs())
                 panic("cpu not recognized!");                  panic("cpu not recognized!");
   
           /*
            * Memory is still identity/flat mapped this point so using ttbr for
            * l1pt VA is fine
            */
   
           VPRINTF("devmap\n");
           extern char ARM_BOOTSTRAP_LxPT[];
           pmap_devmap_bootstrap((vaddr_t)ARM_BOOTSTRAP_LxPT, plat->ap_devmap());
   
         VPRINTF("bootstrap\n");          VPRINTF("bootstrap\n");
         plat->ap_bootstrap();          plat->ap_bootstrap();
   
Line 416  initarm(void *arg)
Line 475  initarm(void *arg)
          * If stdout-path is specified on the command line, override the           * If stdout-path is specified on the command line, override the
          * value in /chosen/stdout-path before initializing console.           * value in /chosen/stdout-path before initializing console.
          */           */
           VPRINTF("stdout\n");
         fdt_update_stdout_path();          fdt_update_stdout_path();
   
         /*          /*
Line 437  initarm(void *arg)
Line 497  initarm(void *arg)
         evbarm_cpu_rootconf = fdt_cpu_rootconf;          evbarm_cpu_rootconf = fdt_cpu_rootconf;
   
         /* Talk to the user */          /* Talk to the user */
         VPRINTF("\nNetBSD/evbarm (fdt) booting ...\n");          printf("NetBSD/evbarm (fdt) booting ...\n");
   
 #ifdef BOOT_ARGS  #ifdef BOOT_ARGS
         char mi_bootargs[] = BOOT_ARGS;          char mi_bootargs[] = BOOT_ARGS;
Line 454  initarm(void *arg)
Line 514  initarm(void *arg)
 #endif  #endif
         uint64_t memory_size = memory_end - memory_start;          uint64_t memory_size = memory_end - memory_start;
   
           VPRINTF("%s: memory start %" PRIx64 " end %" PRIx64 " (len %"
               PRIx64 ")\n", __func__, memory_start, memory_end, memory_size);
   
         /* Parse ramdisk info */          /* Parse ramdisk info */
         fdt_probe_initrd(&initrd_start, &initrd_end);          fdt_probe_initrd(&initrd_start, &initrd_end);
   
Line 461  initarm(void *arg)
Line 524  initarm(void *arg)
          * Populate bootconfig structure for the benefit of           * Populate bootconfig structure for the benefit of
          * dodumpsys           * dodumpsys
          */           */
           VPRINTF("%s: fdt_build_bootconfig\n", __func__);
         fdt_build_bootconfig(memory_start, memory_end);          fdt_build_bootconfig(memory_start, memory_end);
   
   #ifdef EFI_RUNTIME
           fdt_map_efi_runtime("netbsd,uefi-runtime-code", ARM_EFIRT_MEM_CODE);
           fdt_map_efi_runtime("netbsd,uefi-runtime-data", ARM_EFIRT_MEM_DATA);
           fdt_map_efi_runtime("netbsd,uefi-runtime-mmio", ARM_EFIRT_MEM_MMIO);
   #endif
   
         /* Perform PT build and VM init */          /* Perform PT build and VM init */
         cpu_kernel_vm_init(memory_start, memory_size);          cpu_kernel_vm_init(memory_start, memory_size);
   
Line 470  initarm(void *arg)
Line 540  initarm(void *arg)
   
         parse_mi_bootargs(boot_args);          parse_mi_bootargs(boot_args);
   
         #define MAX_PHYSMEM 64          VPRINTF("Memory regions:\n");
         static struct boot_physmem fdt_physmem[MAX_PHYSMEM];          fdt_memory_foreach(fdt_add_boot_physmem, &memory_size);
         int nfdt_physmem = 0;  
         struct extent_region *er;  
   
         LIST_FOREACH(er, &fdt_memory_ext->ex_regions, er_link) {  
                 VPRINTF("  %lx - %lx\n", er->er_start, er->er_end);  
                 struct boot_physmem *bp = &fdt_physmem[nfdt_physmem++];  
   
                 KASSERT(nfdt_physmem <= MAX_PHYSMEM);  
                 bp->bp_start = atop(er->er_start);  
                 bp->bp_pages = atop(er->er_end - er->er_start);  
                 bp->bp_freelist = VM_FREELIST_DEFAULT;  
   
 #ifdef _LP64          u_int sp = initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, fdt_physmem,
                 if (er->er_end > 0x100000000)               nfdt_physmem);
                         bp->bp_freelist = VM_FREELIST_HIGHMEM;  
 #endif  
   
 #ifdef PMAP_NEED_ALLOC_POOLPAGE          /*
                 if (atop(memory_size) > bp->bp_pages) {           * initarm_common flushes cache if required before AP start
                         arm_poolpage_vmfreelist = VM_FREELIST_DIRECTMAP;           */
                         bp->bp_freelist = VM_FREELIST_DIRECTMAP;          error = 0;
                 }          if ((boothowto & RB_MD1) == 0) {
 #endif                  VPRINTF("mpstart\n");
                   if (plat->ap_mpstart)
                           error = plat->ap_mpstart();
         }          }
   
         return initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, fdt_physmem,          if (error)
              nfdt_physmem);                  return sp;
           /*
            * Now we have APs started the pages used for stacks and L1PT can
            * be given to uvm
            */
           extern char const __start__init_memory[];
           extern char const __stop__init_memory[] __weak;
   
           if (__start__init_memory != __stop__init_memory) {
                   const paddr_t spa = KERN_VTOPHYS((vaddr_t)__start__init_memory);
                   const paddr_t epa = KERN_VTOPHYS((vaddr_t)__stop__init_memory);
                   const paddr_t spg = atop(spa);
                   const paddr_t epg = atop(epa);
   
                   VPRINTF("         start %08lx  end %08lx... "
                       "loading in freelist %d\n", spa, epa, VM_FREELIST_DEFAULT);
   
                   uvm_page_physload(spg, epg, spg, epg, VM_FREELIST_DEFAULT);
   
           }
   
           return sp;
 }  }
   
 static void  static void
Line 565  fdt_detect_root_device(device_t dev)
Line 645  fdt_detect_root_device(device_t dev)
         uint8_t buf[DEV_BSIZE];          uint8_t buf[DEV_BSIZE];
         uint8_t hash[16];          uint8_t hash[16];
         const uint8_t *rhash;          const uint8_t *rhash;
         char rootarg[32];          char rootarg[64];
         struct vnode *vp;          struct vnode *vp;
         MD5_CTX md5ctx;          MD5_CTX md5ctx;
         int error, len;          int error, len;
Line 613  fdt_detect_root_device(device_t dev)
Line 693  fdt_detect_root_device(device_t dev)
                 snprintf(rootarg, sizeof(rootarg), " root=%s%c", device_xname(dev), part + 'a');                  snprintf(rootarg, sizeof(rootarg), " root=%s%c", device_xname(dev), part + 'a');
                 strcat(boot_args, rootarg);                  strcat(boot_args, rootarg);
         }          }
   
           if (of_hasprop(chosen, "netbsd,gpt-guid")) {
                   char guidbuf[UUID_STR_LEN];
                   const struct uuid *guid = fdtbus_get_prop(chosen, "netbsd,gpt-guid", &len);
                   if (guid == NULL || len != 16)
                           return;
   
                   uuid_snprintf(guidbuf, sizeof(guidbuf), guid);
                   snprintf(rootarg, sizeof(rootarg), " root=wedge:%s", guidbuf);
                   strcat(boot_args, rootarg);
           }
   
           if (of_hasprop(chosen, "netbsd,gpt-label")) {
                   const char *label = fdtbus_get_string(chosen, "netbsd,gpt-label");
                   if (label == NULL || *label == '\0')
                           return;
   
                   device_t dv = dkwedge_find_by_wname(label);
                   if (dv != NULL)
                           booted_device = dv;
           }
   
           if (of_hasprop(chosen, "netbsd,booted-mac-address")) {
                   const uint8_t *macaddr = fdtbus_get_prop(chosen, "netbsd,booted-mac-address", &len);
                   if (macaddr == NULL || len != 6)
                           return;
                   int s = pserialize_read_enter();
                   struct ifnet *ifp;
                   IFNET_READER_FOREACH(ifp) {
                           if (memcmp(macaddr, CLLADDR(ifp->if_sadl), len) == 0) {
                                   device_t dv = device_find_by_xname(ifp->if_xname);
                                   if (dv != NULL)
                                           booted_device = dv;
                                   break;
                           }
                   }
                   pserialize_read_exit(s);
           }
 }  }
   
 static void  static void

Legend:
Removed from v.1.40  
changed lines
  Added in v.1.63

CVSweb <webmaster@jp.NetBSD.org>