svn commit: r254913 - head/sys/arm/arm

2013-08-26 Thread Rafal Jaworowski
Author: raj
Date: Mon Aug 26 15:38:27 2013
New Revision: 254913
URL: http://svnweb.freebsd.org/changeset/base/254913

Log:
  Add missing TAILQ initializer (omitted in r250634).
  
  Submitted by: Zbigniew Bodek z...@semihalf.com
  Reviewed by:  alc
  Sponsored by: The FreeBSD Foundation, Semihalf

Modified:
  head/sys/arm/arm/pmap-v6.c

Modified: head/sys/arm/arm/pmap-v6.c
==
--- head/sys/arm/arm/pmap-v6.c  Mon Aug 26 15:34:18 2013(r254912)
+++ head/sys/arm/arm/pmap-v6.c  Mon Aug 26 15:38:27 2013(r254913)
@@ -1143,6 +1143,7 @@ pmap_pinit0(struct pmap *pmap)
bcopy(kernel_pmap, pmap, sizeof(*pmap));
bzero(pmap-pm_mtx, sizeof(pmap-pm_mtx));
PMAP_LOCK_INIT(pmap);
+   TAILQ_INIT(pmap-pm_pvchunk);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r254531 - head/sys/arm/arm

2013-08-19 Thread Rafal Jaworowski
Author: raj
Date: Mon Aug 19 14:56:17 2013
New Revision: 254531
URL: http://svnweb.freebsd.org/changeset/base/254531

Log:
  Simplify pv_entry removal or ARMv6/v7:
  
  - PGA_WRITEABLE indicates that there *might be* a writable mapping for the
particular page, so to avoid frequent sweeping of the pv_entries whenever
pmap_nuke_pv(), pmap_modify_pv(), etc. is called, it is sufficient to
clear that flag if there are no managed mappings for that page anymore
(notice that only pmap_enter is authorized to set this flag).
  - Avoid redundant checking for PVF_WIRED flag when this flag cannot be set
anyway.
  - Clear PGA_WRITEABLE only once for each vm_page instead of multiple,
redundant clearing it in loop when there are no writeable mappings
to that page anymore.
  
  Submitted by: Zbigniew Bodek z...@semihalf.com
  Reviewed by:  gber
  Sponsored by: The FreeBSD Foundation, Semihalf

Modified:
  head/sys/arm/arm/pmap-v6.c

Modified: head/sys/arm/arm/pmap-v6.c
==
--- head/sys/arm/arm/pmap-v6.c  Mon Aug 19 14:42:39 2013(r254530)
+++ head/sys/arm/arm/pmap-v6.c  Mon Aug 19 14:56:17 2013(r254531)
@@ -1072,39 +1072,22 @@ pmap_set_prot(pt_entry_t *ptep, vm_prot_
  * = caller should NOT adjust pmap's wire_count
  * = we return the removed pve
  */
-
-static void
-pmap_nuke_pv(struct vm_page *m, pmap_t pmap, struct pv_entry *pve)
-{
-
-   rw_assert(pvh_global_lock, RA_WLOCKED);
-   PMAP_ASSERT_LOCKED(pmap);
-
-   TAILQ_REMOVE(m-md.pv_list, pve, pv_list);
-
-   if (pve-pv_flags  PVF_WIRED)
-   --pmap-pm_stats.wired_count;
-
-   if (pve-pv_flags  PVF_WRITE) {
-   TAILQ_FOREACH(pve, m-md.pv_list, pv_list)
-   if (pve-pv_flags  PVF_WRITE)
-   break;
-   if (!pve) {
-   vm_page_aflag_clear(m, PGA_WRITEABLE);
-   }
-   }
-}
-
 static struct pv_entry *
 pmap_remove_pv(struct vm_page *m, pmap_t pmap, vm_offset_t va)
 {
struct pv_entry *pve;
 
rw_assert(pvh_global_lock, RA_WLOCKED);
+   PMAP_ASSERT_LOCKED(pmap);
 
pve = pmap_find_pv(m, pmap, va);/* find corresponding pve */
-   if (pve != NULL)
-   pmap_nuke_pv(m, pmap, pve);
+   if (pve != NULL) {
+   TAILQ_REMOVE(m-md.pv_list, pve, pv_list);
+   if (pve-pv_flags  PVF_WIRED)
+   --pmap-pm_stats.wired_count;
+   }
+   if (TAILQ_EMPTY(m-md.pv_list))
+   vm_page_aflag_clear(m, PGA_WRITEABLE);
 
return(pve);/* return removed pve */
 }
@@ -1143,14 +1126,6 @@ pmap_modify_pv(struct vm_page *m, pmap_t
else
--pmap-pm_stats.wired_count;
}
-   if ((oflags  PVF_WRITE)  !(flags  PVF_WRITE)) {
-   TAILQ_FOREACH(npv, m-md.pv_list, pv_list) {
-   if (npv-pv_flags  PVF_WRITE)
-   break;
-   }
-   if (!npv)
-   vm_page_aflag_clear(m, PGA_WRITEABLE);
-   }
 
return (oflags);
 }
@@ -2062,7 +2037,9 @@ pmap_remove_pages(pmap_t pmap)
pv_entry_count--;
pmap-pm_stats.resident_count--;
pc-pc_map[field] |= bitmask;
-   pmap_nuke_pv(m, pmap, pv);
+   TAILQ_REMOVE(m-md.pv_list, pv, pv_list);
+   if (TAILQ_EMPTY(m-md.pv_list))
+   vm_page_aflag_clear(m, PGA_WRITEABLE);
pmap_free_l2_bucket(pmap, l2b, 1);
}
}
@@ -2458,7 +2435,9 @@ pmap_remove_all(vm_page_t m)
PTE_SYNC(ptep);
pmap_free_l2_bucket(pmap, l2b, 1);
pmap-pm_stats.resident_count--;
-   pmap_nuke_pv(m, pmap, pv);
+   TAILQ_REMOVE(m-md.pv_list, pv, pv_list);
+   if (pv-pv_flags  PVF_WIRED)
+   pmap-pm_stats.wired_count--;
pmap_free_pv_entry(pmap, pv);
PMAP_UNLOCK(pmap);
}
@@ -2469,6 +2448,7 @@ pmap_remove_all(vm_page_t m)
else
cpu_tlb_flushD();
}
+   vm_page_aflag_clear(m, PGA_WRITEABLE);
rw_wunlock(pvh_global_lock);
 }
 
@@ -3338,7 +3318,9 @@ pmap_pv_reclaim(pmap_t locked_pmap)
 va %x pte %x, va, *ptep));
*ptep = 0;
PTE_SYNC(ptep);
-   pmap_nuke_pv(m, pmap, pv);
+   TAILQ_REMOVE(m-md.pv_list, pv, pv_list);
+   if (TAILQ_EMPTY(m-md.pv_list))
+   vm_page_aflag_clear(m, 

svn commit: r254532 - in head/sys/arm: arm include

2013-08-19 Thread Rafal Jaworowski
Author: raj
Date: Mon Aug 19 15:12:36 2013
New Revision: 254532
URL: http://svnweb.freebsd.org/changeset/base/254532

Log:
  Clear all L2 PTE protection bits before their configuration.
  
  Revise L2_S_PROT_MASK to include all of the protection bits.  Notice that
  clearing these bits does not always take away the corresponding permissions
  (for example, permission is granted when the bit is cleared). The bits are
  cleared but are to be set or left cleared accordingly in pmap_set_prot(),
  pmap_enter_locked(), etc.
  
  Clear L2_XN along with L2_S_PROT_MASK in pmap_set_prot() so that all
  permissions related bits are cleared before actual configuration.
  
  Submitted by: Zbigniew Bodek z...@semihalf.com
  Reviewed by:  gber
  Sponsored by: The FreeBSD Foundation, Semihalf

Modified:
  head/sys/arm/arm/pmap-v6.c
  head/sys/arm/include/pmap.h

Modified: head/sys/arm/arm/pmap-v6.c
==
--- head/sys/arm/arm/pmap-v6.c  Mon Aug 19 14:56:17 2013(r254531)
+++ head/sys/arm/arm/pmap-v6.c  Mon Aug 19 15:12:36 2013(r254532)
@@ -1046,7 +1046,7 @@ static void
 pmap_set_prot(pt_entry_t *ptep, vm_prot_t prot, uint8_t user)
 {
 
-   *ptep = ~L2_S_PROT_MASK;
+   *ptep = ~(L2_S_PROT_MASK | L2_XN);
 
if (!(prot  VM_PROT_EXECUTE))
*ptep |= L2_XN;

Modified: head/sys/arm/include/pmap.h
==
--- head/sys/arm/include/pmap.h Mon Aug 19 14:56:17 2013(r254531)
+++ head/sys/arm/include/pmap.h Mon Aug 19 15:12:36 2013(r254532)
@@ -390,7 +390,7 @@ extern int pmap_needs_pte_sync;
 #defineL2_S_PROT_U (L2_AP0(2)) /* user read */
 #define L2_S_REF   (L2_AP0(1)) /* reference flag */
 
-#defineL2_S_PROT_MASK  (L2_S_PROT_U|L2_S_PROT_R)
+#defineL2_S_PROT_MASK  (L2_S_PROT_U|L2_S_PROT_R|L2_APX)
 #defineL2_S_EXECUTABLE(pte)(!(pte  L2_XN))
 #defineL2_S_WRITABLE(pte)  (!(pte  L2_APX))
 #defineL2_S_REFERENCED(pte)(!!(pte  L2_S_REF))
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r254533 - head/sys/arm/arm

2013-08-19 Thread Rafal Jaworowski
Author: raj
Date: Mon Aug 19 15:36:23 2013
New Revision: 254533
URL: http://svnweb.freebsd.org/changeset/base/254533

Log:
  Fix ARMv6/v7 mapping's wired status.
  
  Last input argument in pmap_modify_pv() should be a mask of flags to be set.
  In pmap_change_wiring() however, the straight wired status was used, which
  does not represent valid flags (and is of type boolean).
  
  This commit fixes the issue so that wired flag is passed to pmap_modify_pv()
  properly.
  
  Submitted by: Zbigniew Bodek z...@semihalf.com
  Reviewed by:  gber
  Sponsored by: The FreeBSD Foundation, Semihalf

Modified:
  head/sys/arm/arm/pmap-v6.c

Modified: head/sys/arm/arm/pmap-v6.c
==
--- head/sys/arm/arm/pmap-v6.c  Mon Aug 19 15:12:36 2013(r254532)
+++ head/sys/arm/arm/pmap-v6.c  Mon Aug 19 15:36:23 2013(r254533)
@@ -2932,7 +2932,8 @@ pmap_change_wiring(pmap_t pmap, vm_offse
pte = *ptep;
m = PHYS_TO_VM_PAGE(l2pte_pa(pte));
if (m != NULL)
-   pmap_modify_pv(m, pmap, va, PVF_WIRED, wired);
+   pmap_modify_pv(m, pmap, va, PVF_WIRED,
+   wired == TRUE ? PVF_WIRED : 0);
rw_wunlock(pvh_global_lock);
PMAP_UNLOCK(pmap);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r254535 - head/sys/arm/arm

2013-08-19 Thread Rafal Jaworowski
Author: raj
Date: Mon Aug 19 15:58:39 2013
New Revision: 254535
URL: http://svnweb.freebsd.org/changeset/base/254535

Log:
  Simplify and clean up pmap_clearbit()
  
  There is no need for calling vm_page_dirty() when clearing modified flag as
  it is already set for that page in pmap_fault_fixup() or pmap_enter() thanks
  to modified bit emulation.
  
  Also, there is no need for checking PTE referenced or writeable flags.  If
  there is a request to clear a particular flag we should just do it.
  
  Submitted by: Zbigniew Bodek z...@semihalf.com
  Reviewed by:  gber
  Sponsored by: The FreeBSD Foundation, Semihalf

Modified:
  head/sys/arm/arm/pmap-v6.c

Modified: head/sys/arm/arm/pmap-v6.c
==
--- head/sys/arm/arm/pmap-v6.c  Mon Aug 19 15:51:30 2013(r254534)
+++ head/sys/arm/arm/pmap-v6.c  Mon Aug 19 15:58:39 2013(r254535)
@@ -900,9 +900,6 @@ pmap_clearbit(struct vm_page *m, u_int m
 
rw_wlock(pvh_global_lock);
 
-   if (maskbits  PVF_WRITE)
-   maskbits |= PVF_MOD;
-
if (TAILQ_EMPTY(m-md.pv_list)) {
rw_wunlock(pvh_global_lock);
return (0);
@@ -924,14 +921,12 @@ pmap_clearbit(struct vm_page *m, u_int m
ptep = l2b-l2b_kva[l2pte_index(va)];
npte = opte = *ptep;
 
-   if ((maskbits  (PVF_WRITE|PVF_MOD))  L2_S_WRITABLE(opte)) {
-   vm_page_dirty(m);
-
+   if (maskbits  (PVF_WRITE | PVF_MOD)) {
/* make the pte read only */
npte |= L2_APX;
}
 
-   if ((maskbits  PVF_REF)  L2_S_REFERENCED(opte)) {
+   if (maskbits  PVF_REF) {
/*
 * Clear referenced flag in PTE so that we
 * will take a flag fault the next time the mapping
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r254536 - in head/sys/arm: arm include

2013-08-19 Thread Rafal Jaworowski
Author: raj
Date: Mon Aug 19 16:16:49 2013
New Revision: 254536
URL: http://svnweb.freebsd.org/changeset/base/254536

Log:
  Do not use pv_kva on ARMv6/v7 and save some space on each vm_page.  It's only
  relevant for older ARM variants (with virtual cache).
  
  Submitted by: Zbigniew Bodek z...@semihalf.com
  Reviewed by:  gber
  Sponsored by: The FreeBSD Foundation, Semihalf

Modified:
  head/sys/arm/arm/pmap-v6.c
  head/sys/arm/include/pmap.h

Modified: head/sys/arm/arm/pmap-v6.c
==
--- head/sys/arm/arm/pmap-v6.c  Mon Aug 19 15:58:39 2013(r254535)
+++ head/sys/arm/arm/pmap-v6.c  Mon Aug 19 16:16:49 2013(r254536)
@@ -4365,6 +4365,6 @@ pmap_page_set_memattr(vm_page_t m, vm_me
 * uncacheable, being careful to sync caches and PTEs (and maybe
 * invalidate TLB?) for any current mapping it modifies.
 */
-   if (m-md.pv_kva != 0 || TAILQ_FIRST(m-md.pv_list) != NULL)
+   if (TAILQ_FIRST(m-md.pv_list) != NULL)
panic(Can't change memattr on page with existing mappings);
 }

Modified: head/sys/arm/include/pmap.h
==
--- head/sys/arm/include/pmap.h Mon Aug 19 15:58:39 2013(r254535)
+++ head/sys/arm/include/pmap.h Mon Aug 19 16:16:49 2013(r254536)
@@ -121,7 +121,9 @@ struct  pv_chunk;
 struct md_page {
int pvh_attrs;
vm_memattr_t pv_memattr;
+#if (ARM_MMU_V6 + ARM_MMU_V7) == 0
vm_offset_t pv_kva; /* first kernel VA mapping */
+#endif
TAILQ_HEAD(,pv_entry)   pv_list;
 };
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r236324 - in head/sys: conf powerpc/booke powerpc/include

2012-05-30 Thread Rafal Jaworowski
Author: raj
Date: Wed May 30 17:34:40 2012
New Revision: 236324
URL: http://svn.freebsd.org/changeset/base/236324

Log:
  Extract vendor specific Book-E pieces into separate files and have a common
  skeleton (maybe we should kobj-tize this one day).
  
  Note the PPC4xx bit is not connected to the build yet.
  
  Obtained from:AppliedMicro, Semihalf.

Added:
  head/sys/powerpc/booke/machdep_e500.c   (contents, props changed)
  head/sys/powerpc/booke/machdep_ppc4xx.c   (contents, props changed)
  head/sys/powerpc/include/machdep.h   (contents, props changed)
Modified:
  head/sys/conf/files.powerpc
  head/sys/powerpc/booke/machdep.c

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Wed May 30 17:07:50 2012(r236323)
+++ head/sys/conf/files.powerpc Wed May 30 17:34:40 2012(r236324)
@@ -102,6 +102,7 @@ powerpc/booke/copyinout.c   optionalbooke
 powerpc/booke/interrupt.c  optionalbooke
 powerpc/booke/locore.S optionalbooke no-obj
 powerpc/booke/machdep.coptionalbooke
+powerpc/booke/machdep_e500.c   optionalbooke_e500
 powerpc/booke/mp_cpudep.c  optionalbooke smp
 powerpc/booke/platform_bare.c  optionalmpc85xx
 powerpc/booke/pmap.c   optionalbooke

Modified: head/sys/powerpc/booke/machdep.c
==
--- head/sys/powerpc/booke/machdep.cWed May 30 17:07:50 2012
(r236323)
+++ head/sys/powerpc/booke/machdep.cWed May 30 17:34:40 2012
(r236324)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (C) 2006 Semihalf, Marian Balakowicz m...@semihalf.com
+ * Copyright (C) 2006-2012 Semihalf
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -129,6 +129,7 @@ __FBSDID($FreeBSD$);
 #include machine/md_var.h
 #include machine/mmuvar.h
 #include machine/sigframe.h
+#include machine/machdep.h
 #include machine/metadata.h
 #include machine/platform.h
 
@@ -138,8 +139,6 @@ __FBSDID($FreeBSD$);
 #include dev/fdt/fdt_common.h
 #include dev/ofw/openfirm.h
 
-#include powerpc/mpc85xx/mpc85xx.h
-
 #ifdef DDB
 extern vm_offset_t ksym_start, ksym_end;
 #endif
@@ -158,11 +157,6 @@ extern unsigned char __sbss_start[];
 extern unsigned char __sbss_end[];
 extern unsigned char _end[];
 
-extern void dcache_enable(void);
-extern void dcache_inval(void);
-extern void icache_enable(void);
-extern void icache_inval(void);
-
 /*
  * Bootinfo is passed to us by legacy loaders. Save the address of the
  * structure to handle backward compatibility.
@@ -286,7 +280,6 @@ booke_init(uint32_t arg1, uint32_t arg2)
struct pcpu *pc;
void *kmdp, *mdp;
vm_offset_t dtbp, end;
-   uint32_t csr;
 
kmdp = NULL;
 
@@ -359,9 +352,9 @@ booke_init(uint32_t arg1, uint32_t arg2)
while (1);
 
OF_interpret(perform-fixup, 0);
-
-   /* Initialize TLB1 handling */
-   tlb1_init(fdt_immr_pa);
+   
+   /* Set up TLB initially */
+   booke_init_tlb(fdt_immr_pa);
 
/* Reset Time Base */
mttb(0);
@@ -396,10 +389,6 @@ booke_init(uint32_t arg1, uint32_t arg2)
debugf( HID0 = 0x%08x\n, mfspr(SPR_HID0));
debugf( HID1 = 0x%08x\n, mfspr(SPR_HID1));
debugf( BUCSR = 0x%08x\n, mfspr(SPR_BUCSR));
-
-   __asm __volatile(msync; isync);
-   csr = ccsr_read4(OCP85XX_L2CTL);
-   debugf( L2CTL = 0x%08x\n, csr);
 #endif
 
debugf( dtbp = 0x%08x\n, (uint32_t)dtbp);
@@ -447,29 +436,8 @@ booke_init(uint32_t arg1, uint32_t arg2)
mtmsr(mfmsr() | PSL_ME);
isync();
 
-   /* Enable D-cache if applicable */
-   csr = mfspr(SPR_L1CSR0);
-   if ((csr  L1CSR0_DCE) == 0) {
-   dcache_inval();
-   dcache_enable();
-   }
-
-   csr = mfspr(SPR_L1CSR0);
-   if ((boothowto  RB_VERBOSE) != 0 || (csr  L1CSR0_DCE) == 0)
-   printf(L1 D-cache %sabled\n,
-   (csr  L1CSR0_DCE) ? en : dis);
-
-   /* Enable L1 I-cache if applicable. */
-   csr = mfspr(SPR_L1CSR1);
-   if ((csr  L1CSR1_ICE) == 0) {
-   icache_inval();
-   icache_enable();
-   }
-
-   csr = mfspr(SPR_L1CSR1);
-   if ((boothowto  RB_VERBOSE) != 0 || (csr  L1CSR1_ICE) == 0)
-   printf(L1 I-cache %sabled\n,
-   (csr  L1CSR1_ICE) ? en : dis);
+   /* Enable L1 caches */
+   booke_enable_l1_cache();
 
debugf(%s: SP = 0x%08x\n, __func__,
((uintptr_t)thread0.td_pcb - 16)  ~15);

Added: head/sys/powerpc/booke/machdep_e500.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/powerpc/booke/machdep_e500.c   Wed May 30 17:34:40 2012
(r236324)
@@ -0,0 +1,158 @@
+/*-
+ * 

svn commit: r236325 - head/sys/powerpc/booke

2012-05-30 Thread Rafal Jaworowski
Author: raj
Date: Wed May 30 18:05:48 2012
New Revision: 236325
URL: http://svn.freebsd.org/changeset/base/236325

Log:
  Panic openly if we cannot retrieve memory information from the device tree.
  This is a critical condition and can lead to all sorts of misterious hangs if
  not handled.
  
  Obtained from:Semihalf
  Also reported by: thompsa

Modified:
  head/sys/powerpc/booke/platform_bare.c

Modified: head/sys/powerpc/booke/platform_bare.c
==
--- head/sys/powerpc/booke/platform_bare.c  Wed May 30 17:34:40 2012
(r236324)
+++ head/sys/powerpc/booke/platform_bare.c  Wed May 30 18:05:48 2012
(r236325)
@@ -76,7 +76,7 @@ static int bare_smp_start_cpu(platform_t
 static void booke_reset(platform_t);
 
 static platform_method_t bare_methods[] = {
-   PLATFORMMETHOD(platform_probe,  bare_probe),
+   PLATFORMMETHOD(platform_probe,  bare_probe),
PLATFORMMETHOD(platform_mem_regions,bare_mem_regions),
PLATFORMMETHOD(platform_timebase_freq,  bare_timebase_freq),
 
@@ -143,9 +143,9 @@ bare_mem_regions(platform_t plat, struct
int i, rv;
 
rv = fdt_get_mem_regions(avail_regions, availsz, memsize);
-
if (rv != 0)
-   return;
+   panic(%s: could not retrieve mem regions from the 'memory' 
+   node, error: %d, __func__, rv);
 
for (i = 0; i  *availsz; i++) {
if (avail_regions[i].mr_start  1048576) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r236141 - in head/sys: conf kern powerpc/booke powerpc/conf powerpc/include powerpc/powerpc

2012-05-27 Thread Rafal Jaworowski
Author: raj
Date: Sun May 27 10:25:20 2012
New Revision: 236141
URL: http://svn.freebsd.org/changeset/base/236141

Log:
  Let us manage differences of Book-E PowerPC variations i.e. vendor /
  implementation specific vs. the common architecture definition.
  
  Bring PPC4XX defines (PSL, SPR, TLB). Note the new definitions under
  BOOKE_PPC4XX are not used in the code yet.
  
  This change set is not supposed to affect existing E500 support, it's just
  another reorg step before bringing support for E500mc, E5500 and PPC465.
  
  Obtained from:AppliedMicro, Freescale, Semihalf

Modified:
  head/sys/conf/files.powerpc
  head/sys/conf/options.powerpc
  head/sys/kern/sched_ule.c
  head/sys/powerpc/booke/locore.S
  head/sys/powerpc/booke/machdep.c
  head/sys/powerpc/conf/MPC85XX
  head/sys/powerpc/conf/NOTES
  head/sys/powerpc/include/pcpu.h
  head/sys/powerpc/include/profile.h
  head/sys/powerpc/include/psl.h
  head/sys/powerpc/include/pte.h
  head/sys/powerpc/include/spr.h
  head/sys/powerpc/include/tlb.h
  head/sys/powerpc/include/trap.h
  head/sys/powerpc/include/vmparam.h
  head/sys/powerpc/powerpc/cpu.c
  head/sys/powerpc/powerpc/db_trace.c
  head/sys/powerpc/powerpc/gdb_machdep.c
  head/sys/powerpc/powerpc/genassym.c

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Sun May 27 09:34:47 2012(r236140)
+++ head/sys/conf/files.powerpc Sun May 27 10:25:20 2012(r236141)
@@ -97,17 +97,17 @@ powerpc/aim/swtch64.S   optionalaim powe
 powerpc/aim/trap.c optionalaim
 powerpc/aim/uma_machdep.c  optionalaim
 powerpc/aim/vm_machdep.c   optionalaim
-powerpc/booke/clock.c  optionale500
-powerpc/booke/copyinout.c  optionale500
-powerpc/booke/interrupt.c  optionale500
-powerpc/booke/locore.S optionale500 no-obj
-powerpc/booke/machdep.coptionale500
-powerpc/booke/mp_cpudep.c  optionale500 smp
+powerpc/booke/clock.c  optionalbooke
+powerpc/booke/copyinout.c  optionalbooke
+powerpc/booke/interrupt.c  optionalbooke
+powerpc/booke/locore.S optionalbooke no-obj
+powerpc/booke/machdep.coptionalbooke
+powerpc/booke/mp_cpudep.c  optionalbooke smp
 powerpc/booke/platform_bare.c  optionalmpc85xx
-powerpc/booke/pmap.c   optionale500
-powerpc/booke/swtch.S  optionale500
-powerpc/booke/trap.c   optionale500
-powerpc/booke/vm_machdep.c optionale500
+powerpc/booke/pmap.c   optionalbooke
+powerpc/booke/swtch.S  optionalbooke
+powerpc/booke/trap.c   optionalbooke
+powerpc/booke/vm_machdep.c optionalbooke
 powerpc/cpufreq/dfs.c  optionalcpufreq
 powerpc/cpufreq/pcr.c  optionalcpufreq aim
 powerpc/fpu/fpu_add.c  optionalfpu_emu powerpc

Modified: head/sys/conf/options.powerpc
==
--- head/sys/conf/options.powerpc   Sun May 27 09:34:47 2012
(r236140)
+++ head/sys/conf/options.powerpc   Sun May 27 10:25:20 2012
(r236141)
@@ -2,7 +2,9 @@
 # Options specific to the powerpc platform kernels
 
 AIMopt_global.h
-E500   opt_global.h
+BOOKE  opt_global.h
+BOOKE_E500 opt_global.h
+BOOKE_PPC4XX   opt_global.h
 CELL
 
 POWERPC

Modified: head/sys/kern/sched_ule.c
==
--- head/sys/kern/sched_ule.c   Sun May 27 09:34:47 2012(r236140)
+++ head/sys/kern/sched_ule.c   Sun May 27 10:25:20 2012(r236141)
@@ -77,7 +77,7 @@ dtrace_vtime_switch_func_tdtrace_vtime_
 #include machine/cpu.h
 #include machine/smp.h
 
-#if defined(__powerpc__)  defined(E500)
+#if defined(__powerpc__)  defined(BOOKE_E500)
 #error This architecture is not currently compatible with ULE
 #endif
 

Modified: head/sys/powerpc/booke/locore.S
==
--- head/sys/powerpc/booke/locore.S Sun May 27 09:34:47 2012
(r236140)
+++ head/sys/powerpc/booke/locore.S Sun May 27 10:25:20 2012
(r236141)
@@ -218,7 +218,7 @@ done_mapping:
mr  %r3, %r30
mr  %r4, %r31
 
-   /* Prepare e500 core */
+   /* Prepare core */
bl  booke_init
 
/* Switch to thread0.td_kstack now */

Modified: head/sys/powerpc/booke/machdep.c
==
--- head/sys/powerpc/booke/machdep.cSun May 27 09:34:47 2012
(r236140)
+++ head/sys/powerpc/booke/machdep.cSun May 27 10:25:20 2012
(r236141)
@@ -392,6 

svn commit: r236142 - head/sys/powerpc/booke

2012-05-27 Thread Rafal Jaworowski
Author: raj
Date: Sun May 27 10:32:10 2012
New Revision: 236142
URL: http://svn.freebsd.org/changeset/base/236142

Log:
  Remove redundant check, we catch ULE platform support in common
  sys/kern/sched_ule.c

Modified:
  head/sys/powerpc/booke/pmap.c

Modified: head/sys/powerpc/booke/pmap.c
==
--- head/sys/powerpc/booke/pmap.c   Sun May 27 10:25:20 2012
(r236141)
+++ head/sys/powerpc/booke/pmap.c   Sun May 27 10:32:10 2012
(r236142)
@@ -101,10 +101,6 @@ __FBSDID($FreeBSD$);
 
 #define TODO   panic(%s: not implemented, __func__);
 
-#include opt_sched.h
-#ifndef SCHED_4BSD
-#error e500 only works with SCHED_4BSD which uses a global scheduler lock.
-#endif
 extern struct mtx sched_lock;
 
 extern int dumpsys_minidump;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r236094 - head/sys/powerpc/include

2012-05-26 Thread Rafal Jaworowski
Author: raj
Date: Sat May 26 12:15:13 2012
New Revision: 236094
URL: http://svn.freebsd.org/changeset/base/236094

Log:
  Unify SPR defines formatting, no funtional changes.

Modified:
  head/sys/powerpc/include/spr.h

Modified: head/sys/powerpc/include/spr.h
==
--- head/sys/powerpc/include/spr.h  Sat May 26 10:28:11 2012
(r236093)
+++ head/sys/powerpc/include/spr.h  Sat May 26 12:15:13 2012
(r236094)
@@ -115,9 +115,9 @@
 #define  SRR1_ISI_NOEXECUTE0x1000 /* Memory marked no-execute 
*/
 #define  SRR1_ISI_PP   0x0800 /* PP bits forbid access */
 #defineSPR_DECAR   0x036   /* ..8 Decrementer auto reload 
*/
-#define SPR_EIE0x050   /* ..8 Exception Interrupt ??? 
*/
-#define SPR_EID0x051   /* ..8 Exception Interrupt ??? 
*/
-#define SPR_NRI0x052   /* ..8 Exception Interrupt ??? 
*/
+#defineSPR_EIE 0x050   /* ..8 Exception Interrupt ??? 
*/
+#defineSPR_EID 0x051   /* ..8 Exception Interrupt ??? 
*/
+#defineSPR_NRI 0x052   /* ..8 Exception Interrupt ??? 
*/
 #defineSPR_USPRG0  0x100   /* 4.. User SPR General 0 */
 #defineSPR_VRSAVE  0x100   /* .6. AltiVec VRSAVE */
 #defineSPR_SPRG0   0x110   /* 468 SPR General 0 */
@@ -202,49 +202,49 @@
 #defineSPR_DBAT2L  0x21d   /* .6. Data BAT Reg 2 Lower */
 #defineSPR_DBAT3U  0x21e   /* .6. Data BAT Reg 3 Upper */
 #defineSPR_DBAT3L  0x21f   /* .6. Data BAT Reg 3 Lower */
-#define SPR_IC_CST 0x230   /* ..8 Instruction Cache CSR */
-#define  IC_CST_IEN0x8000 /* I cache is ENabled   (RO) */
-#define  IC_CST_CMD_INVALL 0x0c00 /* I cache invalidate all */
-#define  IC_CST_CMD_UNLOCKALL  0x0a00 /* I cache unlock all */
-#define  IC_CST_CMD_UNLOCK 0x0800 /* I cache unlock block */
-#define  IC_CST_CMD_LOADLOCK   0x0600 /* I cache load  lock block */
-#define  IC_CST_CMD_DISABLE0x0400 /* I cache disable */
-#define  IC_CST_CMD_ENABLE 0x0200 /* I cache enable */
-#define  IC_CST_CCER1  0x0020 /* I cache error type 1 (RO) */
-#define  IC_CST_CCER2  0x0010 /* I cache error type 2 (RO) */
-#define  IC_CST_CCER3  0x0008 /* I cache error type 3 (RO) */
+#defineSPR_IC_CST  0x230   /* ..8 Instruction Cache CSR */
+#define  IC_CST_IEN0x8000 /* I cache is ENabled   (RO) 
*/
+#define  IC_CST_CMD_INVALL 0x0c00 /* I cache invalidate all */
+#define  IC_CST_CMD_UNLOCKALL  0x0a00 /* I cache unlock all */
+#define  IC_CST_CMD_UNLOCK 0x0800 /* I cache unlock block */
+#define  IC_CST_CMD_LOADLOCK   0x0600 /* I cache load  lock block 
*/
+#define  IC_CST_CMD_DISABLE0x0400 /* I cache disable */
+#define  IC_CST_CMD_ENABLE 0x0200 /* I cache enable */
+#define  IC_CST_CCER1  0x0020 /* I cache error type 1 (RO) 
*/
+#define  IC_CST_CCER2  0x0010 /* I cache error type 2 (RO) 
*/
+#define  IC_CST_CCER3  0x0008 /* I cache error type 3 (RO) 
*/
 #defineSPR_IBAT4U  0x230   /* .6. Instruction BAT Reg 4 
Upper */
-#define SPR_IC_ADR 0x231   /* ..8 Instruction Cache Address */
+#defineSPR_IC_ADR  0x231   /* ..8 Instruction Cache 
Address */
 #defineSPR_IBAT4L  0x231   /* .6. Instruction BAT Reg 4 
Lower */
-#define SPR_IC_DAT 0x232   /* ..8 Instruction Cache Data */
+#defineSPR_IC_DAT  0x232   /* ..8 Instruction Cache Data */
 #defineSPR_IBAT5U  0x232   /* .6. Instruction BAT Reg 5 
Upper */
 #defineSPR_IBAT5L  0x233   /* .6. Instruction BAT Reg 5 
Lower */
 #defineSPR_IBAT6U  0x234   /* .6. Instruction BAT Reg 6 
Upper */
 #defineSPR_IBAT6L  0x235   /* .6. Instruction BAT Reg 6 
Lower */
 #defineSPR_IBAT7U  0x236   /* .6. Instruction BAT Reg 7 
Upper */
 #defineSPR_IBAT7L  0x237   /* .6. Instruction BAT Reg 7 
Lower */
-#define SPR_DC_CST 0x230   /* ..8 Data Cache CSR */
-#define  DC_CST_DEN0x8000 /* D cache ENabled (RO) */
-#define  DC_CST_DFWT   0x4000 /* D cache Force Write-Thru (RO) */
-#define  DC_CST_LES0x2000 /* D cache Little Endian Swap (RO) */
-#define  DC_CST_CMD_FLUSH  0x0e00 /* D cache invalidate all */
-#define  DC_CST_CMD_INVALL 0x0c00 /* D cache invalidate all */
-#define  DC_CST_CMD_UNLOCKALL  0x0a00 /* D cache unlock all */
-#define  DC_CST_CMD_UNLOCK 0x0800 /* D cache unlock block 

svn commit: r236095 - head/sys/powerpc/include

2012-05-26 Thread Rafal Jaworowski
Author: raj
Date: Sat May 26 12:39:23 2012
New Revision: 236095
URL: http://svn.freebsd.org/changeset/base/236095

Log:
  Provide SPR definitions for newer Book-E (E500mc, E5500, PPC465).
  
  Obtained from:Freescale, Semihalf.

Modified:
  head/sys/powerpc/include/spr.h

Modified: head/sys/powerpc/include/spr.h
==
--- head/sys/powerpc/include/spr.h  Sat May 26 12:15:13 2012
(r236094)
+++ head/sys/powerpc/include/spr.h  Sat May 26 12:39:23 2012
(r236095)
@@ -184,6 +184,8 @@
 #define  MPC8245 0x8081
 #define  FSL_E500v1  0x8020
 #define  FSL_E500v2  0x8021
+#define  FSL_E500mc  0x8023
+#define  FSL_E5500   0x8024
 
 #defineSPR_IBAT0U  0x210   /* .68 Instruction BAT Reg 0 
Upper */
 #defineSPR_IBAT0U  0x210   /* .6. Instruction BAT Reg 0 
Upper */
@@ -421,6 +423,7 @@
 #defineSPR_SRR30x3df   /* 4.. Save/Restore Register 3 
*/
 #defineSPR_HID00x3f0   /* ..8 Hardware Implementation 
Register 0 */
 #defineSPR_HID10x3f1   /* ..8 Hardware Implementation 
Register 1 */
+#defineSPR_HID20x3f3   /* ..8 Hardware Implementation 
Register 2 */
 #defineSPR_HID40x3f4   /* ..8 Hardware Implementation 
Register 4 */
 #defineSPR_HID50x3f6   /* ..8 Hardware Implementation 
Register 5 */
 #defineSPR_HID60x3f9   /* ..8 Hardware Implementation 
Register 6 */
@@ -627,6 +630,8 @@
 
 #elif defined(E500)
 
+#defineSPR_MCSR0x23c   /* ..8 Machine Check Syndrome 
register */
+
 #defineSPR_ESR 0x003e  /* ..8 Exception Syndrome 
Register */
 #define  ESR_PIL 0x0800 /* Program interrupt - 
illegal */
 #define  ESR_PPR 0x0400 /* Program interrupt - 
privileged */
@@ -637,11 +642,16 @@
 #define  ESR_BO  0x0002 /* Data/instruction 
storage, byte ordering */
 #define  ESR_SPE 0x0080 /* SPE exception bit */
 
+
 #defineSPR_CSRR0   0x03a   /* ..8 58 Critical SRR0 */
 #defineSPR_CSRR1   0x03b   /* ..8 59 Critical SRR1 */
 #defineSPR_MCSRR0  0x23a   /* ..8 570 Machine check SRR0 */
 #defineSPR_MCSRR1  0x23b   /* ..8 571 Machine check SRR1 */
 
+#defineSPR_MMUCSR0 0x3f4   /* ..8 1012 MMU Control and 
Status Register 0 */
+#define  MMUCSR0_L2TLB0_FI 0x04/*  TLB0 flash invalidate */
+#define  MMUCSR0_L2TLB1_FI 0x02/*  TLB1 flash invalidate */
+
 #defineSPR_SVR 0x3ff   /* ..8 1023 System Version 
Register */
 #define  SVR_MPC8533 0x8034
 #define  SVR_MPC8533E0x803c
@@ -661,10 +671,16 @@
 #define  SVR_P2010E  0x80eb
 #define  SVR_P2020   0x80e2
 #define  SVR_P2020E  0x80ea
+#define  SVR_P2041   0x8210
+#define  SVR_P2041E  0x8218
+#define  SVR_P3041   0x8211
+#define  SVR_P3041E  0x8219
 #define  SVR_P4040   0x8200
 #define  SVR_P4040E  0x8208
 #define  SVR_P4080   0x8201
 #define  SVR_P4080E  0x8209
+#define  SVR_P5020   0x8220
+#define  SVR_P5020E  0x8228
 #defineSVR_VER(svr)(((svr)  16)  0x)
 
 #defineSPR_PID00x030   /* ..8 Process ID Register 0 */
@@ -707,6 +723,18 @@
 #defineSPR_MAS50x275   /* ..8 MMU Assist Register 5 
Book-E */
 #defineSPR_MAS60x276   /* ..8 MMU Assist Register 6 
Book-E/e500 */
 #defineSPR_MAS70x3B0   /* ..8 MMU Assist Register 7 
Book-E/e500 */
+#defineSPR_MAS80x155   /* ..8 MMU Assist Register 8 
Book-E/e500 */
+
+#defineSPR_L1CFG0  0x203   /* ..8 L1 cache configuration 
register 0 */
+#defineSPR_L1CFG1  0x204   /* ..8 L1 cache configuration 
register 1 */
+
+#defineSPR_CCR10x378
+#define  CCR1_L2COBE   0x0040
+
+#defineDCR_L2DCDCRAI   0x  /* L2 D-Cache DCR Address 
Pointer */
+#defineDCR_L2DCDCRDI   0x0001  /* L2 D-Cache DCR Data Indirect 
*/
+#defineDCR_L2CR0   0x00/* L2 Cache Configuration 
Register 0 */
+#define  L2CR0_AS  0x3000
 
 #defineSPR_L1CSR0  0x3F2   /* ..8 L1 Cache Control and 
Status Register 0 */
 #define  L1CSR0_DCPE   0x0001  /* Data Cache 

svn commit: r236097 - in head/sys/powerpc: booke powerpc

2012-05-26 Thread Rafal Jaworowski
Author: raj
Date: Sat May 26 13:36:18 2012
New Revision: 236097
URL: http://svn.freebsd.org/changeset/base/236097

Log:
  Rename e500 prefix to match other Book-E CPU variations. CPU id tidbits for
  the new cores.
  
  Obtained from:Freescale, Semihalf.

Modified:
  head/sys/powerpc/booke/machdep.c
  head/sys/powerpc/booke/platform_bare.c
  head/sys/powerpc/powerpc/cpu.c

Modified: head/sys/powerpc/booke/machdep.c
==
--- head/sys/powerpc/booke/machdep.cSat May 26 13:12:14 2012
(r236096)
+++ head/sys/powerpc/booke/machdep.cSat May 26 13:36:18 2012
(r236097)
@@ -185,8 +185,8 @@ SYSCTL_INT(_machdep, CPU_CACHELINE, cach
 
 int hw_direct_map = 0;
 
-static void cpu_e500_startup(void *);
-SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_e500_startup, NULL);
+static void cpu_booke_startup(void *);
+SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_booke_startup, NULL);
 
 void print_kernel_section_addr(void);
 void print_kenv(void);
@@ -195,7 +195,7 @@ u_int booke_init(uint32_t, uint32_t);
 extern int elf32_nxstack;
 
 static void
-cpu_e500_startup(void *dummy)
+cpu_booke_startup(void *dummy)
 {
int indx, size;
 
@@ -538,7 +538,8 @@ cpu_halt(void)
 {
 
mtmsr(mfmsr()  ~(PSL_CE | PSL_EE | PSL_ME | PSL_DE));
-   while (1);
+   while (1)
+   ;
 }
 
 int

Modified: head/sys/powerpc/booke/platform_bare.c
==
--- head/sys/powerpc/booke/platform_bare.c  Sat May 26 13:12:14 2012
(r236096)
+++ head/sys/powerpc/booke/platform_bare.c  Sat May 26 13:36:18 2012
(r236097)
@@ -73,7 +73,7 @@ static int bare_smp_next_cpu(platform_t,
 static int bare_smp_get_bsp(platform_t, struct cpuref *cpuref);
 static int bare_smp_start_cpu(platform_t, struct pcpu *cpu);
 
-static void e500_reset(platform_t);
+static void booke_reset(platform_t);
 
 static platform_method_t bare_methods[] = {
PLATFORMMETHOD(platform_probe,  bare_probe),
@@ -85,7 +85,7 @@ static platform_method_t bare_methods[] 
PLATFORMMETHOD(platform_smp_get_bsp,bare_smp_get_bsp),
PLATFORMMETHOD(platform_smp_start_cpu,  bare_smp_start_cpu),
 
-   PLATFORMMETHOD(platform_reset,  e500_reset),
+   PLATFORMMETHOD(platform_reset,  booke_reset),
 
{ 0, 0 }
 };
@@ -307,7 +307,7 @@ bare_smp_start_cpu(platform_t plat, stru
 }
 
 static void
-e500_reset(platform_t plat)
+booke_reset(platform_t plat)
 {
 
/*
@@ -328,6 +328,7 @@ e500_reset(platform_t plat)
mtspr(SPR_DBCR0, mfspr(SPR_DBCR0) | DBCR0_IDM | DBCR0_RST_SYSTEM);
 
printf(Reset failed...\n);
-   while (1);
+   while (1)
+   ;
 }
 

Modified: head/sys/powerpc/powerpc/cpu.c
==
--- head/sys/powerpc/powerpc/cpu.c  Sat May 26 13:12:14 2012
(r236096)
+++ head/sys/powerpc/powerpc/cpu.c  Sat May 26 13:36:18 2012
(r236097)
@@ -75,13 +75,13 @@
 #include machine/spr.h
 
 static voidcpu_6xx_setup(int cpuid, uint16_t vers);
-static voidcpu_e500_setup(int cpuid, uint16_t vers);
 static voidcpu_970_setup(int cpuid, uint16_t vers);
+static voidcpu_booke_setup(int cpuid, uint16_t vers);
 
 int powerpc_pow_enabled;
 void (*cpu_idle_hook)(void) = NULL;
 static voidcpu_idle_60x(void);
-static voidcpu_idle_e500(void);
+static voidcpu_idle_booke(void);
 
 struct cputab {
const char  *name;
@@ -146,9 +146,13 @@ static const struct cputab models[] = {
 { Motorola PowerPC 8245, MPC8245,REVFMT_MAJMIN,
   PPC_FEATURE_HAS_FPU, cpu_6xx_setup },
 { Freescale e500v1 core, FSL_E500v1, REVFMT_MAJMIN,
-  0, cpu_e500_setup },
+  0, cpu_booke_setup },
 { Freescale e500v2 core, FSL_E500v2, REVFMT_MAJMIN,
-  0, cpu_e500_setup },
+  0, cpu_booke_setup },
+   { Freescale e500mc core,  FSL_E500mc, REVFMT_MAJMIN,
+  0, cpu_booke_setup },
+   { Freescale e5500 core,   FSL_E5500,  REVFMT_MAJMIN,
+  0, cpu_booke_setup },
 { IBM Cell Broadband Engine, IBMCELLBE,  REVFMT_MAJMIN,
   PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU,
   NULL},
@@ -191,6 +195,8 @@ cpu_setup(u_int cpuid)
break;
case FSL_E500v1:
case FSL_E500v2:
+   case FSL_E500mc:
+   case FSL_E5500:
maj = (pvr   4)  0xf;
min = (pvr   0)  0xf;
break;
@@ -438,7 +444,7 @@ cpu_6xx_print_cacheinfo(u_int cpuid, uin
 }
 
 static void
-cpu_e500_setup(int cpuid, uint16_t vers)
+cpu_booke_setup(int cpuid, uint16_t vers)
 {
register_t hid0;
 
@@ -453,7 +459,7 @@ cpu_e500_setup(int cpuid, uint16_t vers)

svn commit: r236098 - head/sys/powerpc/booke

2012-05-26 Thread Rafal Jaworowski
Author: raj
Date: Sat May 26 13:42:55 2012
New Revision: 236098
URL: http://svn.freebsd.org/changeset/base/236098

Log:
  Retrieve CPU number info from the device tree.
  
  Obtained from:Freescale, Semihalf.

Modified:
  head/sys/powerpc/booke/platform_bare.c

Modified: head/sys/powerpc/booke/platform_bare.c
==
--- head/sys/powerpc/booke/platform_bare.c  Sat May 26 13:36:18 2012
(r236097)
+++ head/sys/powerpc/booke/platform_bare.c  Sat May 26 13:42:55 2012
(r236098)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2008-2009 Semihalf, Rafal Jaworowski
+ * Copyright (c) 2008-2012 Semihalf.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -101,26 +101,16 @@ PLATFORM_DEF(bare_platform);
 static int
 bare_probe(platform_t plat)
 {
-   uint32_t ver, sr;
+   phandle_t cpus, child;
+   uint32_t sr;
int i, law_max, tgt;
 
-   ver = SVR_VER(mfspr(SPR_SVR));
-   switch (ver  ~0x0008) {/* Mask Security Enabled bit */
-   case SVR_P4080:
-   maxcpu = 8;
-   break;
-   case SVR_P4040:
-   maxcpu = 4;
-   break;
-   case SVR_MPC8572:
-   case SVR_P1020:
-   case SVR_P2020:
-   maxcpu = 2;
-   break;
-   default:
+   if ((cpus = OF_finddevice(/cpus)) != 0) {
+   for (maxcpu = 0, child = OF_child(cpus); child != 0;
+   child = OF_peer(child), maxcpu++)
+   ;
+   } else
maxcpu = 1;
-   break;
-   }
 
/*
 * Clear local access windows. Skip DRAM entries, so we don't shoot
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r236119 - in head/sys: conf powerpc/mpc85xx powerpc/powerpc

2012-05-26 Thread Rafal Jaworowski
Author: raj
Date: Sat May 26 21:02:49 2012
New Revision: 236119
URL: http://svn.freebsd.org/changeset/base/236119

Log:
  Move OpenPIC FDT bus glue to a shared location, so that other PowerPC
  platforms can use it, not only MPC85XX.
  
  This is just reorg, no functional changes.

Added:
  head/sys/powerpc/powerpc/openpic_fdt.c
 - copied unchanged from r236094, head/sys/powerpc/mpc85xx/openpic_fdt.c
Deleted:
  head/sys/powerpc/mpc85xx/openpic_fdt.c
Modified:
  head/sys/conf/files.powerpc

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Sat May 26 20:13:24 2012(r236118)
+++ head/sys/conf/files.powerpc Sat May 26 21:02:49 2012(r236119)
@@ -132,7 +132,6 @@ powerpc/mpc85xx/isa.c   optionalmpc85xx 
 powerpc/mpc85xx/lbc.c  optionalmpc85xx
 powerpc/mpc85xx/mpc85xx.c  optionalmpc85xx
 powerpc/mpc85xx/nexus.coptionalmpc85xx
-powerpc/mpc85xx/openpic_fdt.c  optionalfdt
 powerpc/mpc85xx/pci_fdt.c  optionalpci mpc85xx
 powerpc/ofw/ofw_cpu.c  optionalaim
 powerpc/ofw/ofw_machdep.c  optionalaim
@@ -194,6 +193,7 @@ powerpc/powerpc/mem.c   optionalmem
 powerpc/powerpc/mmu_if.m   standard
 powerpc/powerpc/mp_machdep.c   optionalsmp
 powerpc/powerpc/openpic.c  standard
+powerpc/powerpc/openpic_fdt.c  optionalfdt
 powerpc/powerpc/pic_if.m   standard
 powerpc/powerpc/pmap_dispatch.cstandard
 powerpc/powerpc/platform.c standard

Copied: head/sys/powerpc/powerpc/openpic_fdt.c (from r236094, 
head/sys/powerpc/mpc85xx/openpic_fdt.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/powerpc/powerpc/openpic_fdt.c  Sat May 26 21:02:49 2012
(r236119, copy of r236094, head/sys/powerpc/mpc85xx/openpic_fdt.c)
@@ -0,0 +1,93 @@
+/*-
+ * Copyright (c) 2009-2010 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Semihalf under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+#include sys/param.h
+#include sys/kernel.h
+#include sys/module.h
+#include sys/bus.h
+
+#include machine/bus.h
+#include machine/intr_machdep.h
+
+#include dev/ofw/ofw_bus.h
+#include dev/ofw/ofw_bus_subr.h
+
+#include machine/openpicvar.h
+
+#include pic_if.h
+
+static int openpic_fdt_probe(device_t);
+static int openpic_fdt_attach(device_t);
+
+static device_method_t openpic_fdt_methods[] = {
+   /* Device interface */
+   DEVMETHOD(device_probe, openpic_fdt_probe),
+   DEVMETHOD(device_attach,openpic_fdt_attach),
+
+   /* PIC interface */
+   DEVMETHOD(pic_bind, openpic_bind),
+   DEVMETHOD(pic_config,   openpic_config),
+   DEVMETHOD(pic_dispatch, openpic_dispatch),
+   DEVMETHOD(pic_enable,   openpic_enable),
+   DEVMETHOD(pic_eoi,  openpic_eoi),
+   DEVMETHOD(pic_ipi,  openpic_ipi),
+   DEVMETHOD(pic_mask, openpic_mask),
+   DEVMETHOD(pic_unmask,   openpic_unmask),
+
+   { 0, 0 },
+};
+
+static driver_t openpic_fdt_driver = {
+   openpic,
+   openpic_fdt_methods,
+   sizeof(struct openpic_softc)
+};
+
+DRIVER_MODULE(openpic, simplebus, openpic_fdt_driver, openpic_devclass, 0, 0);
+
+static int
+openpic_fdt_probe(device_t dev)
+{
+
+   if (!ofw_bus_is_compatible(dev, chrp,open-pic))
+   return (ENXIO);
+ 

svn commit: r236120 - head/sys/dev/usb/controller

2012-05-26 Thread Rafal Jaworowski
Author: raj
Date: Sat May 26 21:05:11 2012
New Revision: 236120
URL: http://svn.freebsd.org/changeset/base/236120

Log:
  Import EHCI attachment driver for Freescale integrated controller.
  
  Obtained from:Freescale, Semihalf.
  Written by:   Michal Dubiel

Added:
  head/sys/dev/usb/controller/ehci_fsl.c   (contents, props changed)

Added: head/sys/dev/usb/controller/ehci_fsl.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/usb/controller/ehci_fsl.c  Sat May 26 21:05:11 2012
(r236120)
@@ -0,0 +1,423 @@
+/*-
+ * Copyright (c) 2010-2012 Semihalf
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+#include opt_bus.h
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/kernel.h
+#include sys/module.h
+#include sys/bus.h
+#include sys/queue.h
+#include sys/lock.h
+#include sys/lockmgr.h
+#include sys/condvar.h
+#include sys/rman.h
+
+#include dev/ofw/ofw_bus.h
+#include dev/ofw/ofw_bus_subr.h
+
+#include dev/usb/usb.h
+#include dev/usb/usbdi.h
+#include dev/usb/usb_core.h
+#include dev/usb/usb_busdma.h
+#include dev/usb/usb_process.h
+#include dev/usb/usb_util.h
+#include dev/usb/usb_controller.h
+#include dev/usb/usb_bus.h
+#include dev/usb/controller/ehci.h
+#include dev/usb/controller/ehcireg.h
+
+#include machine/bus.h
+#include machine/clock.h
+#include machine/resource.h
+
+#include powerpc/include/tlb.h
+
+#include opt_platform.h
+
+/*
+ * Register the driver
+ */
+/* Forward declarations */
+static int fsl_ehci_attach(device_t self);
+static int fsl_ehci_detach(device_t self);
+static int fsl_ehci_probe(device_t self);
+
+static device_method_t ehci_methods[] = {
+   /* Device interface */
+   DEVMETHOD(device_probe, fsl_ehci_probe),
+   DEVMETHOD(device_attach, fsl_ehci_attach),
+   DEVMETHOD(device_detach, fsl_ehci_detach),
+   DEVMETHOD(device_suspend, bus_generic_suspend),
+   DEVMETHOD(device_resume, bus_generic_resume),
+   DEVMETHOD(device_shutdown, bus_generic_shutdown),
+
+   /* Bus interface */
+   DEVMETHOD(bus_print_child, bus_generic_print_child),
+
+   { 0, 0 }
+};
+
+/* kobj_class definition */
+static driver_t ehci_driver = {
+   ehci,
+   ehci_methods,
+   sizeof(struct ehci_softc)
+};
+
+static devclass_t ehci_devclass;
+
+DRIVER_MODULE(ehci, simplebus, ehci_driver, ehci_devclass, 0, 0);
+MODULE_DEPEND(ehci, usb, 1, 1, 1);
+
+/*
+ * Private defines
+ */
+#define FSL_EHCI_REG_OFF   0x100
+#define FSL_EHCI_REG_SIZE  0x300
+
+/*
+ * Internal interface registers' offsets.
+ * Offsets from 0x000 ehci dev space, big-endian access.
+ */
+enum internal_reg {
+   SNOOP1  = 0x400,
+   SNOOP2  = 0x404,
+   AGE_CNT_THRESH  = 0x408,
+   SI_CTRL = 0x410,
+   CONTROL = 0x500
+};
+
+/* CONTROL register bit flags */
+enum control_flags {
+   USB_EN  = 0x0004,
+   UTMI_PHY_EN = 0x0200,
+   ULPI_INT_EN = 0x0001
+};
+
+/* SI_CTRL register bit flags */
+enum si_ctrl_flags {
+   FETCH_32= 1,
+   FETCH_64= 0
+};
+
+#define SNOOP_RANGE_2GB0x1E
+
+/*
+ * Operational registers' offsets.
+ * Offsets from USBCMD register, little-endian access.
+ */
+enum special_op_reg {
+   USBMODE = 0x0A8,
+   PORTSC  = 0x084,
+   ULPI_VIEWPORT   = 0x70
+};
+
+/* USBMODE register bit flags */
+enum usbmode_flags {
+   HOST_MODE   = 0x3,
+   DEVICE_MODE = 0x2
+};
+
+#definePORT_POWER_MASK 0x1000
+
+/*
+ * Private methods
+ */
+

svn commit: r236121 - head/sys/powerpc/mpc85xx

2012-05-26 Thread Rafal Jaworowski
Author: raj
Date: Sat May 26 21:07:15 2012
New Revision: 236121
URL: http://svn.freebsd.org/changeset/base/236121

Log:
  Import eSDHC driver for Freescale integrated controller.
  
  Obtained from:Freescale, Semihalf
  Written by:   Michal Dubiel

Added:
  head/sys/powerpc/mpc85xx/fsl_sdhc.c   (contents, props changed)
  head/sys/powerpc/mpc85xx/fsl_sdhc.h   (contents, props changed)

Added: head/sys/powerpc/mpc85xx/fsl_sdhc.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/powerpc/mpc85xx/fsl_sdhc.c Sat May 26 21:07:15 2012
(r236121)
@@ -0,0 +1,1306 @@
+/*-
+ * Copyright (c) 2011-2012 Semihalf
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Driver for Freescale integrated eSDHC controller.
+ * Limitations:
+ * - No support for multi-block transfers.
+ */
+
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+#include sys/param.h
+#include sys/bus.h
+#include sys/kernel.h
+#include sys/lock.h
+#include sys/module.h
+#include sys/mutex.h
+#include sys/rman.h
+#include sys/sysctl.h
+#include sys/systm.h
+#include sys/taskqueue.h
+
+#include machine/bus.h
+#include machine/vmparam.h
+
+#include dev/fdt/fdt_common.h
+#include dev/ofw/ofw_bus.h
+#include dev/ofw/ofw_bus_subr.h
+
+#include dev/mmc/bridge.h
+#include dev/mmc/mmcreg.h
+#include dev/mmc/mmcvar.h
+#include dev/mmc/mmcbrvar.h
+
+#include powerpc/mpc85xx/mpc85xx.h
+
+#include opt_platform.h
+
+#include mmcbr_if.h
+
+#include fsl_sdhc.h
+
+#define DEBUG
+#undef DEBUG
+#ifdef DEBUG
+#defineDPRINTF(fmt, arg...)printf(DEBUG %s():  fmt, 
__FUNCTION__, ##arg)
+#else
+#defineDPRINTF(fmt, arg...)
+#endif
+
+
+/*
+ * Register the driver
+ */
+/* Forward declarations */
+static int fsl_sdhc_probe(device_t);
+static int fsl_sdhc_attach(device_t);
+static int fsl_sdhc_detach(device_t);
+
+static int fsl_sdhc_read_ivar(device_t, device_t, int, uintptr_t *);
+static int fsl_sdhc_write_ivar(device_t, device_t, int, uintptr_t);
+
+static int fsl_sdhc_update_ios(device_t, device_t);
+static int fsl_sdhc_request(device_t, device_t, struct mmc_request *);
+static int fsl_sdhc_get_ro(device_t, device_t);
+static int fsl_sdhc_acquire_host(device_t, device_t);
+static int fsl_sdhc_release_host(device_t, device_t);
+
+static device_method_t fsl_sdhc_methods[] = {
+   /* device_if */
+   DEVMETHOD(device_probe, fsl_sdhc_probe),
+   DEVMETHOD(device_attach, fsl_sdhc_attach),
+   DEVMETHOD(device_detach, fsl_sdhc_detach),
+
+   /* Bus interface */
+   DEVMETHOD(bus_read_ivar, fsl_sdhc_read_ivar),
+   DEVMETHOD(bus_write_ivar, fsl_sdhc_write_ivar),
+
+   /* OFW bus interface */
+   DEVMETHOD(ofw_bus_get_compat,   ofw_bus_gen_get_compat),
+   DEVMETHOD(ofw_bus_get_model,ofw_bus_gen_get_model),
+   DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name),
+   DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node),
+   DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type),
+
+   /* mmcbr_if */
+   DEVMETHOD(mmcbr_update_ios, fsl_sdhc_update_ios),
+   DEVMETHOD(mmcbr_request, fsl_sdhc_request),
+   DEVMETHOD(mmcbr_get_ro, fsl_sdhc_get_ro),
+   DEVMETHOD(mmcbr_acquire_host, fsl_sdhc_acquire_host),
+   DEVMETHOD(mmcbr_release_host, fsl_sdhc_release_host),
+
+   {0, 0},
+};
+
+/* kobj_class definition */
+static driver_t fsl_sdhc_driver = {
+   sdhci,
+   fsl_sdhc_methods,
+   

svn commit: r235999 - head/sys/dev/mii

2012-05-25 Thread Rafal Jaworowski
Author: raj
Date: Fri May 25 15:05:17 2012
New Revision: 235999
URL: http://svn.freebsd.org/changeset/base/235999

Log:
  More Cicada/Vitesse PHY ids.
  
  Obtained from:Semihalf

Modified:
  head/sys/dev/mii/ciphy.c
  head/sys/dev/mii/miidevs

Modified: head/sys/dev/mii/ciphy.c
==
--- head/sys/dev/mii/ciphy.cFri May 25 14:57:02 2012(r235998)
+++ head/sys/dev/mii/ciphy.cFri May 25 15:05:17 2012(r235999)
@@ -91,8 +91,10 @@ static const struct mii_phydesc ciphys[]
MII_PHY_DESC(xxCICADA, CS8201B),
MII_PHY_DESC(xxCICADA, CS8204),
MII_PHY_DESC(xxCICADA, VSC8211),
+   MII_PHY_DESC(xxCICADA, VSC8221),
MII_PHY_DESC(xxCICADA, CS8244),
MII_PHY_DESC(xxVITESSE, VSC8601),
+   MII_PHY_DESC(xxVITESSE, VSC8641),
MII_PHY_END
 };
 
@@ -368,8 +370,10 @@ ciphy_fixup(struct mii_softc *sc)
 
break;
case MII_MODEL_xxCICADA_VSC8211:
+   case MII_MODEL_xxCICADA_VSC8221:
case MII_MODEL_xxCICADA_CS8244:
case MII_MODEL_xxVITESSE_VSC8601:
+   case MII_MODEL_xxVITESSE_VSC8641:
break;
default:
device_printf(sc-mii_dev, unknown CICADA PHY model %x\n,

Modified: head/sys/dev/mii/miidevs
==
--- head/sys/dev/mii/miidevsFri May 25 14:57:02 2012(r235998)
+++ head/sys/dev/mii/miidevsFri May 25 15:05:17 2012(r235999)
@@ -52,7 +52,7 @@ oui AMD   0x1a
Advanced Micro Devic
 oui BROADCOM   0x001018Broadcom Corporation
 oui BROADCOM2  0x000af7Broadcom Corporation
 oui BROADCOM3  0x001be9Broadcom Corporation
-oui CICADA 0x0003F1Cicada Semiconductor
+oui CICADA 0x0003f1Cicada Semiconductor
 oui DAVICOM0x00606eDavicom Semiconductor
 oui ENABLESEMI 0x0010ddEnable Semiconductor
 oui ICPLUS 0x0090c3IC Plus Corp.
@@ -71,6 +71,7 @@ oui SEEQ  0x00a07dSeeq Technology
 oui SIS0x00e006Silicon Integrated 
Systems
 oui TI 0x080028Texas Instruments
 oui TSC0x00c039TDK Semiconductor
+oui VITESSE0x0001c1Vitesse Semiconductor
 oui XAQTI  0x00e0aeXaQti Corp.
 
 /* Some Intel 82553's use an alternative OUI. */
@@ -190,6 +191,7 @@ model xxBROADCOM_ALT1 BCM5906   0x0004 BCM
 model xxCICADA CS8201  0x0001 Cicada CS8201 10/100/1000TX PHY
 model xxCICADA CS8204  0x0004 Cicada CS8204 10/100/1000TX PHY
 model xxCICADA VSC8211 0x000b Cicada VSC8211 10/100/1000TX PHY
+model xxCICADA VSC8221 0x0015 Cicada CS8201 10/100/1000TX PHY
 model xxCICADA CS8201A 0x0020 Cicada CS8201 10/100/1000TX PHY
 model xxCICADA CS8201B 0x0021 Cicada CS8201 10/100/1000TX PHY
 model xxCICADA CS8244  0x002c Cicada CS8244 10/100/1000TX PHY
@@ -318,5 +320,8 @@ model TI TNETE2101  0x0003 TNETE2101 med
 model xxTSC 78Q21200x0014 78Q2120 10/100 media interface
 model xxTSC 78Q21210x0015 78Q2121 100BASE-TX media interface
 
+/* Vitesse Semiconductor */
+model xxVITESSE VSC86410x0003 Vitesse VSC8641 10/100/1000TX PHY
+
 /* XaQti Corp. PHYs */
 model xxXAQTI XMACII   0x XaQti Corp. XMAC II gigabit interface
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r236000 - head/sys/powerpc/powerpc

2012-05-25 Thread Rafal Jaworowski
Author: raj
Date: Fri May 25 15:13:55 2012
New Revision: 236000
URL: http://svn.freebsd.org/changeset/base/236000

Log:
  Missing vm_paddr_t bits which should have been part of r235936.

Modified:
  head/sys/powerpc/powerpc/mmu_if.m

Modified: head/sys/powerpc/powerpc/mmu_if.m
==
--- head/sys/powerpc/powerpc/mmu_if.m   Fri May 25 15:05:17 2012
(r235999)
+++ head/sys/powerpc/powerpc/mmu_if.m   Fri May 25 15:13:55 2012
(r236000)
@@ -761,7 +761,7 @@ METHOD void cpu_bootstrap {
  */
 METHOD void * mapdev {
mmu_t   _mmu;
-   vm_offset_t _pa;
+   vm_paddr_t  _pa;
vm_size_t   _size;
 };
 
@@ -818,7 +818,7 @@ METHOD void unmapdev {
  *
  * @retval pa  physical address corresponding to mapping
  */
-METHOD vm_offset_t kextract {
+METHOD vm_paddr_t kextract {
mmu_t   _mmu;
vm_offset_t _va;
 };
@@ -833,7 +833,7 @@ METHOD vm_offset_t kextract {
 METHOD void kenter {
mmu_t   _mmu;
vm_offset_t _va;
-   vm_offset_t _pa;
+   vm_paddr_t  _pa;
 };
 
 /**
@@ -860,7 +860,7 @@ METHOD void kenter_attr {
  */
 METHOD boolean_t dev_direct_mapped {
mmu_t   _mmu;
-   vm_offset_t _pa;
+   vm_paddr_t  _pa;
vm_size_t   _size;
 };
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r236000 - head/sys/powerpc/powerpc

2012-05-25 Thread Rafal Jaworowski

On 2012-05-25, at 17:28, Nathan Whitehorn wrote:

 On 05/25/12 10:13, Rafal Jaworowski wrote:
 Author: raj
 Date: Fri May 25 15:13:55 2012
 New Revision: 236000
 URL: http://svn.freebsd.org/changeset/base/236000
 
 Log:
   Missing vm_paddr_t bits which should have been part of r235936.
 
 I think you also need equivalent changes to aim/mmu_oea64.c.

Yes, but the GENERIC64 build appears currently broken, so I could not compile 
test it.

Rafal

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r236000 - head/sys/powerpc/powerpc

2012-05-25 Thread Rafal Jaworowski

On 2012-05-25, at 19:06, Rafal Jaworowski wrote:

 
 On 2012-05-25, at 17:28, Nathan Whitehorn wrote:
 
 On 05/25/12 10:13, Rafal Jaworowski wrote:
 Author: raj
 Date: Fri May 25 15:13:55 2012
 New Revision: 236000
 URL: http://svn.freebsd.org/changeset/base/236000
 
 Log:
  Missing vm_paddr_t bits which should have been part of r235936.
 
 I think you also need equivalent changes to aim/mmu_oea64.c.
 
 Yes, but the GENERIC64 build appears currently broken, so I could not compile 
 test it.

Sorry for the noise, I had some old powerpc64 build env locally, the build is 
fine. I'll commit the vm_paddr_t fix shortly.

Rafal

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r236019 - head/sys/powerpc/aim

2012-05-25 Thread Rafal Jaworowski
Author: raj
Date: Fri May 25 18:17:26 2012
New Revision: 236019
URL: http://svn.freebsd.org/changeset/base/236019

Log:
  Fix physical address type to vm_paddr_t also for powerpc64.

Modified:
  head/sys/powerpc/aim/mmu_oea64.c

Modified: head/sys/powerpc/aim/mmu_oea64.c
==
--- head/sys/powerpc/aim/mmu_oea64.cFri May 25 17:56:27 2012
(r236018)
+++ head/sys/powerpc/aim/mmu_oea64.cFri May 25 18:17:26 2012
(r236019)
@@ -306,7 +306,7 @@ boolean_t moea64_is_modified(mmu_t, vm_p
 boolean_t moea64_is_prefaultable(mmu_t, pmap_t, vm_offset_t);
 boolean_t moea64_is_referenced(mmu_t, vm_page_t);
 boolean_t moea64_ts_referenced(mmu_t, vm_page_t);
-vm_offset_t moea64_map(mmu_t, vm_offset_t *, vm_offset_t, vm_offset_t, int);
+vm_offset_t moea64_map(mmu_t, vm_offset_t *, vm_paddr_t, vm_paddr_t, int);
 boolean_t moea64_page_exists_quick(mmu_t, pmap_t, vm_page_t);
 int moea64_page_wired_mappings(mmu_t, vm_page_t);
 void moea64_pinit(mmu_t, pmap_t);
@@ -324,14 +324,14 @@ void moea64_zero_page_area(mmu_t, vm_pag
 void moea64_zero_page_idle(mmu_t, vm_page_t);
 void moea64_activate(mmu_t, struct thread *);
 void moea64_deactivate(mmu_t, struct thread *);
-void *moea64_mapdev(mmu_t, vm_offset_t, vm_size_t);
+void *moea64_mapdev(mmu_t, vm_paddr_t, vm_size_t);
 void *moea64_mapdev_attr(mmu_t, vm_offset_t, vm_size_t, vm_memattr_t);
 void moea64_unmapdev(mmu_t, vm_offset_t, vm_size_t);
-vm_offset_t moea64_kextract(mmu_t, vm_offset_t);
+vm_paddr_t moea64_kextract(mmu_t, vm_offset_t);
 void moea64_page_set_memattr(mmu_t, vm_page_t m, vm_memattr_t ma);
 void moea64_kenter_attr(mmu_t, vm_offset_t, vm_offset_t, vm_memattr_t ma);
-void moea64_kenter(mmu_t, vm_offset_t, vm_offset_t);
-boolean_t moea64_dev_direct_mapped(mmu_t, vm_offset_t, vm_size_t);
+void moea64_kenter(mmu_t, vm_offset_t, vm_paddr_t);
+boolean_t moea64_dev_direct_mapped(mmu_t, vm_paddr_t, vm_size_t);
 static void moea64_sync_icache(mmu_t, pmap_t, vm_offset_t, vm_size_t);
 
 static mmu_method_t moea64_methods[] = {
@@ -1641,7 +1641,7 @@ moea64_kenter_attr(mmu_t mmu, vm_offset_
 }
 
 void
-moea64_kenter(mmu_t mmu, vm_offset_t va, vm_offset_t pa)
+moea64_kenter(mmu_t mmu, vm_offset_t va, vm_paddr_t pa)
 {
 
moea64_kenter_attr(mmu, va, pa, VM_MEMATTR_DEFAULT);
@@ -1651,7 +1651,7 @@ moea64_kenter(mmu_t mmu, vm_offset_t va,
  * Extract the physical page address associated with the given kernel virtual
  * address.
  */
-vm_offset_t
+vm_paddr_t
 moea64_kextract(mmu_t mmu, vm_offset_t va)
 {
struct  pvo_entry *pvo;
@@ -1692,8 +1692,8 @@ moea64_kremove(mmu_t mmu, vm_offset_t va
  * first usable address after the mapped region.
  */
 vm_offset_t
-moea64_map(mmu_t mmu, vm_offset_t *virt, vm_offset_t pa_start,
-vm_offset_t pa_end, int prot)
+moea64_map(mmu_t mmu, vm_offset_t *virt, vm_paddr_t pa_start,
+vm_paddr_t pa_end, int prot)
 {
vm_offset_t sva, va;
 
@@ -2440,7 +2440,7 @@ moea64_clear_bit(mmu_t mmu, vm_page_t m,
 }
 
 boolean_t
-moea64_dev_direct_mapped(mmu_t mmu, vm_offset_t pa, vm_size_t size)
+moea64_dev_direct_mapped(mmu_t mmu, vm_paddr_t pa, vm_size_t size)
 {
struct pvo_entry *pvo, key;
vm_offset_t ppa;
@@ -2493,7 +2493,7 @@ moea64_mapdev_attr(mmu_t mmu, vm_offset_
 }
 
 void *
-moea64_mapdev(mmu_t mmu, vm_offset_t pa, vm_size_t size)
+moea64_mapdev(mmu_t mmu, vm_paddr_t pa, vm_size_t size)
 {
 
return moea64_mapdev_attr(mmu, pa, size, VM_MEMATTR_DEFAULT);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r236024 - head/sys/boot/fdt/dts

2012-05-25 Thread Rafal Jaworowski
Author: raj
Date: Fri May 25 20:43:38 2012
New Revision: 236024
URL: http://svn.freebsd.org/changeset/base/236024

Log:
  Import DTS files for the upcoming DPAA QorIQ (PowerPC) support.
  
- P2041RDB
- P3041DS
- P5020DS
  
  Obtained from:Freescale

Added:
  head/sys/boot/fdt/dts/p2041rdb.dts   (contents, props changed)
  head/sys/boot/fdt/dts/p2041si.dtsi   (contents, props changed)
  head/sys/boot/fdt/dts/p3041si.dtsi   (contents, props changed)
  head/sys/boot/fdt/dts/p5020ds.dts   (contents, props changed)
  head/sys/boot/fdt/dts/p5020si.dtsi   (contents, props changed)
Modified:
  head/sys/boot/fdt/dts/p3041ds.dts

Added: head/sys/boot/fdt/dts/p2041rdb.dts
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/boot/fdt/dts/p2041rdb.dts  Fri May 25 20:43:38 2012
(r236024)
@@ -0,0 +1,490 @@
+/*
+ * P2041RDB Device Tree Source
+ *
+ * Copyright 2011 Freescale Semiconductor Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * * Neither the name of Freescale Semiconductor nor the
+ *   names of its contributors may be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ *
+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License (GPL) as published by the Free Software
+ * Foundation, either version 2 of that License or (at your option) any
+ * later version.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 
THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/* $FreeBSD$ */
+
+/include/ p2041si.dtsi
+
+/ {
+   model = fsl,P2041RDB;
+   compatible = fsl,P2041RDB;
+   #address-cells = 2;
+   #size-cells = 2;
+   interrupt-parent = mpic;
+
+   aliases {
+   phy_rgmii_0 = phy_rgmii_0;
+   phy_rgmii_1 = phy_rgmii_1;
+   phy_sgmii_2 = phy_sgmii_2;
+   phy_sgmii_3 = phy_sgmii_3;
+   phy_sgmii_4 = phy_sgmii_4;
+   phy_sgmii_1c = phy_sgmii_1c;
+   phy_sgmii_1d = phy_sgmii_1d;
+   phy_sgmii_1e = phy_sgmii_1e;
+   phy_sgmii_1f = phy_sgmii_1f;
+   phy_xgmii_2 = phy_xgmii_2;
+   };
+
+   memory {
+   device_type = memory;
+   reg = 0x 0x 0x 0x8000;
+   };
+
+   dcsr: dcsr@f {
+   ranges = 0x 0xf 0x 0x01008000;
+   };
+
+   bman-portals@ff400 {
+   bman-portal@0 {
+   cpu-handle = cpu0;
+   };
+   bman-portal@4000 {
+   cpu-handle = cpu1;
+   };
+   bman-portal@8000 {
+   cpu-handle = cpu2;
+   };
+   bman-portal@c000 {
+   cpu-handle = cpu3;
+   };
+   bman-portal@1 {
+   };
+   bman-portal@14000 {
+   };
+   bman-portal@18000 {
+   };
+   bman-portal@1c000 {
+   };
+   bman-portal@2 {
+   };
+   bman-portal@24000 {
+   };
+
+   buffer-pool@0 {
+   compatible = fsl,p2041-bpool, fsl,bpool;
+   fsl,bpid = 0;
+   fsl,bpool-cfg = 0 0x100 0 1 0 0x100;
+   };
+   };
+
+   qman-portals@ff420 {
+   qportal0: qman-portal@0 {
+   cpu-handle = cpu0;
+   fsl,qman-pool-channels = qpool1 qpool2 qpool3
+ qpool4 qpool5 qpool6
+

svn commit: r236025 - head/sys/powerpc/include

2012-05-25 Thread Rafal Jaworowski
Author: raj
Date: Fri May 25 21:12:24 2012
New Revision: 236025
URL: http://svn.freebsd.org/changeset/base/236025

Log:
  Update HID defines for E500mc and E5500 CPU cores.
  
  Obtained from:Freescale, Semihalf

Modified:
  head/sys/powerpc/include/hid.h

Modified: head/sys/powerpc/include/hid.h
==
--- head/sys/powerpc/include/hid.h  Fri May 25 20:43:38 2012
(r236024)
+++ head/sys/powerpc/include/hid.h  Fri May 25 21:12:24 2012
(r236025)
@@ -78,6 +78,8 @@
 #define HID0_E500_SEL_TBCLK0x2000 /* Select Time Base clock */
 #define HID0_E500_MAS7UPDEN0x0080 /* Enable MAS7 update (e500v2) */
 
+#define HID0_E500MC_L2MMU_MHD  0x4000 /* L2MMU Multiple Hit Detection */
+
 #define HID0_BITMASK   \
 \20  \
 \040EMCP\037DBP\036EBA\035EBD\034BCLK\033EICE\032ECLK\031PAR \
@@ -105,6 +107,20 @@
 \027NAP\025DPM\023TG\022HANGDETECT\021NHR\020INORDER \
 \016TBCTRL\015TBEN\012CIABREN\011HDICEEN\001ENATTN   
 
+#define HID0_E500MC_BITMASK\
+\20  \
+\040EMCP\037EN_L2MMU_MHD\036b2\035b3\034b4\033b5\032b6\031b7 \
+\030b8\027b9\026b10\025b11\024b12\023b13\022b14\021b15   \
+\020b16\017b17\016b18\015b19\014b20\013b21\012b22\011b23 \
+\010EN_MAS7_UPDATE\007DCFA\006b26\005CIGLSO\004b28\003b29\002b30\001NOPTI
+
+#define HID0_E5500_BITMASK \
+\20  \
+\040EMCP\037EN_L2MMU_MHD\036b2\035b3\034b4\033b5\032b6\031b7 \
+\030b8\027b9\026b10\025b11\024b12\023b13\022b14\021b15   \
+\020b16\017b17\016b18\015b19\014b20\013b21\012b22\011b23 \
+\010b24\007DCFA\006b26\005CIGLSO\004b28\003b29\002b30\001NOPTI
+
 /*
  *  HID0 bit definitions per cpu model
  *
@@ -142,6 +158,40 @@
  *  30 -   -   -   NOPDST  NOPDST  NOPDST  NOPDST  -
  *  31 NOOPTI  -   NOOPTI  NOPTI   NOPTI   NOPTI   NOPTI   NOPTI
  *
+ * bit e500mc  e5500
+ *   0 EMCPEMCP
+ *   1 EN_L2MMU_MHDEN_L2MMU_MHD
+ *   2 -   -
+ *   3 -   -
+ *   4 -   -
+ *   5 -   -
+ *   6 -   -
+ *   7 -   -
+ *   8 -   -
+ *   9 -   -
+ *  10 -   -
+ *  11 -   -
+ *  12 -   -
+ *  13 -   -
+ *  14 -   -
+ *  15 -   -
+ *  16 -   -
+ *  17 -   -
+ *  18 -   -
+ *  19 -   -
+ *  20 -   -
+ *  21 -   -
+ *  22 -   -
+ *  23 -   -
+ *  24 EN_MAS7_UPDATE  -
+ *  25 DCFADCFA
+ *  26 -   -
+ *  27 CIGLSO  CIGLSO
+ *  28 -   -
+ *  29 -   -
+ *  30 -   -
+ *  31 NOPTI   NOPTI
+ *
  *  604: ECP = Enable cache parity checking
  *  604: SIE = Serial instruction execution disable
  * 7450: TBEN = Time Base Enable
@@ -160,6 +210,9 @@
 
 #define HID0_E500_DEFAULT_SET  (HID0_EMCP | HID0_E500_TBEN)
 #define HID1_E500_DEFAULT_SET  (HID1_E500_ABE | HID1_E500_ASTME)
+#define HID0_E500MC_DEFAULT_SET(HID0_EMCP | HID0_E500MC_L2MMU_MHD | \
+HID0_E500_MAS7UPDEN)
+#define HID0_E5500_DEFAULT_SET (HID0_EMCP | HID0_E500MC_L2MMU_MHD)
 
 #define HID5_970_DCBZ_SIZE_HI  0x0080UL/* dcbz does a 32-byte store */
 #define HID4_970_DISABLE_LG_PG 0x0004ULL   /* disables large pages */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r235936 - in head/sys/powerpc: aim booke include powerpc

2012-05-24 Thread Rafal Jaworowski
Author: raj
Date: Thu May 24 21:13:24 2012
New Revision: 235936
URL: http://svn.freebsd.org/changeset/base/235936

Log:
  Fix physical address type to vm_paddr_t.

Modified:
  head/sys/powerpc/aim/mmu_oea.c
  head/sys/powerpc/booke/pmap.c
  head/sys/powerpc/include/pmap.h
  head/sys/powerpc/powerpc/platform.c
  head/sys/powerpc/powerpc/pmap_dispatch.c

Modified: head/sys/powerpc/aim/mmu_oea.c
==
--- head/sys/powerpc/aim/mmu_oea.c  Thu May 24 21:09:38 2012
(r235935)
+++ head/sys/powerpc/aim/mmu_oea.c  Thu May 24 21:13:24 2012
(r235936)
@@ -289,7 +289,7 @@ boolean_t moea_is_modified(mmu_t, vm_pag
 boolean_t moea_is_prefaultable(mmu_t, pmap_t, vm_offset_t);
 boolean_t moea_is_referenced(mmu_t, vm_page_t);
 boolean_t moea_ts_referenced(mmu_t, vm_page_t);
-vm_offset_t moea_map(mmu_t, vm_offset_t *, vm_offset_t, vm_offset_t, int);
+vm_offset_t moea_map(mmu_t, vm_offset_t *, vm_paddr_t, vm_paddr_t, int);
 boolean_t moea_page_exists_quick(mmu_t, pmap_t, vm_page_t);
 int moea_page_wired_mappings(mmu_t, vm_page_t);
 void moea_pinit(mmu_t, pmap_t);
@@ -308,14 +308,14 @@ void moea_activate(mmu_t, struct thread 
 void moea_deactivate(mmu_t, struct thread *);
 void moea_cpu_bootstrap(mmu_t, int);
 void moea_bootstrap(mmu_t, vm_offset_t, vm_offset_t);
-void *moea_mapdev(mmu_t, vm_offset_t, vm_size_t);
+void *moea_mapdev(mmu_t, vm_paddr_t, vm_size_t);
 void *moea_mapdev_attr(mmu_t, vm_offset_t, vm_size_t, vm_memattr_t);
 void moea_unmapdev(mmu_t, vm_offset_t, vm_size_t);
-vm_offset_t moea_kextract(mmu_t, vm_offset_t);
+vm_paddr_t moea_kextract(mmu_t, vm_offset_t);
 void moea_kenter_attr(mmu_t, vm_offset_t, vm_offset_t, vm_memattr_t);
-void moea_kenter(mmu_t, vm_offset_t, vm_offset_t);
+void moea_kenter(mmu_t, vm_offset_t, vm_paddr_t);
 void moea_page_set_memattr(mmu_t mmu, vm_page_t m, vm_memattr_t ma);
-boolean_t moea_dev_direct_mapped(mmu_t, vm_offset_t, vm_size_t);
+boolean_t moea_dev_direct_mapped(mmu_t, vm_paddr_t, vm_size_t);
 static void moea_sync_icache(mmu_t, pmap_t, vm_offset_t, vm_size_t);
 
 static mmu_method_t moea_methods[] = {
@@ -1436,7 +1436,7 @@ moea_page_set_memattr(mmu_t mmu, vm_page
  * Map a wired page into kernel virtual address space.
  */
 void
-moea_kenter(mmu_t mmu, vm_offset_t va, vm_offset_t pa)
+moea_kenter(mmu_t mmu, vm_offset_t va, vm_paddr_t pa)
 {
 
moea_kenter_attr(mmu, va, pa, VM_MEMATTR_DEFAULT);
@@ -1471,7 +1471,7 @@ moea_kenter_attr(mmu_t mmu, vm_offset_t 
  * Extract the physical page address associated with the given kernel virtual
  * address.
  */
-vm_offset_t
+vm_paddr_t
 moea_kextract(mmu_t mmu, vm_offset_t va)
 {
struct  pvo_entry *pvo;
@@ -1512,8 +1512,8 @@ moea_kremove(mmu_t mmu, vm_offset_t va)
  * first usable address after the mapped region.
  */
 vm_offset_t
-moea_map(mmu_t mmu, vm_offset_t *virt, vm_offset_t pa_start,
-vm_offset_t pa_end, int prot)
+moea_map(mmu_t mmu, vm_offset_t *virt, vm_paddr_t pa_start,
+vm_paddr_t pa_end, int prot)
 {
vm_offset_t sva, va;
 
@@ -2408,7 +2408,7 @@ moea_bat_mapped(int idx, vm_offset_t pa,
 }
 
 boolean_t
-moea_dev_direct_mapped(mmu_t mmu, vm_offset_t pa, vm_size_t size)
+moea_dev_direct_mapped(mmu_t mmu, vm_paddr_t pa, vm_size_t size)
 {
int i;
 
@@ -2431,7 +2431,7 @@ moea_dev_direct_mapped(mmu_t mmu, vm_off
  * NOT real memory.
  */
 void *
-moea_mapdev(mmu_t mmu, vm_offset_t pa, vm_size_t size)
+moea_mapdev(mmu_t mmu, vm_paddr_t pa, vm_size_t size)
 {
 
return (moea_mapdev_attr(mmu, pa, size, VM_MEMATTR_DEFAULT));

Modified: head/sys/powerpc/booke/pmap.c
==
--- head/sys/powerpc/booke/pmap.c   Thu May 24 21:09:38 2012
(r235935)
+++ head/sys/powerpc/booke/pmap.c   Thu May 24 21:13:24 2012
(r235936)
@@ -291,7 +291,7 @@ static boolean_tmmu_booke_is_modified(m
 static boolean_t   mmu_booke_is_prefaultable(mmu_t, pmap_t, vm_offset_t);
 static boolean_t   mmu_booke_is_referenced(mmu_t, vm_page_t);
 static boolean_t   mmu_booke_ts_referenced(mmu_t, vm_page_t);
-static vm_offset_t mmu_booke_map(mmu_t, vm_offset_t *, vm_offset_t, 
vm_offset_t,
+static vm_offset_t mmu_booke_map(mmu_t, vm_offset_t *, vm_paddr_t, 
vm_paddr_t,
 int);
 static int mmu_booke_mincore(mmu_t, pmap_t, vm_offset_t,
 vm_paddr_t *);
@@ -316,12 +316,12 @@ static void   mmu_booke_zero_page_idle(mm
 static voidmmu_booke_activate(mmu_t, struct thread *);
 static voidmmu_booke_deactivate(mmu_t, struct thread *);
 static voidmmu_booke_bootstrap(mmu_t, vm_offset_t, vm_offset_t);
-static void*mmu_booke_mapdev(mmu_t, vm_offset_t, vm_size_t);
+static void*mmu_booke_mapdev(mmu_t, vm_paddr_t, vm_size_t);
 static voidmmu_booke_unmapdev(mmu_t, vm_offset_t, vm_size_t);
-static vm_offset_t 

svn commit: r235938 - head/sys/dev/sec

2012-05-24 Thread Rafal Jaworowski
Author: raj
Date: Thu May 24 21:24:23 2012
New Revision: 235938
URL: http://svn.freebsd.org/changeset/base/235938

Log:
  Recognize version 3.1 of the SEC crypto engine.

Modified:
  head/sys/dev/sec/sec.c
  head/sys/dev/sec/sec.h

Modified: head/sys/dev/sec/sec.c
==
--- head/sys/dev/sec/sec.c  Thu May 24 21:23:13 2012(r235937)
+++ head/sys/dev/sec/sec.c  Thu May 24 21:24:23 2012(r235938)
@@ -227,6 +227,10 @@ sec_probe(device_t dev)
device_set_desc(dev, Freescale Security Engine 3.0);
sc-sc_version = 3;
break;
+   case SEC_31_ID:
+   device_set_desc(dev, Freescale Security Engine 3.1);
+   sc-sc_version = 3;
+   break;
default:
device_printf(dev, unknown SEC ID 0x%016llx!\n, id);
return (ENXIO);

Modified: head/sys/dev/sec/sec.h
==
--- head/sys/dev/sec/sec.h  Thu May 24 21:23:13 2012(r235937)
+++ head/sys/dev/sec/sec.h  Thu May 24 21:24:23 2012(r235938)
@@ -46,6 +46,7 @@
 /* SEC information */
 #define SEC_20_ID  0x0040ULL
 #define SEC_30_ID  0x00300300ULL
+#define SEC_31_ID  0x00300301ULL
 #define SEC_CHANNELS   4
 #define SEC_POINTERS   7
 #define SEC_MAX_DMA_BLOCK_SIZE 0x
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r234558 - in stable/9/sys: boot/fdt boot/uboot/common i386/conf kern

2012-04-21 Thread Rafal Jaworowski
Author: raj
Date: Sat Apr 21 20:10:26 2012
New Revision: 234558
URL: http://svn.freebsd.org/changeset/base/234558

Log:
  MFC r233230, r233323:
  
  Improve device tree blob (DTB) handling in loader(8).
  
   Enable using the statically embedded blob from the kernel, if present. The
   KLD loaded DTB takes precedence, but they are both recognized and handled in
   the same way.
  
  Improve FDT handling in loader(8) and make it more robust.
  
   o Fix buffer overflows when using a long property body in node paths.
   o Fix loop end condition when iterating through the symbol table.
   o Better error handling during node modification, better problem reporting.
   o Eliminate build time warnings.
  
  Submitted by:   Lukasz Wojcik
  Obtained from:  Semihalf

Modified:
  stable/9/sys/boot/fdt/fdt_loader_cmd.c
  stable/9/sys/boot/uboot/common/metadata.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)
  stable/9/sys/kern/subr_witness.c   (props changed)

Modified: stable/9/sys/boot/fdt/fdt_loader_cmd.c
==
--- stable/9/sys/boot/fdt/fdt_loader_cmd.c  Sat Apr 21 19:22:53 2012
(r234557)
+++ stable/9/sys/boot/fdt/fdt_loader_cmd.c  Sat Apr 21 20:10:26 2012
(r234558)
@@ -33,6 +33,9 @@ __FBSDID($FreeBSD$);
 #include stand.h
 #include fdt.h
 #include libfdt.h
+#include sys/param.h
+#include sys/linker.h
+#include machine/elf.h
 
 #include bootstrap.h
 #include glue.h
@@ -54,7 +57,9 @@ __FBSDID($FreeBSD$);
 #define STR(number) #number
 #define STRINGIFY(number) STR(number)
 
-#define MIN(num1, num2)(((num1)  (num2)) ? (num1):(num2))
+#define COPYOUT(s,d,l) archsw.arch_copyout((vm_offset_t)(s), d, l)
+
+#define FDT_STATIC_DTB_SYMBOL  fdt_static_dtb
 
 static struct fdt_header *fdtp = NULL;
 
@@ -92,6 +97,91 @@ static const struct cmdtab commands[] = 
 
 static char cwd[FDT_CWD_LEN] = /;
 
+static vm_offset_t
+fdt_find_static_dtb(void)
+{
+   Elf_Sym sym;
+   vm_offset_t dyntab, esym;
+   uint64_t offs;
+   struct preloaded_file *kfp;
+   struct file_metadata *md;
+   Elf_Sym *symtab;
+   Elf_Dyn *dyn;
+   char *strtab, *strp;
+   int i, sym_count;
+
+   symtab = NULL;
+   dyntab = esym = 0;
+   strtab = strp = NULL;
+
+   offs = __elfN(relocation_offset);
+
+   kfp = file_findfile(NULL, NULL);
+   if (kfp == NULL)
+   return (0);
+
+   md = file_findmetadata(kfp, MODINFOMD_ESYM);
+   if (md == NULL)
+   return (0);
+   COPYOUT(md-md_data, esym, sizeof(esym));
+
+   md = file_findmetadata(kfp, MODINFOMD_DYNAMIC);
+   if (md == NULL)
+   return (0);
+   COPYOUT(md-md_data, dyntab, sizeof(dyntab));
+
+   dyntab += offs;
+
+   /* Locate STRTAB and DYNTAB */
+   for (dyn = (Elf_Dyn *)dyntab; dyn-d_tag != DT_NULL; dyn++) {
+   if (dyn-d_tag == DT_STRTAB) {
+   strtab = (char *)(uintptr_t)(dyn-d_un.d_ptr + offs);
+   continue;
+   } else if (dyn-d_tag == DT_SYMTAB) {
+   symtab = (Elf_Sym *)(uintptr_t)
+   (dyn-d_un.d_ptr + offs);
+   continue;
+   }
+   }
+
+   if (symtab == NULL || strtab == NULL) {
+   /*
+* No symtab? No strtab? That should not happen here,
+* and should have been verified during __elfN(loadimage).
+* This must be some kind of a bug.
+*/
+   return (0);
+   }
+
+   sym_count = (int)((Elf_Sym *)esym - symtab) / sizeof(Elf_Sym);
+
+   /*
+* The most efficent way to find a symbol would be to calculate a
+* hash, find proper bucket and chain, and thus find a symbol.
+* However, that would involve code duplication (e.g. for hash
+* function). So we're using simpler and a bit slower way: we're
+* iterating through symbols, searching for the one which name is
+* 'equal' to 'fdt_static_dtb'. To speed up the process a little bit,
+* we are eliminating symbols type of which is not STT_NOTYPE, or(and)
+* those 

svn commit: r234559 - in stable/9/sys: arm/conf arm/mv boot/fdt/dts dev/cesa i386/conf kern

2012-04-21 Thread Rafal Jaworowski
Author: raj
Date: Sat Apr 21 20:22:02 2012
New Revision: 234559
URL: http://svn.freebsd.org/changeset/base/234559

Log:
  MFC r227730:
  
   Initial version of cesa(4) driver for Marvell crypto engine and security
   accelerator.
  
   The following algorithms and schemes are supported:
- 3DES, AES, DES
- MD5, SHA1
  
   Obtained from:   Semihalf
   Written by:  Piotr Ziecik

Added:
  stable/9/sys/dev/cesa/
 - copied from r227730, head/sys/dev/cesa/
Modified:
  stable/9/sys/arm/conf/DB-88F6XXX
  stable/9/sys/arm/conf/SHEEVAPLUG
  stable/9/sys/arm/mv/files.mv
  stable/9/sys/boot/fdt/dts/db88f6281.dts
  stable/9/sys/boot/fdt/dts/sheevaplug.dts
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)
  stable/9/sys/kern/subr_witness.c   (props changed)

Modified: stable/9/sys/arm/conf/DB-88F6XXX
==
--- stable/9/sys/arm/conf/DB-88F6XXXSat Apr 21 20:10:26 2012
(r234558)
+++ stable/9/sys/arm/conf/DB-88F6XXXSat Apr 21 20:22:02 2012
(r234559)
@@ -66,6 +66,10 @@ device   mii
 device e1000phy
 device bpf
 
+device cesa# Marvell security engine
+device crypto
+device cryptodev
+
 # USB
 optionsUSB_DEBUG   # enable debug msgs
 device usb

Modified: stable/9/sys/arm/conf/SHEEVAPLUG
==
--- stable/9/sys/arm/conf/SHEEVAPLUGSat Apr 21 20:10:26 2012
(r234558)
+++ stable/9/sys/arm/conf/SHEEVAPLUGSat Apr 21 20:22:02 2012
(r234559)
@@ -60,6 +60,10 @@ options  HZ=1000
 optionsDEVICE_POLLING
 device vlan
 
+device cesa# Marvell security engine
+device crypto
+device cryptodev
+
 # USB
 optionsUSB_DEBUG   # enable debug msgs
 device usb

Modified: stable/9/sys/arm/mv/files.mv
==
--- stable/9/sys/arm/mv/files.mvSat Apr 21 20:10:26 2012
(r234558)
+++ stable/9/sys/arm/mv/files.mvSat Apr 21 20:22:02 2012
(r234559)
@@ -28,6 +28,7 @@ arm/mv/mv_sata.c  optionalata | atamvsa
 arm/mv/timer.c standard
 arm/mv/twsi.c  optionaliicbus
 
+dev/cesa/cesa.coptionalcesa
 dev/mge/if_mge.c   optionalmge
 dev/mvs/mvs_soc.c  optionalmvs
 dev/uart/uart_dev_ns8250.c optionaluart

Modified: stable/9/sys/boot/fdt/dts/db88f6281.dts
==
--- stable/9/sys/boot/fdt/dts/db88f6281.dts Sat Apr 21 20:10:26 2012
(r234558)
+++ stable/9/sys/boot/fdt/dts/db88f6281.dts Sat Apr 21 20:22:02 2012
(r234559)
@@ -239,6 +239,8 @@
reg = 0x3 0x1;
interrupts = 22;
interrupt-parent = PIC;
+
+   sram-handle = SRAM;
};
 
usb@5 {

Modified: stable/9/sys/boot/fdt/dts/sheevaplug.dts
==
--- stable/9/sys/boot/fdt/dts/sheevaplug.dtsSat Apr 21 20:10:26 2012
(r234558)
+++ stable/9/sys/boot/fdt/dts/sheevaplug.dtsSat Apr 21 20:22:02 2012
(r234559)
@@ -236,6 +236,8 @@
reg = 0x3 0x1;
interrupts = 22;
interrupt-parent = PIC;
+
+   sram-handle = SRAM;
};
 
usb@5 {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r233323 - head/sys/boot/fdt

2012-03-22 Thread Rafal Jaworowski
Author: raj
Date: Thu Mar 22 20:34:26 2012
New Revision: 233323
URL: http://svn.freebsd.org/changeset/base/233323

Log:
  Improve FDT handling in loader(8) and make it more robust.
  
  o Fix buffer overflows when using a long property body in node paths.
  o Fix loop end condition when iterating through the symbol table.
  o Better error handling during node modification, better problem reporting.
  o Eliminate build time warnings.
  
  Submitted by: Lukasz Wojcik
  Obtained from:Semihalf
  MFC after:1 week

Modified:
  head/sys/boot/fdt/fdt_loader_cmd.c

Modified: head/sys/boot/fdt/fdt_loader_cmd.c
==
--- head/sys/boot/fdt/fdt_loader_cmd.c  Thu Mar 22 20:31:52 2012
(r233322)
+++ head/sys/boot/fdt/fdt_loader_cmd.c  Thu Mar 22 20:34:26 2012
(r233323)
@@ -57,8 +57,6 @@ __FBSDID($FreeBSD$);
 #define STR(number) #number
 #define STRINGIFY(number) STR(number)
 
-#define MIN(num1, num2)(((num1)  (num2)) ? (num1):(num2))
-
 #define COPYOUT(s,d,l) archsw.arch_copyout((vm_offset_t)(s), d, l)
 
 #define FDT_STATIC_DTB_SYMBOL  fdt_static_dtb
@@ -110,9 +108,11 @@ fdt_find_static_dtb(void)
Elf_Sym *symtab;
Elf_Dyn *dyn;
char *strtab, *strp;
-   int i;
+   int i, sym_count;
 
-   esym = strtab = symtab = 0;
+   symtab = NULL;
+   dyntab = esym = 0;
+   strtab = strp = NULL;
 
offs = __elfN(relocation_offset);
 
@@ -129,6 +129,7 @@ fdt_find_static_dtb(void)
if (md == NULL)
return (0);
COPYOUT(md-md_data, dyntab, sizeof(dyntab));
+
dyntab += offs;
 
/* Locate STRTAB and DYNTAB */
@@ -152,6 +153,8 @@ fdt_find_static_dtb(void)
return (0);
}
 
+   sym_count = (int)((Elf_Sym *)esym - symtab) / sizeof(Elf_Sym);
+
/*
 * The most efficent way to find a symbol would be to calculate a
 * hash, find proper bucket and chain, and thus find a symbol.
@@ -162,7 +165,7 @@ fdt_find_static_dtb(void)
 * we are eliminating symbols type of which is not STT_NOTYPE, or(and)
 * those which binding attribute is not STB_GLOBAL.
 */
-   for (i = 0; (vm_offset_t)(symtab + i)  esym; i++) {
+   for (i = 0; i  sym_count; i++) {
COPYOUT(symtab + i, sym, sizeof(sym));
if (ELF_ST_BIND(sym.st_info) != STB_GLOBAL ||
ELF_ST_TYPE(sym.st_info) != STT_NOTYPE)
@@ -190,7 +193,7 @@ fdt_setup_fdtp()
 */
bfp = file_findfile(NULL, dtb);
if (bfp == NULL) {
-   if ((fdtp = (struct fdt_head *)fdt_find_static_dtb()) == 0) {
+   if ((fdtp = (struct fdt_header *)fdt_find_static_dtb()) == 0) {
command_errmsg = no device tree blob found!;
return (CMD_ERROR);
}
@@ -842,32 +845,41 @@ fdt_isprint(const void *data, int len, i
 static int
 fdt_data_str(const void *data, int len, int count, char **buf)
 {
-   char tmp[80], *b;
+   char *b, *tmp;
const char *d;
-   int i, l;
+   int buf_len, i, l;
 
/*
 * Calculate the length for the string and allocate memory.
 *
-* Note len already includes at least one terminator.
+* Note that 'len' already includes at least one terminator.
 */
-   l = len;
+   buf_len = len;
if (count  1) {
/*
 * Each token had already a terminator buried in 'len', but we
 * only need one eventually, don't count space for these.
 */
-   l -= count - 1;
+   buf_len -= count - 1;
 
/* Each consecutive token requires a ,  separator. */
-   l += count * 2;
+   buf_len += count * 2;
}
-   /* Space for surrounding double quotes. */
-   l += count * 2;
 
-   b = (char *)malloc(l);
+   /* Add some space for surrounding double quotes. */
+   buf_len += count * 2;
+
+   /* Note that string being put in 'tmp' may be as big as 'buf_len'. */
+   b = (char *)malloc(buf_len);
+   tmp = (char *)malloc(buf_len);
if (b == NULL)
-   return (1);
+   goto error;
+
+   if (tmp == NULL) {
+   free(b);
+   goto error;
+   }
+
b[0] = '\0';
 
/*
@@ -887,13 +899,17 @@ fdt_data_str(const void *data, int len, 
} while (i  len);
*buf = b;
 
+   free(tmp);
+
return (0);
+error:
+   return (1);
 }
 
 static int
 fdt_data_cell(const void *data, int len, char **buf)
 {
-   char tmp[80], *b;
+   char *b, *tmp;
const uint32_t *c;
int count, i, l;
 
@@ -916,8 +932,14 @@ fdt_data_cell(const void *data, int len,
l += 3;
 
b = (char *)malloc(l);
+   tmp = (char *)malloc(l);
if (b == NULL)
-   return (1);
+  

svn commit: r233230 - in head/sys/boot: fdt uboot/common

2012-03-20 Thread Rafal Jaworowski
Author: raj
Date: Tue Mar 20 13:08:57 2012
New Revision: 233230
URL: http://svn.freebsd.org/changeset/base/233230

Log:
  Improve device tree blob (DTB) handling in loader(8).
  
  Enable using the statically embedded blob from the kernel, if present. The KLD
  loaded DTB takes precedence, but they are both recognized and handled in the
  same way.
  
  Submitted by: Lukasz Wojcik
  Obtained from:Semihalf
  MFC after:1 week

Modified:
  head/sys/boot/fdt/fdt_loader_cmd.c
  head/sys/boot/uboot/common/metadata.c

Modified: head/sys/boot/fdt/fdt_loader_cmd.c
==
--- head/sys/boot/fdt/fdt_loader_cmd.c  Tue Mar 20 12:24:36 2012
(r233229)
+++ head/sys/boot/fdt/fdt_loader_cmd.c  Tue Mar 20 13:08:57 2012
(r233230)
@@ -33,6 +33,9 @@ __FBSDID($FreeBSD$);
 #include stand.h
 #include fdt.h
 #include libfdt.h
+#include sys/param.h
+#include sys/linker.h
+#include machine/elf.h
 
 #include bootstrap.h
 #include glue.h
@@ -56,6 +59,10 @@ __FBSDID($FreeBSD$);
 
 #define MIN(num1, num2)(((num1)  (num2)) ? (num1):(num2))
 
+#define COPYOUT(s,d,l) archsw.arch_copyout((vm_offset_t)(s), d, l)
+
+#define FDT_STATIC_DTB_SYMBOL  fdt_static_dtb
+
 static struct fdt_header *fdtp = NULL;
 
 static int fdt_cmd_nyi(int argc, char *argv[]);
@@ -92,6 +99,86 @@ static const struct cmdtab commands[] = 
 
 static char cwd[FDT_CWD_LEN] = /;
 
+static vm_offset_t
+fdt_find_static_dtb(void)
+{
+   Elf_Sym sym;
+   vm_offset_t dyntab, esym;
+   uint64_t offs;
+   struct preloaded_file *kfp;
+   struct file_metadata *md;
+   Elf_Sym *symtab;
+   Elf_Dyn *dyn;
+   char *strtab, *strp;
+   int i;
+
+   esym = strtab = symtab = 0;
+
+   offs = __elfN(relocation_offset);
+
+   kfp = file_findfile(NULL, NULL);
+   if (kfp == NULL)
+   return (0);
+
+   md = file_findmetadata(kfp, MODINFOMD_ESYM);
+   if (md == NULL)
+   return (0);
+   COPYOUT(md-md_data, esym, sizeof(esym));
+
+   md = file_findmetadata(kfp, MODINFOMD_DYNAMIC);
+   if (md == NULL)
+   return (0);
+   COPYOUT(md-md_data, dyntab, sizeof(dyntab));
+   dyntab += offs;
+
+   /* Locate STRTAB and DYNTAB */
+   for (dyn = (Elf_Dyn *)dyntab; dyn-d_tag != DT_NULL; dyn++) {
+   if (dyn-d_tag == DT_STRTAB) {
+   strtab = (char *)(uintptr_t)(dyn-d_un.d_ptr + offs);
+   continue;
+   } else if (dyn-d_tag == DT_SYMTAB) {
+   symtab = (Elf_Sym *)(uintptr_t)
+   (dyn-d_un.d_ptr + offs);
+   continue;
+   }
+   }
+
+   if (symtab == NULL || strtab == NULL) {
+   /*
+* No symtab? No strtab? That should not happen here,
+* and should have been verified during __elfN(loadimage).
+* This must be some kind of a bug.
+*/
+   return (0);
+   }
+
+   /*
+* The most efficent way to find a symbol would be to calculate a
+* hash, find proper bucket and chain, and thus find a symbol.
+* However, that would involve code duplication (e.g. for hash
+* function). So we're using simpler and a bit slower way: we're
+* iterating through symbols, searching for the one which name is
+* 'equal' to 'fdt_static_dtb'. To speed up the process a little bit,
+* we are eliminating symbols type of which is not STT_NOTYPE, or(and)
+* those which binding attribute is not STB_GLOBAL.
+*/
+   for (i = 0; (vm_offset_t)(symtab + i)  esym; i++) {
+   COPYOUT(symtab + i, sym, sizeof(sym));
+   if (ELF_ST_BIND(sym.st_info) != STB_GLOBAL ||
+   ELF_ST_TYPE(sym.st_info) != STT_NOTYPE)
+   continue;
+
+   strp = strdupout((vm_offset_t)(strtab + sym.st_name));
+   if (strcmp(strp, FDT_STATIC_DTB_SYMBOL) == 0) {
+   /* Found a match ! */
+   free(strp);
+   return ((vm_offset_t)(sym.st_value + offs));
+   }
+   free(strp);
+   }
+   return (0);
+}
+
 static int
 fdt_setup_fdtp()
 {
@@ -103,10 +190,14 @@ fdt_setup_fdtp()
 */
bfp = file_findfile(NULL, dtb);
if (bfp == NULL) {
-   command_errmsg = no device tree blob loaded;
-   return (CMD_ERROR);
+   if ((fdtp = (struct fdt_head *)fdt_find_static_dtb()) == 0) {
+   command_errmsg = no device tree blob found!;
+   return (CMD_ERROR);
+   }
+   } else {
+   /* Dynamic blob has precedence over static. */
+   fdtp = (struct fdt_header *)bfp-f_addr;
}
-   fdtp = (struct fdt_header *)bfp-f_addr;
 
/*
 * Validate the 

svn commit: r233013 - head/sys/arm/mv

2012-03-15 Thread Rafal Jaworowski
Author: raj
Date: Thu Mar 15 21:48:27 2012
New Revision: 233013
URL: http://svn.freebsd.org/changeset/base/233013

Log:
  Fix error check.
  
  Submitted by: Lukasz Plachno
  Obtained from:Semihalf

Modified:
  head/sys/arm/mv/common.c

Modified: head/sys/arm/mv/common.c
==
--- head/sys/arm/mv/common.cThu Mar 15 21:19:50 2012(r233012)
+++ head/sys/arm/mv/common.cThu Mar 15 21:48:27 2012(r233013)
@@ -1766,7 +1766,7 @@ win_cpu_from_dt(void)
if (fdt_is_compatible(node, mrvl,cesa-sram))
goto moveon;
 
-   if ((node = OF_finddevice(/)) != -1)
+   if ((node = OF_finddevice(/)) == -1)
return (ENXIO);
 
if ((node = fdt_find_compatible(node, mrvl,cesa-sram, 0)) == 0)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r233014 - in stable/9/sys: arm/mv i386/conf

2012-03-15 Thread Rafal Jaworowski
Author: raj
Date: Thu Mar 15 22:08:25 2012
New Revision: 233014
URL: http://svn.freebsd.org/changeset/base/233014

Log:
  MFC r232512:
  
  Remove unused #defines. All this is now retrieved from the device tree.

Modified:
  stable/9/sys/arm/mv/mvreg.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/arm/mv/mvreg.h
==
--- stable/9/sys/arm/mv/mvreg.h Thu Mar 15 21:48:27 2012(r233013)
+++ stable/9/sys/arm/mv/mvreg.h Thu Mar 15 22:08:25 2012(r233014)
@@ -34,132 +34,6 @@
 #ifndef _MVREG_H_
 #define _MVREG_H_
 
-/*
- * Interrupt sources
- */
-#if defined(SOC_MV_ORION)
-
-#define MV_INT_BRIDGE  0   /* AHB-MBus Bridge Interrupt */
-#define MV_INT_UART0   3   /* UART0 Interrupt */
-#define MV_INT_UART1   4
-#define MV_INT_GPIO7_0 6   /* GPIO[7:0] Interrupt */
-#define MV_INT_GPIO15_87   /* GPIO[15:8] Interrupt */
-#define MV_INT_GPIO23_16   8   /* GPIO[23:16] Interrupt */
-#define MV_INT_GPIO31_24   9   /* GPIO[31:24] Interrupt */
-#define MV_INT_PEX0_ERR10  /* PCI Express Error */
-#define MV_INT_PEX011  /* PCI Express INTA,B,C,D Message */
-#define MV_INT_PCI_ERR 15  /* PCI Error */
-#define MV_INT_USB_BERR16  /* USB Bridge Error */
-#define MV_INT_USB_CI  17  /* USB Controller interrupt */
-#define MV_INT_GBERX   18  /* GbE receive interrupt */
-#define MV_INT_GBETX   19  /* GbE transmit interrupt */
-#define MV_INT_GBEMISC 20  /* GbE misc. interrupt */
-#define MV_INT_GBESUM  21  /* GbE summary interrupt */
-#define MV_INT_GBEERR  22  /* GbE error interrupt */
-#define MV_INT_IDMA_ERR23  /* DMA error interrupt */
-#define MV_INT_IDMA0   24  /* IDMA chan. 0 completion interrupt */
-#define MV_INT_IDMA1   25  /* IDMA chan. 1 completion interrupt */
-#define MV_INT_IDMA2   26  /* IDMA chan. 2 completion interrupt */
-#define MV_INT_IDMA3   27  /* IDMA chan. 3 completion interrupt */
-#define MV_INT_SATA29  /* Serial-ATA Interrupt */
-
-#elif defined(SOC_MV_KIRKWOOD)
-
-#define MV_INT_BRIDGE  1   /* AHB-MBus Bridge Interrupt */
-#define MV_INT_XOR0_CHAN0  5   /* XOR engine 0 channel 0 Interrupt */
-#define MV_INT_XOR0_CHAN1  6   /* XOR engine 0 channel 1 Interrupt */
-#define MV_INT_XOR1_CHAN0  7   /* XOR engine 1 channel 0 Interrupt */
-#define MV_INT_XOR1_CHAN1  8   /* XOR engine 1 channel 1 Interrupt */
-#define MV_INT_PEX09   /* PCI Express INTA,B,C,D Message */
-#define MV_INT_GBESUM  11  /* GbE0 summary interrupt */
-#define MV_INT_GBERX   12  /* GbE0 receive interrupt */
-#define MV_INT_GBETX   13  /* GbE0 transmit interrupt */
-#define MV_INT_GBEMISC 14  /* GbE0 misc. interrupt */
-#define MV_INT_GBE1SUM 15  /* GbE1 summary interrupt */
-#define MV_INT_GBE1RX  16  /* GbE1 receive interrupt */
-#define MV_INT_GBE1TX  17  /* GbE1 transmit interrupt */
-#define MV_INT_GBE1MISC18  /* GbE1 misc. interrupt */
-#define MV_INT_USB_CI  19  /* USB Controller interrupt */
-#define MV_INT_SATA21  /* Serial-ATA Interrupt */
-#define MV_INT_CESA22  /* Security engine completion int. */
-#define MV_INT_IDMA_ERR23  /* DMA error interrupt */
-#define MV_INT_UART0   33  /* UART0 Interrupt */
-#define MV_INT_UART1   34
-#define MV_INT_GPIO7_0 35  /* GPIO[7:0] Interrupt */
-#define MV_INT_GPIO15_836  /* GPIO[15:8] Interrupt */
-#define MV_INT_GPIO23_16   37  /* GPIO[23:16] Interrupt */
-#define MV_INT_GPIO31_24   38  /* GPIO[31:24] Interrupt */
-#define MV_INT_GPIOHI7_0   39  /* GPIOHI[7:0] Interrupt */
-#define MV_INT_GPIOHI15_8  40  /* GPIOHI[15:8] Interrupt */
-#define MV_INT_GPIOHI23_16 41  /* GPIOHI[23:16] Interrupt */
-#define MV_INT_XOR0_ERR42  

svn commit: r233015 - in stable/9/sys: boot/fdt/dts dev/fdt dev/mge dev/tsec i386/conf

2012-03-15 Thread Rafal Jaworowski
Author: raj
Date: Thu Mar 15 22:15:06 2012
New Revision: 233015
URL: http://svn.freebsd.org/changeset/base/233015

Log:
  MFC r232518:
  
  Respect phy-handle property in Ethernet nodes of the device tree.
  
  This lets specify whereabouts of the parent PHY for a given MAC node
  (and get rid of ugly kludges in mge(4) and tsec(4)).
  
  Obtained from:Semihalf

Modified:
  stable/9/sys/boot/fdt/dts/db78100.dts
  stable/9/sys/dev/fdt/fdt_common.c
  stable/9/sys/dev/fdt/fdt_common.h
  stable/9/sys/dev/mge/if_mge.c
  stable/9/sys/dev/mge/if_mgevar.h
  stable/9/sys/dev/tsec/if_tsec.c
  stable/9/sys/dev/tsec/if_tsec.h
  stable/9/sys/dev/tsec/if_tsec_fdt.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/boot/fdt/dts/db78100.dts
==
--- stable/9/sys/boot/fdt/dts/db78100.dts   Thu Mar 15 22:08:25 2012
(r233014)
+++ stable/9/sys/boot/fdt/dts/db78100.dts   Thu Mar 15 22:15:06 2012
(r233015)
@@ -221,6 +221,9 @@
phy0: ethernet-phy@0 {
reg = 0x8;
};
+   phy1: ethernet-phy@1 {
+   reg = 0x9;
+   };
};
};
 
@@ -234,17 +237,7 @@
local-mac-address = [ 00 00 00 00 00 00 ];
interrupts = 45 46 47 44 70;
interrupt-parent = PIC;
-   phy-handle = phy0;
-
-   mdio@0 {
-   #address-cells = 1;
-   #size-cells = 0;
-   compatible = mrvl,mdio;
-
-   phy0: ethernet-phy@0 {
-   reg = 0x9;
-   };
-   };
+   phy-handle = phy1;
};
 
serial0: serial@12000 {

Modified: stable/9/sys/dev/fdt/fdt_common.c
==
--- stable/9/sys/dev/fdt/fdt_common.c   Thu Mar 15 22:08:25 2012
(r233014)
+++ stable/9/sys/dev/fdt/fdt_common.c   Thu Mar 15 22:15:06 2012
(r233015)
@@ -542,11 +542,13 @@ out:
 }
 
 int
-fdt_get_phyaddr(phandle_t node, int *phy_addr)
+fdt_get_phyaddr(phandle_t node, device_t dev, int *phy_addr, void **phy_sc)
 {
phandle_t phy_node;
ihandle_t phy_ihandle;
pcell_t phy_handle, phy_reg;
+   uint32_t i;
+   device_t parent, child;
 
if (OF_getprop(node, phy-handle, (void *)phy_handle,
sizeof(phy_handle)) = 0)
@@ -561,6 +563,47 @@ fdt_get_phyaddr(phandle_t node, int *phy
return (ENXIO);
 
*phy_addr = fdt32_to_cpu(phy_reg);
+
+   /*
+* Search for softc used to communicate with phy.
+*/
+
+   /*
+* Step 1: Search for ancestor of the phy-node with a phy-handle
+* property set.
+*/
+   phy_node = OF_parent(phy_node);
+   while (phy_node != 0) {
+   if (OF_getprop(phy_node, phy-handle, (void *)phy_handle,
+   sizeof(phy_handle))  0)
+   break;
+   phy_node = OF_parent(phy_node);
+   }
+   if (phy_node == 0)
+   return (ENXIO);
+
+   /*
+* Step 2: For each device with the same parent and name as ours
+* compare its node with the one found in step 1, ancestor of phy
+* node (stored in phy_node).
+*/
+   parent = device_get_parent(dev);
+   i = 0;
+   child = device_find_child(parent, device_get_name(dev), i);
+   while (child != NULL) {
+   if (ofw_bus_get_node(child) == phy_node)
+   break;
+   i++;
+   child = device_find_child(parent, device_get_name(dev), i);
+   }
+   if (child == NULL)
+   return (ENXIO);
+
+   /*
+* Use softc of the device found.
+*/
+   *phy_sc = (void *)device_get_softc(child);
+
return (0);
 }
 

Modified: 

svn commit: r232508 - in stable/9/sys: arm/arm arm/include i386/conf

2012-03-04 Thread Rafal Jaworowski
Author: raj
Date: Sun Mar  4 17:00:46 2012
New Revision: 232508
URL: http://svn.freebsd.org/changeset/base/232508

Log:
  MFC r228504, r228530.
  
  r228504:
   Make *intr{cnt,names} on ARM reside in data section, similar to other arches.
  
   sintrnames and sintrcnt are initialized with non-zero values, which were
   discarded by the .bss directive, so consumers like vmstat -i were not
   getting correct data.
  
   Submitted by:Lukasz Plachno
   Obtained from:   Semihalf
  
  r228530:
   ARM pmap fixes:
  
   - Write Buffers have to be drained after write to Page Table even if caches
 are in write-through mode.
  
   - Make sure to sync PTE in pmap_zero_page_generic().
  
   Submitted by:Michal Mazur
   Reviewed by: cognet
   Obtained from:   Semihalf

Modified:
  stable/9/sys/arm/arm/irq_dispatch.S
  stable/9/sys/arm/arm/pmap.c
  stable/9/sys/arm/include/pmap.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/arm/arm/irq_dispatch.S
==
--- stable/9/sys/arm/arm/irq_dispatch.S Sun Mar  4 16:59:45 2012
(r232507)
+++ stable/9/sys/arm/arm/irq_dispatch.S Sun Mar  4 17:00:46 2012
(r232508)
@@ -98,10 +98,9 @@ ASENTRY_NP(irq_entry)
PULLFRAMEFROMSVCANDEXIT
movspc, lr  /* Exit */
 
-   .bss
+   .data
.align  0
 
-
.global _C_LABEL(intrnames), _C_LABEL(sintrnames)
.global _C_LABEL(intrcnt), _C_LABEL(sintrcnt)
 _C_LABEL(intrnames): 

Modified: stable/9/sys/arm/arm/pmap.c
==
--- stable/9/sys/arm/arm/pmap.c Sun Mar  4 16:59:45 2012(r232507)
+++ stable/9/sys/arm/arm/pmap.c Sun Mar  4 17:00:46 2012(r232508)
@@ -4044,6 +4044,7 @@ pmap_zero_page_generic(vm_paddr_t phys, 
 * order to work without corruption when write-allocate is enabled.
 */
*cdst_pte = L2_S_PROTO | phys | L2_S_PROT(PTE_KERNEL, VM_PROT_WRITE);
+   PTE_SYNC(cdst_pte);
cpu_tlb_flushD_SE(cdstp);
cpu_cpwait();
if (off || size != PAGE_SIZE)

Modified: stable/9/sys/arm/include/pmap.h
==
--- stable/9/sys/arm/include/pmap.h Sun Mar  4 16:59:45 2012
(r232507)
+++ stable/9/sys/arm/include/pmap.h Sun Mar  4 17:00:46 2012
(r232508)
@@ -382,7 +382,8 @@ do {
\
if (PMAP_NEEDS_PTE_SYNC) {  \
cpu_dcache_wb_range((vm_offset_t)(pte), sizeof(pt_entry_t));\
cpu_l2cache_wb_range((vm_offset_t)(pte), sizeof(pt_entry_t));\
-   }\
+   } else  \
+   cpu_drain_writebuf();   \
 } while (/*CONSTCOND*/0)
 
 #definePTE_SYNC_RANGE(pte, cnt)
\
@@ -392,7 +393,8 @@ do {
\
(cnt)  2); /* * sizeof(pt_entry_t) */ \
cpu_l2cache_wb_range((vm_offset_t)(pte),\
(cnt)  2); /* * sizeof(pt_entry_t) */ \
-   }   \
+   } else  \
+   cpu_drain_writebuf();   \
 } while (/*CONSTCOND*/0)
 
 extern pt_entry_t  pte_l1_s_cache_mode;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r232511 - in stable/9/sys: dev/mvs i386/conf

2012-03-04 Thread Rafal Jaworowski
Author: raj
Date: Sun Mar  4 17:53:40 2012
New Revision: 232511
URL: http://svn.freebsd.org/changeset/base/232511

Log:
  MFC r230865:
  
   Adjust mvs(4) to handle interrupt cause reg depending on the actual number of
   channels available
  
   - current code treats bits 4:7 in 'SATAHC interrupt mask' and 'SATAHC
 interrupt cause' as flags for SATA channels 2 and 3
  
   - for embedded SATA controllers (SoC) these bits have been marked as reserved
 in datasheets so far, but for some new and upcoming chips they are used for
 purposes other than SATA
  
   Submitted by:Lukasz Plachno
   Reviewed by: mav
   Obtained from:   Semihalf

Modified:
  stable/9/sys/dev/mvs/mvs.h
  stable/9/sys/dev/mvs/mvs_soc.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/dev/mvs/mvs.h
==
--- stable/9/sys/dev/mvs/mvs.h  Sun Mar  4 17:33:22 2012(r232510)
+++ stable/9/sys/dev/mvs/mvs.h  Sun Mar  4 17:53:40 2012(r232511)
@@ -61,6 +61,9 @@
 
 #define CHIP_SOC_LED   0x2C/* SoC LED Configuration */
 
+/* Additional mask for SoC devices with less than 4 channels */
+#define CHIP_SOC_HC0_MASK(num) (0xff  ((4 - (num)) * 2))
+
 /* Chip CCC registers */
 #define CHIP_ICC   0x18008
 #define CHIP_ICC_ALL_PORTS  (1  4)   /* all ports irq event */

Modified: stable/9/sys/dev/mvs/mvs_soc.c
==
--- stable/9/sys/dev/mvs/mvs_soc.c  Sun Mar  4 17:33:22 2012
(r232510)
+++ stable/9/sys/dev/mvs/mvs_soc.c  Sun Mar  4 17:53:40 2012
(r232511)
@@ -216,7 +216,9 @@ mvs_ctlr_setup(device_t dev)
if (ccc)
ccim |= IC_HC0_COAL_DONE;
/* Enable chip interrupts */
-   ctlr-gmim = (ccc ? IC_HC0_COAL_DONE : IC_DONE_HC0) | IC_ERR_HC0;
+   ctlr-gmim = ((ccc ? IC_HC0_COAL_DONE :
+   (IC_DONE_HC0  CHIP_SOC_HC0_MASK(ctlr-channels))) |
+   (IC_ERR_HC0  CHIP_SOC_HC0_MASK(ctlr-channels)));
ATA_OUTL(ctlr-r_mem, CHIP_SOC_MIM, ctlr-gmim | ctlr-pmim);
return (0);
 }
@@ -291,25 +293,26 @@ mvs_intr(void *data)
struct mvs_controller *ctlr = data;
struct mvs_intr_arg arg;
void (*function)(void *);
-   int p;
+   int p, chan_num;
u_int32_t ic, aic;
 
ic = ATA_INL(ctlr-r_mem, CHIP_SOC_MIC);
if ((ic  IC_HC0) == 0)
return;
+
/* Acknowledge interrupts of this HC. */
aic = 0;
-   if (ic  (IC_DONE_IRQ  0))
-   aic |= HC_IC_DONE(0) | HC_IC_DEV(0);
-   if (ic  (IC_DONE_IRQ  2))
-   aic |= HC_IC_DONE(1) | HC_IC_DEV(1);
-   if (ic  (IC_DONE_IRQ  4))
-   aic |= HC_IC_DONE(2) | HC_IC_DEV(2);
-   if (ic  (IC_DONE_IRQ  6))
-   aic |= HC_IC_DONE(3) | HC_IC_DEV(3);
+
+   /* Processing interrupts from each initialized channel */
+   for (chan_num = 0; chan_num  ctlr-channels; chan_num++) {
+   if (ic  (IC_DONE_IRQ  (chan_num * 2)))
+   aic |= HC_IC_DONE(chan_num) | HC_IC_DEV(chan_num);
+   }
+
if (ic  IC_HC0_COAL_DONE)
aic |= HC_IC_COAL;
ATA_OUTL(ctlr-r_mem, HC_IC, ~aic);
+
/* Call per-port interrupt handler. */
for (p = 0; p  ctlr-channels; p++) {
arg.cause = ic  (IC_ERR_IRQ|IC_DONE_IRQ);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r232512 - head/sys/arm/mv

2012-03-04 Thread Rafal Jaworowski
Author: raj
Date: Sun Mar  4 18:13:45 2012
New Revision: 232512
URL: http://svn.freebsd.org/changeset/base/232512

Log:
  Remove unused #defines. All this is now retrieved from the device tree.
  
  MFC after:1 week

Modified:
  head/sys/arm/mv/mvreg.h

Modified: head/sys/arm/mv/mvreg.h
==
--- head/sys/arm/mv/mvreg.h Sun Mar  4 17:53:40 2012(r232511)
+++ head/sys/arm/mv/mvreg.h Sun Mar  4 18:13:45 2012(r232512)
@@ -34,132 +34,6 @@
 #ifndef _MVREG_H_
 #define _MVREG_H_
 
-/*
- * Interrupt sources
- */
-#if defined(SOC_MV_ORION)
-
-#define MV_INT_BRIDGE  0   /* AHB-MBus Bridge Interrupt */
-#define MV_INT_UART0   3   /* UART0 Interrupt */
-#define MV_INT_UART1   4
-#define MV_INT_GPIO7_0 6   /* GPIO[7:0] Interrupt */
-#define MV_INT_GPIO15_87   /* GPIO[15:8] Interrupt */
-#define MV_INT_GPIO23_16   8   /* GPIO[23:16] Interrupt */
-#define MV_INT_GPIO31_24   9   /* GPIO[31:24] Interrupt */
-#define MV_INT_PEX0_ERR10  /* PCI Express Error */
-#define MV_INT_PEX011  /* PCI Express INTA,B,C,D Message */
-#define MV_INT_PCI_ERR 15  /* PCI Error */
-#define MV_INT_USB_BERR16  /* USB Bridge Error */
-#define MV_INT_USB_CI  17  /* USB Controller interrupt */
-#define MV_INT_GBERX   18  /* GbE receive interrupt */
-#define MV_INT_GBETX   19  /* GbE transmit interrupt */
-#define MV_INT_GBEMISC 20  /* GbE misc. interrupt */
-#define MV_INT_GBESUM  21  /* GbE summary interrupt */
-#define MV_INT_GBEERR  22  /* GbE error interrupt */
-#define MV_INT_IDMA_ERR23  /* DMA error interrupt */
-#define MV_INT_IDMA0   24  /* IDMA chan. 0 completion interrupt */
-#define MV_INT_IDMA1   25  /* IDMA chan. 1 completion interrupt */
-#define MV_INT_IDMA2   26  /* IDMA chan. 2 completion interrupt */
-#define MV_INT_IDMA3   27  /* IDMA chan. 3 completion interrupt */
-#define MV_INT_SATA29  /* Serial-ATA Interrupt */
-
-#elif defined(SOC_MV_KIRKWOOD)
-
-#define MV_INT_BRIDGE  1   /* AHB-MBus Bridge Interrupt */
-#define MV_INT_XOR0_CHAN0  5   /* XOR engine 0 channel 0 Interrupt */
-#define MV_INT_XOR0_CHAN1  6   /* XOR engine 0 channel 1 Interrupt */
-#define MV_INT_XOR1_CHAN0  7   /* XOR engine 1 channel 0 Interrupt */
-#define MV_INT_XOR1_CHAN1  8   /* XOR engine 1 channel 1 Interrupt */
-#define MV_INT_PEX09   /* PCI Express INTA,B,C,D Message */
-#define MV_INT_GBESUM  11  /* GbE0 summary interrupt */
-#define MV_INT_GBERX   12  /* GbE0 receive interrupt */
-#define MV_INT_GBETX   13  /* GbE0 transmit interrupt */
-#define MV_INT_GBEMISC 14  /* GbE0 misc. interrupt */
-#define MV_INT_GBE1SUM 15  /* GbE1 summary interrupt */
-#define MV_INT_GBE1RX  16  /* GbE1 receive interrupt */
-#define MV_INT_GBE1TX  17  /* GbE1 transmit interrupt */
-#define MV_INT_GBE1MISC18  /* GbE1 misc. interrupt */
-#define MV_INT_USB_CI  19  /* USB Controller interrupt */
-#define MV_INT_SATA21  /* Serial-ATA Interrupt */
-#define MV_INT_CESA22  /* Security engine completion int. */
-#define MV_INT_IDMA_ERR23  /* DMA error interrupt */
-#define MV_INT_UART0   33  /* UART0 Interrupt */
-#define MV_INT_UART1   34
-#define MV_INT_GPIO7_0 35  /* GPIO[7:0] Interrupt */
-#define MV_INT_GPIO15_836  /* GPIO[15:8] Interrupt */
-#define MV_INT_GPIO23_16   37  /* GPIO[23:16] Interrupt */
-#define MV_INT_GPIO31_24   38  /* GPIO[31:24] Interrupt */
-#define MV_INT_GPIOHI7_0   39  /* GPIOHI[7:0] Interrupt */
-#define MV_INT_GPIOHI15_8  40  /* GPIOHI[15:8] Interrupt */
-#define MV_INT_GPIOHI23_16 41  /* GPIOHI[23:16] Interrupt */
-#define MV_INT_XOR0_ERR42  /* XOR engine 0 error Interrupt 
*/
-#define MV_INT_XOR1_ERR43  /* XOR engine 1 error Interrupt 
*/
-#define MV_INT_PEX0_ERR44  /* PCI Express Error */
-#define MV_INT_GBEERR  46  /* GbE0 error interrupt */
-#define MV_INT_GBE1ERR 47  /* GbE1 error interrupt */
-#define MV_INT_USB_BERR48  /* USB Bridge Error */
-
-#elif defined(SOC_MV_DISCOVERY)
-
-#define MV_INT_ERRSUM  0   /* Summary of error interrupts */
-#define MV_INT_SPI 1   /* SPI interrupt */
-#define MV_INT_TWSI0   2   /* TWSI0 interrupt */
-#define MV_INT_TWSI1   3   /* TWSI1 interrupt */
-#define MV_INT_IDMA0   4   /* IDMA Channel0 completion */
-#define MV_INT_IDMA1

svn commit: r232518 - in head/sys: boot/fdt/dts dev/fdt dev/mge dev/tsec

2012-03-04 Thread Rafal Jaworowski
Author: raj
Date: Sun Mar  4 19:22:52 2012
New Revision: 232518
URL: http://svn.freebsd.org/changeset/base/232518

Log:
  Respect phy-handle property in Ethernet nodes of the device tree.
  
  This lets specify whereabouts of the parent PHY for a given MAC node
  (and get rid of ugly kludges in mge(4) and tsec(4)).
  
  Obtained from:Semihalf
  MFC after:1 week

Modified:
  head/sys/boot/fdt/dts/db78100.dts
  head/sys/dev/fdt/fdt_common.c
  head/sys/dev/fdt/fdt_common.h
  head/sys/dev/mge/if_mge.c
  head/sys/dev/mge/if_mgevar.h
  head/sys/dev/tsec/if_tsec.c
  head/sys/dev/tsec/if_tsec.h
  head/sys/dev/tsec/if_tsec_fdt.c

Modified: head/sys/boot/fdt/dts/db78100.dts
==
--- head/sys/boot/fdt/dts/db78100.dts   Sun Mar  4 18:59:38 2012
(r232517)
+++ head/sys/boot/fdt/dts/db78100.dts   Sun Mar  4 19:22:52 2012
(r232518)
@@ -221,6 +221,9 @@
phy0: ethernet-phy@0 {
reg = 0x8;
};
+   phy1: ethernet-phy@1 {
+   reg = 0x9;
+   };
};
};
 
@@ -234,17 +237,7 @@
local-mac-address = [ 00 00 00 00 00 00 ];
interrupts = 45 46 47 44 70;
interrupt-parent = PIC;
-   phy-handle = phy0;
-
-   mdio@0 {
-   #address-cells = 1;
-   #size-cells = 0;
-   compatible = mrvl,mdio;
-
-   phy0: ethernet-phy@0 {
-   reg = 0x9;
-   };
-   };
+   phy-handle = phy1;
};
 
serial0: serial@12000 {

Modified: head/sys/dev/fdt/fdt_common.c
==
--- head/sys/dev/fdt/fdt_common.c   Sun Mar  4 18:59:38 2012
(r232517)
+++ head/sys/dev/fdt/fdt_common.c   Sun Mar  4 19:22:52 2012
(r232518)
@@ -542,11 +542,13 @@ out:
 }
 
 int
-fdt_get_phyaddr(phandle_t node, int *phy_addr)
+fdt_get_phyaddr(phandle_t node, device_t dev, int *phy_addr, void **phy_sc)
 {
phandle_t phy_node;
ihandle_t phy_ihandle;
pcell_t phy_handle, phy_reg;
+   uint32_t i;
+   device_t parent, child;
 
if (OF_getprop(node, phy-handle, (void *)phy_handle,
sizeof(phy_handle)) = 0)
@@ -561,6 +563,47 @@ fdt_get_phyaddr(phandle_t node, int *phy
return (ENXIO);
 
*phy_addr = fdt32_to_cpu(phy_reg);
+
+   /*
+* Search for softc used to communicate with phy.
+*/
+
+   /*
+* Step 1: Search for ancestor of the phy-node with a phy-handle
+* property set.
+*/
+   phy_node = OF_parent(phy_node);
+   while (phy_node != 0) {
+   if (OF_getprop(phy_node, phy-handle, (void *)phy_handle,
+   sizeof(phy_handle))  0)
+   break;
+   phy_node = OF_parent(phy_node);
+   }
+   if (phy_node == 0)
+   return (ENXIO);
+
+   /*
+* Step 2: For each device with the same parent and name as ours
+* compare its node with the one found in step 1, ancestor of phy
+* node (stored in phy_node).
+*/
+   parent = device_get_parent(dev);
+   i = 0;
+   child = device_find_child(parent, device_get_name(dev), i);
+   while (child != NULL) {
+   if (ofw_bus_get_node(child) == phy_node)
+   break;
+   i++;
+   child = device_find_child(parent, device_get_name(dev), i);
+   }
+   if (child == NULL)
+   return (ENXIO);
+
+   /*
+* Use softc of the device found.
+*/
+   *phy_sc = (void *)device_get_softc(child);
+
return (0);
 }
 

Modified: head/sys/dev/fdt/fdt_common.h
==
--- head/sys/dev/fdt/fdt_common.h   Sun Mar  4 18:59:38 2012
(r232517)
+++ head/sys/dev/fdt/fdt_common.h   Sun Mar  4 19:22:52 2012
(r232518)
@@ -89,7 +89,7 @@ int fdt_data_to_res(pcell_t *, int, int,
 int fdt_data_verify(void *, int);
 phandle_t fdt_find_compatible(phandle_t, const char *, int);
 int fdt_get_mem_regions(struct mem_region *, int *, uint32_t *);
-int fdt_get_phyaddr(phandle_t node, int *);
+int fdt_get_phyaddr(phandle_t, device_t, int *, void **);
 int fdt_immr_addr(vm_offset_t);
 int fdt_regsize(phandle_t, u_long *, u_long *);
 int fdt_intr_decode(phandle_t, pcell_t *, int *, int *, int *);

Modified: head/sys/dev/mge/if_mge.c
==

svn commit: r230865 - head/sys/dev/mvs

2012-02-01 Thread Rafal Jaworowski
Author: raj
Date: Wed Feb  1 13:39:52 2012
New Revision: 230865
URL: http://svn.freebsd.org/changeset/base/230865

Log:
  Adjust mvs(4) to handle interrupt cause reg depending on the actual number of
  channels available
  
  - current code treats bits 4:7 in 'SATAHC interrupt mask' and 'SATAHC
interrupt cause' as flags for SATA channels 2 and 3
  
  - for embedded SATA controllers (SoC) these bits have been marked as reserved
in datasheets so far, but for some new and upcoming chips they are used for
purposes other than SATA
  
  Submitted by: Lukasz Plachno
  Reviewed by:  mav
  Obtained from:Semihalf
  MFC after:2 weeks

Modified:
  head/sys/dev/mvs/mvs.h
  head/sys/dev/mvs/mvs_soc.c

Modified: head/sys/dev/mvs/mvs.h
==
--- head/sys/dev/mvs/mvs.h  Wed Feb  1 13:33:53 2012(r230864)
+++ head/sys/dev/mvs/mvs.h  Wed Feb  1 13:39:52 2012(r230865)
@@ -61,6 +61,9 @@
 
 #define CHIP_SOC_LED   0x2C/* SoC LED Configuration */
 
+/* Additional mask for SoC devices with less than 4 channels */
+#define CHIP_SOC_HC0_MASK(num) (0xff  ((4 - (num)) * 2))
+
 /* Chip CCC registers */
 #define CHIP_ICC   0x18008
 #define CHIP_ICC_ALL_PORTS  (1  4)   /* all ports irq event */

Modified: head/sys/dev/mvs/mvs_soc.c
==
--- head/sys/dev/mvs/mvs_soc.c  Wed Feb  1 13:33:53 2012(r230864)
+++ head/sys/dev/mvs/mvs_soc.c  Wed Feb  1 13:39:52 2012(r230865)
@@ -216,7 +216,9 @@ mvs_ctlr_setup(device_t dev)
if (ccc)
ccim |= IC_HC0_COAL_DONE;
/* Enable chip interrupts */
-   ctlr-gmim = (ccc ? IC_HC0_COAL_DONE : IC_DONE_HC0) | IC_ERR_HC0;
+   ctlr-gmim = ((ccc ? IC_HC0_COAL_DONE :
+   (IC_DONE_HC0  CHIP_SOC_HC0_MASK(ctlr-channels))) |
+   (IC_ERR_HC0  CHIP_SOC_HC0_MASK(ctlr-channels)));
ATA_OUTL(ctlr-r_mem, CHIP_SOC_MIM, ctlr-gmim | ctlr-pmim);
return (0);
 }
@@ -291,25 +293,26 @@ mvs_intr(void *data)
struct mvs_controller *ctlr = data;
struct mvs_intr_arg arg;
void (*function)(void *);
-   int p;
+   int p, chan_num;
u_int32_t ic, aic;
 
ic = ATA_INL(ctlr-r_mem, CHIP_SOC_MIC);
if ((ic  IC_HC0) == 0)
return;
+
/* Acknowledge interrupts of this HC. */
aic = 0;
-   if (ic  (IC_DONE_IRQ  0))
-   aic |= HC_IC_DONE(0) | HC_IC_DEV(0);
-   if (ic  (IC_DONE_IRQ  2))
-   aic |= HC_IC_DONE(1) | HC_IC_DEV(1);
-   if (ic  (IC_DONE_IRQ  4))
-   aic |= HC_IC_DONE(2) | HC_IC_DEV(2);
-   if (ic  (IC_DONE_IRQ  6))
-   aic |= HC_IC_DONE(3) | HC_IC_DEV(3);
+
+   /* Processing interrupts from each initialized channel */
+   for (chan_num = 0; chan_num  ctlr-channels; chan_num++) {
+   if (ic  (IC_DONE_IRQ  (chan_num * 2)))
+   aic |= HC_IC_DONE(chan_num) | HC_IC_DEV(chan_num);
+   }
+
if (ic  IC_HC0_COAL_DONE)
aic |= HC_IC_COAL;
ATA_OUTL(ctlr-r_mem, HC_IC, ~aic);
+
/* Call per-port interrupt handler. */
for (p = 0; p  ctlr-channels; p++) {
arg.cause = ic  (IC_ERR_IRQ|IC_DONE_IRQ);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r230622 - head

2012-01-31 Thread Rafal Jaworowski

On 2012-01-30, at 22:56, Dimitry Andric wrote:

 On 2012-01-30 21:48, Ian Lepore wrote:
 On Mon, 2012-01-30 at 21:08 +0100, Dimitry Andric wrote:
 On 2012-01-30 20:27, Rafal Jaworowski wrote:
 ...
   Fix this by setting PATH to ${BPATH}:${PATH} in stage 2.3, so the
   bootstrap tools directories are searched before the regular ones.
 
 Is this supposed to work for cross building as well? I'm still 
 encountering problems on a 7.3 host build:
 
 1. Cross world builds fine
 make -j 8 buildworld TARGET_ARCH=arm
 
 2. Kernel fails w/ the aicasm
 make buildkernel TARGET_ARCH=arm KERNCONF=SHEEVAPLUG
 [...]
 cc -O2 -pipe -nostdinc -I/usr/include -I. 
 -I/home/raj/work/svn/base/head/sys/dev/aic7xxx/aicasm -std=gnu99  
 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter 
 -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type 
 -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter 
 -Wcast-align -Wno-pointer-sign -c aicasm_scan.c
 cc1: warnings being treated as errors
 /home/raj/work/svn/base/head/sys/dev/aic7xxx/aicasm/aicasm_scan.l:837: 
 warning: function declaration isn't a prototype
 
 Can you please try doing make buildenv TARGET_ARCH=arm, then run
 which lex and which yacc?
 
 Shouldn't lex and yacc be listed in the Makefile.inc1 bootstrap-tools
 target for this to be fully effective?  It looks like neither is in
 RELENG_7 and lex is only conditionally listed in RELENG_8.
 
 It is, for head at least (but I think I will MFC this change, if it
 turns out to work correctly).  Look in Makefile.inc1, around line 1030:
 
 .if ${BOOTSTRAPPING}  96
 _lex= usr.bin/lex
 _yacc=usr.bin/yacc
 .endif
 
 I have assumed Rafal is building a head checkout on 7.3 release.  Since
 BOOTSTRAPPING will most likely be 703000, the lex and yacc targets are
 built during the bootstrap-tools stage.
 
 That said, I still don't understand why the generated aicasm_scan.c file
 is still defining the input() function.  Rafal, just to be sure, can you
 please paste the file that was generated during your buildkernel?

Problem identified: the auto-gen'd aicasm files would not get updated in the 
preexisting kernel OBJ subdir. After wiping out the OBJ sub dir entirely make 
buildkernel works fine.

Do you know why would the generated aicasm* files not get a refresh in the 
kernel OBJ dir?

Rafal

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r230622 - head

2012-01-31 Thread Rafal Jaworowski

On 2012-01-31, at 14:53, Dimitry Andric wrote:

 On 2012-01-31 14:20, Rafal Jaworowski wrote:
 On 2012-01-30, at 22:56, Dimitry Andric wrote:
 ...
 That said, I still don't understand why the generated aicasm_scan.c file
 is still defining the input() function.  Rafal, just to be sure, can you
 please paste the file that was generated during your buildkernel?
 
 Problem identified: the auto-gen'd aicasm files would not get updated in the 
 preexisting kernel OBJ subdir. After wiping out the OBJ sub dir entirely 
 make buildkernel works fine.
 
 Do you know why would the generated aicasm* files not get a refresh in the 
 kernel OBJ dir?
 
 Well, in general, incremental building is difficult to get working for
 all corner cases, like this particular one.  The lexer and scanner .c
 files are generated from .l and .y files, so if the latter did not get
 an updated timestamp, the .c files will not be regenerated either.
 
 The only way to fix this would be to add a dependency on the actual lex
 and yacc executables.  But that is probably overkill: if you wanted to
 be consistent, you would also have to relink every executable if ld gets
 updated, recompile every object file if cc gets updated, and so on.
 
 It's probably easier to just clean out your object tree, and build from
 scratch. :)

Sure, I was just curious. Thanks for help!

Rafal

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r230622 - head

2012-01-30 Thread Rafal Jaworowski

On 2012-01-27, at 19:29, Dimitry Andric wrote:

 Author: dim
 Date: Fri Jan 27 18:29:03 2012
 New Revision: 230622
 URL: http://svn.freebsd.org/changeset/base/230622
 
 Log:
  When the buildkernel stage 2.3 (build tools) runs, the PATH is still set
  to the default from the top-level Makefile.  Therefore, invocations of
  lex and yacc (used during building of aicasm) will use the executables
  in /usr/bin, not those optionally built during the previous buildworld
  or kernel-toolchain.  This makes kernel builds from older FreeBSD
  releases more difficult than necessary.
 
  Fix this by setting PATH to ${BPATH}:${PATH} in stage 2.3, so the
  bootstrap tools directories are searched before the regular ones.

Is this supposed to work for cross building as well? I'm still encountering 
problems on a 7.3 host build:

1. Cross world builds fine
make -j 8 buildworld TARGET_ARCH=arm

2. Kernel fails w/ the aicasm
make buildkernel TARGET_ARCH=arm KERNCONF=SHEEVAPLUG
[...]
cc -O2 -pipe -nostdinc -I/usr/include -I. 
-I/home/raj/work/svn/base/head/sys/dev/aic7xxx/aicasm -std=gnu99  
-Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter 
-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type 
-Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align 
-Wno-pointer-sign -c aicasm_scan.c
cc1: warnings being treated as errors
/home/raj/work/svn/base/head/sys/dev/aic7xxx/aicasm/aicasm_scan.l:837: warning: 
function declaration isn't a prototype
*** Error code 1

Stop in /home/raj/work/obj/arm.arm/home/raj/work/svn/base/head/sys/SHEEVAPLUG.
*** Error code 1

Stop in /home/raj/work/svn/base/head.
*** Error code 1

Stop in /home/raj/work/svn/base/head.

Do you know any workarounds to this?

Rafal

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r230622 - head

2012-01-30 Thread Rafal Jaworowski

On 2012-01-30, at 21:08, Dimitry Andric wrote:

 On 2012-01-30 20:27, Rafal Jaworowski wrote:
 ...
  Fix this by setting PATH to ${BPATH}:${PATH} in stage 2.3, so the
  bootstrap tools directories are searched before the regular ones.
 
 Is this supposed to work for cross building as well? I'm still encountering 
 problems on a 7.3 host build:
 
 1. Cross world builds fine
 make -j 8 buildworld TARGET_ARCH=arm
 
 2. Kernel fails w/ the aicasm
 make buildkernel TARGET_ARCH=arm KERNCONF=SHEEVAPLUG
 [...]
 cc -O2 -pipe -nostdinc -I/usr/include -I. 
 -I/home/raj/work/svn/base/head/sys/dev/aic7xxx/aicasm -std=gnu99  
 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter 
 -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type 
 -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter 
 -Wcast-align -Wno-pointer-sign -c aicasm_scan.c
 cc1: warnings being treated as errors
 /home/raj/work/svn/base/head/sys/dev/aic7xxx/aicasm/aicasm_scan.l:837: 
 warning: function declaration isn't a prototype
 
 Can you please try doing make buildenv TARGET_ARCH=arm, then run
 which lex and which yacc?


make buildenv TARGET_ARCH=arm
Entering world for arm:arm
$ which lex
/home/raj/work/obj//arm.arm/home/raj/work/svn/base/head/tmp/legacy/usr/bin/lex
$ which yacc
/home/raj/work/obj//arm.arm/home/raj/work/svn/base/head/tmp/legacy/usr/bin/yacc
$ 

They seem freshly built (from the earlier buildworld run).

Rafal

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228530 - in head/sys/arm: arm include

2011-12-15 Thread Rafal Jaworowski
Author: raj
Date: Thu Dec 15 12:14:15 2011
New Revision: 228530
URL: http://svn.freebsd.org/changeset/base/228530

Log:
  ARM pmap fixes:
  
  - Write Buffers have to be drained after write to Page Table even if caches
are in write-through mode.
  
  - Make sure to sync PTE in pmap_zero_page_generic().
  
  Submitted by: Michal Mazur
  Reviewed by:  cognet
  Obtained from:Semihalf
  MFC after:1 month

Modified:
  head/sys/arm/arm/pmap.c
  head/sys/arm/include/pmap.h

Modified: head/sys/arm/arm/pmap.c
==
--- head/sys/arm/arm/pmap.c Thu Dec 15 11:21:56 2011(r228529)
+++ head/sys/arm/arm/pmap.c Thu Dec 15 12:14:15 2011(r228530)
@@ -4039,6 +4039,7 @@ pmap_zero_page_generic(vm_paddr_t phys, 
 * order to work without corruption when write-allocate is enabled.
 */
*cdst_pte = L2_S_PROTO | phys | L2_S_PROT(PTE_KERNEL, VM_PROT_WRITE);
+   PTE_SYNC(cdst_pte);
cpu_tlb_flushD_SE(cdstp);
cpu_cpwait();
if (off || size != PAGE_SIZE)

Modified: head/sys/arm/include/pmap.h
==
--- head/sys/arm/include/pmap.h Thu Dec 15 11:21:56 2011(r228529)
+++ head/sys/arm/include/pmap.h Thu Dec 15 12:14:15 2011(r228530)
@@ -382,7 +382,8 @@ do {
\
if (PMAP_NEEDS_PTE_SYNC) {  \
cpu_dcache_wb_range((vm_offset_t)(pte), sizeof(pt_entry_t));\
cpu_l2cache_wb_range((vm_offset_t)(pte), sizeof(pt_entry_t));\
-   }\
+   } else  \
+   cpu_drain_writebuf();   \
 } while (/*CONSTCOND*/0)
 
 #definePTE_SYNC_RANGE(pte, cnt)
\
@@ -392,7 +393,8 @@ do {
\
(cnt)  2); /* * sizeof(pt_entry_t) */ \
cpu_l2cache_wb_range((vm_offset_t)(pte),\
(cnt)  2); /* * sizeof(pt_entry_t) */ \
-   }   \
+   } else  \
+   cpu_drain_writebuf();   \
 } while (/*CONSTCOND*/0)
 
 extern pt_entry_t  pte_l1_s_cache_mode;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228504 - head/sys/arm/arm

2011-12-14 Thread Rafal Jaworowski
Author: raj
Date: Wed Dec 14 17:12:59 2011
New Revision: 228504
URL: http://svn.freebsd.org/changeset/base/228504

Log:
  Make *intr{cnt,names} on ARM reside in data section, similar to other arches.
  
  sintrnames and sintrcnt are initialized with non-zero values, which were
  discarded by the .bss directive, so consumers like vmstat -i were not
  getting correct data.
  
  Submitted by: Lukasz Plachno
  Obtained from:Semihalf
  MFC after:1 month

Modified:
  head/sys/arm/arm/irq_dispatch.S

Modified: head/sys/arm/arm/irq_dispatch.S
==
--- head/sys/arm/arm/irq_dispatch.S Wed Dec 14 16:47:53 2011
(r228503)
+++ head/sys/arm/arm/irq_dispatch.S Wed Dec 14 17:12:59 2011
(r228504)
@@ -98,10 +98,9 @@ ASENTRY_NP(irq_entry)
PULLFRAMEFROMSVCANDEXIT
movspc, lr  /* Exit */
 
-   .bss
+   .data
.align  0
 
-
.global _C_LABEL(intrnames), _C_LABEL(sintrnames)
.global _C_LABEL(intrcnt), _C_LABEL(sintrcnt)
 _C_LABEL(intrnames): 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r227730 - in head/sys: arm/conf arm/mv boot/fdt/dts dev/cesa

2011-11-19 Thread Rafal Jaworowski
Author: raj
Date: Sat Nov 19 16:30:06 2011
New Revision: 227730
URL: http://svn.freebsd.org/changeset/base/227730

Log:
  Initial version of cesa(4) driver for Marvell crypto engine and security
  accelerator.
  
  The following algorithms and schemes are supported:
   - 3DES, AES, DES
   - MD5, SHA1
  
  Obtained from:Semihalf
  Written by:   Piotr Ziecik

Added:
  head/sys/dev/cesa/
  head/sys/dev/cesa/cesa.c   (contents, props changed)
  head/sys/dev/cesa/cesa.h   (contents, props changed)
Modified:
  head/sys/arm/conf/DB-88F6XXX
  head/sys/arm/conf/SHEEVAPLUG
  head/sys/arm/mv/files.mv
  head/sys/boot/fdt/dts/db88f6281.dts
  head/sys/boot/fdt/dts/sheevaplug.dts

Modified: head/sys/arm/conf/DB-88F6XXX
==
--- head/sys/arm/conf/DB-88F6XXXSat Nov 19 15:08:49 2011
(r227729)
+++ head/sys/arm/conf/DB-88F6XXXSat Nov 19 16:30:06 2011
(r227730)
@@ -66,6 +66,10 @@ device   mii
 device e1000phy
 device bpf
 
+device cesa# Marvell security engine
+device crypto
+device cryptodev
+
 # USB
 optionsUSB_DEBUG   # enable debug msgs
 device usb

Modified: head/sys/arm/conf/SHEEVAPLUG
==
--- head/sys/arm/conf/SHEEVAPLUGSat Nov 19 15:08:49 2011
(r227729)
+++ head/sys/arm/conf/SHEEVAPLUGSat Nov 19 16:30:06 2011
(r227730)
@@ -60,6 +60,10 @@ options  HZ=1000
 optionsDEVICE_POLLING
 device vlan
 
+device cesa# Marvell security engine
+device crypto
+device cryptodev
+
 # USB
 optionsUSB_DEBUG   # enable debug msgs
 device usb

Modified: head/sys/arm/mv/files.mv
==
--- head/sys/arm/mv/files.mvSat Nov 19 15:08:49 2011(r227729)
+++ head/sys/arm/mv/files.mvSat Nov 19 16:30:06 2011(r227730)
@@ -28,6 +28,7 @@ arm/mv/mv_sata.c  optionalata | atamvsa
 arm/mv/timer.c standard
 arm/mv/twsi.c  optionaliicbus
 
+dev/cesa/cesa.coptionalcesa
 dev/mge/if_mge.c   optionalmge
 dev/mvs/mvs_soc.c  optionalmvs
 dev/uart/uart_dev_ns8250.c optionaluart

Modified: head/sys/boot/fdt/dts/db88f6281.dts
==
--- head/sys/boot/fdt/dts/db88f6281.dts Sat Nov 19 15:08:49 2011
(r227729)
+++ head/sys/boot/fdt/dts/db88f6281.dts Sat Nov 19 16:30:06 2011
(r227730)
@@ -239,6 +239,8 @@
reg = 0x3 0x1;
interrupts = 22;
interrupt-parent = PIC;
+
+   sram-handle = SRAM;
};
 
usb@5 {

Modified: head/sys/boot/fdt/dts/sheevaplug.dts
==
--- head/sys/boot/fdt/dts/sheevaplug.dtsSat Nov 19 15:08:49 2011
(r227729)
+++ head/sys/boot/fdt/dts/sheevaplug.dtsSat Nov 19 16:30:06 2011
(r227730)
@@ -236,6 +236,8 @@
reg = 0x3 0x1;
interrupts = 22;
interrupt-parent = PIC;
+
+   sram-handle = SRAM;
};
 
usb@5 {

Added: head/sys/dev/cesa/cesa.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/cesa/cesa.cSat Nov 19 16:30:06 2011(r227730)
@@ -0,0 +1,1614 @@
+/*-
+ * Copyright (C) 2009-2011 Semihalf.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 

svn commit: r227613 - head/sys/boot/fdt/dts

2011-11-17 Thread Rafal Jaworowski
Author: raj
Date: Thu Nov 17 12:08:12 2011
New Revision: 227613
URL: http://svn.freebsd.org/changeset/base/227613

Log:
  Add DTS for the Freescale P2020DS.
  
  Obtained from: Freescale

Added:
  head/sys/boot/fdt/dts/p2020ds.dts   (contents, props changed)

Added: head/sys/boot/fdt/dts/p2020ds.dts
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/boot/fdt/dts/p2020ds.dts   Thu Nov 17 12:08:12 2011
(r227613)
@@ -0,0 +1,754 @@
+/*
+ * P2020 DS Device Tree Source
+ *
+ * Copyright 2009 Freescale Semiconductor Inc.
+ *
+ * Neither the name of Freescale Semiconductor, Inc nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Freescale hereby publishes it under the following licenses:
+ *
+ *   BSD License
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ *   GNU General Public License, version 2
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * You may select the license of your choice.
+ *--
+ */
+/* $FreeBSD$ */
+
+/dts-v1/;
+/ {
+   model = fsl,P2020;
+   compatible = fsl,P2020DS;
+   #address-cells = 2;
+   #size-cells = 2;
+
+   aliases {
+   ethernet0 = enet0;
+   ethernet1 = enet1;
+   ethernet2 = enet2;
+   serial0 = serial0;
+   serial1 = serial1;
+   pci0 = pci0;
+   pci1 = pci1;
+   pci2 = pci2;
+   };
+
+   cpus {
+   #address-cells = 1;
+   #size-cells = 0;
+
+   PowerPC,P2020@0 {
+   device_type = cpu;
+   reg = 0x0;
+   next-level-cache = L2;
+   };
+
+   PowerPC,P2020@1 {
+   device_type = cpu;
+   reg = 0x1;
+   next-level-cache = L2;
+   };
+   };
+
+   memory {
+   device_type = memory;
+   };
+
+   localbus@ffe05000 {
+   #address-cells = 2;
+   #size-cells = 1;
+   compatible = fsl,elbc, simple-bus;
+   reg = 0 0xffe05000 0 0x1000;
+   interrupts = 19 2;
+   interrupt-parent = mpic;
+
+   ranges = 0x0 0x0 0x0 0xe800 0x0800
+ 0x1 0x0 0x0 0xe000 0x0800
+ 0x2 0x0 0x0 0xffa0 0x0004
+ 0x3 0x0 0x0 0xffdf 0x8000
+ 0x4 0x0 0x0 0xffa4 0x0004
+ 0x5 0x0 0x0 0xffa8 0x0004
+ 0x6 0x0 0x0 0xffac 0x0004;
+
+ 

Re: svn commit: r216662 - head/share/mk

2010-12-22 Thread Rafal Jaworowski

On 2010-12-22, at 15:59, Nathan Whitehorn wrote:

 Author: nwhitehorn
 Date: Wed Dec 22 14:59:22 2010
 New Revision: 216662
 URL: http://svn.freebsd.org/changeset/base/216662
 
 Log:
  Enable build of FDT components by default. dtc is a required build tool
  for all FDT-enabled kernels, and having it off by default means that
  building these kernels fails by default. This fixes FDT-related build
  failures in make universe on ARM and PowerPC.
 
  Reviewed by: imp

Thanks a lot for taking care of this!

Rafal

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r215119 - in head/sys/powerpc: booke include

2010-11-11 Thread Rafal Jaworowski
Author: raj
Date: Thu Nov 11 13:35:23 2010
New Revision: 215119
URL: http://svn.freebsd.org/changeset/base/215119

Log:
  Use local TLB_UNLOCKED marker instead of MTX_UNOWNED for Book-E PowerPC trap
  routines.
  
  This unbreaks Book-E build after the recent machine/mutex.h removal.
  
  While there move tlb_*lock() prototypes to machine/tlb.h.
  
  Submitted by: jhb

Modified:
  head/sys/powerpc/booke/machdep.c
  head/sys/powerpc/booke/pmap.c
  head/sys/powerpc/booke/trap_subr.S
  head/sys/powerpc/include/tlb.h

Modified: head/sys/powerpc/booke/machdep.c
==
--- head/sys/powerpc/booke/machdep.cThu Nov 11 12:13:41 2010
(r215118)
+++ head/sys/powerpc/booke/machdep.cThu Nov 11 13:35:23 2010
(r215119)
@@ -453,7 +453,7 @@ cpu_pcpu_init(struct pcpu *pcpu, int cpu
 
ptr = tlb0_miss_locks[cpuid * words_per_gran];
pcpu-pc_booke_tlb_lock = ptr;
-   *ptr = MTX_UNOWNED;
+   *ptr = TLB_UNLOCKED;
*(ptr + 1) = 0; /* recurse counter */
 #endif
 }

Modified: head/sys/powerpc/booke/pmap.c
==
--- head/sys/powerpc/booke/pmap.c   Thu Nov 11 12:13:41 2010
(r215118)
+++ head/sys/powerpc/booke/pmap.c   Thu Nov 11 13:35:23 2010
(r215119)
@@ -162,8 +162,6 @@ unsigned int kernel_ptbls;  /* Number of 
 #define PMAP_REMOVE_DONE(pmap) \
((pmap) != kernel_pmap  (pmap)-pm_stats.resident_count == 0)
 
-extern void tlb_lock(uint32_t *);
-extern void tlb_unlock(uint32_t *);
 extern void tid_flush(tlbtid_t);
 
 /**/

Modified: head/sys/powerpc/booke/trap_subr.S
==
--- head/sys/powerpc/booke/trap_subr.S  Thu Nov 11 12:13:41 2010
(r215118)
+++ head/sys/powerpc/booke/trap_subr.S  Thu Nov 11 13:35:23 2010
(r215119)
@@ -330,7 +330,7 @@
lwz %r22, PC_BOOKE_TLB_LOCK(%r20);  \
\
 1: lwarx   %r23, 0, %r22;  \
-   cmpwi   %r23, MTX_UNOWNED;  \
+   cmpwi   %r23, TLB_UNLOCKED; \
beq 2f; \
\
/* check if this is recursion */\
@@ -364,7 +364,7 @@
msync;  \
\
/* release the lock */  \
-   li  %r23, MTX_UNOWNED;  \
+   li  %r23, TLB_UNLOCKED; \
stw %r23, 0(%r22);  \
 1: isync;  \
msync
@@ -860,7 +860,7 @@ ENTRY(tlb_lock)
GET_CPUINFO(%r5)
lwz %r5, PC_CURTHREAD(%r5)
 1: lwarx   %r4, 0, %r3
-   cmpwi   %r4, MTX_UNOWNED
+   cmpwi   %r4, TLB_UNLOCKED
bne 1b
stwcx.  %r5, 0, %r3
bne-1b
@@ -871,11 +871,12 @@ ENTRY(tlb_lock)
 ENTRY(tlb_unlock)
isync
msync
-   li  %r4, MTX_UNOWNED
+   li  %r4, TLB_UNLOCKED
stw %r4, 0(%r3)
isync
msync
blr
+
 /*
  * TLB miss spin locks. For each CPU we have a reservation granule (32 bytes);
  * only a single word from this granule will actually be used as a spin lock

Modified: head/sys/powerpc/include/tlb.h
==
--- head/sys/powerpc/include/tlb.h  Thu Nov 11 12:13:41 2010
(r215118)
+++ head/sys/powerpc/include/tlb.h  Thu Nov 11 13:35:23 2010
(r215119)
@@ -129,6 +129,8 @@
 #define TID_MAX255
 #define TID_NONE   -1
 
+#define TLB_UNLOCKED   0
+
 #if !defined(LOCORE)
 typedef struct tlb_entry {
uint32_t mas1;
@@ -146,6 +148,9 @@ void tlb1_init(vm_offset_t);
 void tlb1_print_entries(void);
 void tlb1_print_tlbentries(void);
 
+void tlb_lock(uint32_t *);
+void tlb_unlock(uint32_t *);
+
 #endif /* !LOCORE */
 
 #endif /* _MACHINE_TLB_H_ */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r215120 - head/sys/dev/ofw

2010-11-11 Thread Rafal Jaworowski
Author: raj
Date: Thu Nov 11 13:42:46 2010
New Revision: 215120
URL: http://svn.freebsd.org/changeset/base/215120

Log:
  Return IEEE 1275 compliant error codes.
  
  Submitted by: nwhitehorn

Modified:
  head/sys/dev/ofw/ofw_fdt.c

Modified: head/sys/dev/ofw/ofw_fdt.c
==
--- head/sys/dev/ofw/ofw_fdt.c  Thu Nov 11 13:35:23 2010(r215119)
+++ head/sys/dev/ofw/ofw_fdt.c  Thu Nov 11 13:42:46 2010(r215120)
@@ -221,7 +221,7 @@ ofw_fdt_instance_to_package(ofw_t ofw, i
 */
offset = fdt_node_offset_by_phandle(fdtp, instance);
if (offset  0)
-   return (0);
+   return (-1);
 
p = (phandle_t)fdt_offset_ptr(fdtp, offset, sizeof(phandle_t));
return (p);
@@ -236,7 +236,7 @@ ofw_fdt_getproplen(ofw_t ofw, phandle_t 
 
offset = fdt_phandle_offset(package);
if (offset  0)
-   return (0);
+   return (-1);
 
if (strcmp(propname, name) == 0) {
/* Emulate the 'name' property */
@@ -244,7 +244,7 @@ ofw_fdt_getproplen(ofw_t ofw, phandle_t 
return (len + 1);
}
 
-   len = 0;
+   len = -1;
prop = fdt_get_property(fdtp, offset, propname, len);
 
return (len);
@@ -261,7 +261,7 @@ ofw_fdt_getprop(ofw_t ofw, phandle_t pac
 
offset = fdt_phandle_offset(package);
if (offset  0)
-   return (0);
+   return (-1);
 
if (strcmp(propname, name) == 0) {
/* Emulate the 'name' property */
@@ -274,7 +274,7 @@ ofw_fdt_getprop(ofw_t ofw, phandle_t pac
 
prop = fdt_getprop(fdtp, offset, propname, len);
if (prop == NULL)
-   return (0);
+   return (-1);
 
if (len  buflen)
len = buflen;
@@ -314,7 +314,7 @@ fdt_nextprop(int offset, char *buf, size
depth = -1;
} while (depth = 0);
 
-   return (0);
+   return (-1);
 }
 
 /*
@@ -330,7 +330,7 @@ ofw_fdt_nextprop(ofw_t ofw, phandle_t pa
 
offset = fdt_phandle_offset(package);
if (offset  0)
-   return (0);
+   return (-1);
 
if (previous == NULL)
/* Find the first prop in the node */
@@ -341,7 +341,7 @@ ofw_fdt_nextprop(ofw_t ofw, phandle_t pa
 */
prop = fdt_get_property(fdtp, offset, previous, NULL);
if (prop == NULL)
-   return (0);
+   return (-1);
 
offset = fdt_phandle_offset((phandle_t)prop);
rv = fdt_nextprop(offset, buf, size);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r215121 - in head/sys/powerpc: aim booke

2010-11-11 Thread Rafal Jaworowski
Author: raj
Date: Thu Nov 11 13:46:28 2010
New Revision: 215121
URL: http://svn.freebsd.org/changeset/base/215121

Log:
  Fix typo in the comment.

Modified:
  head/sys/powerpc/aim/clock.c
  head/sys/powerpc/booke/clock.c

Modified: head/sys/powerpc/aim/clock.c
==
--- head/sys/powerpc/aim/clock.cThu Nov 11 13:42:46 2010
(r215120)
+++ head/sys/powerpc/aim/clock.cThu Nov 11 13:46:28 2010
(r215121)
@@ -105,7 +105,7 @@ static struct timecounter   decr_tc = {
 };
 
 /*
- * Decrementor interrupt handler.
+ * Decrementer interrupt handler.
  */
 void
 decr_intr(struct trapframe *frame)

Modified: head/sys/powerpc/booke/clock.c
==
--- head/sys/powerpc/booke/clock.c  Thu Nov 11 13:42:46 2010
(r215120)
+++ head/sys/powerpc/booke/clock.c  Thu Nov 11 13:46:28 2010
(r215121)
@@ -108,7 +108,7 @@ static struct timecounter   decr_timecount
 };
 
 /*
- * Decrementor interrupt handler.
+ * Decrementer interrupt handler.
  */
 void
 decr_intr(struct trapframe *frame)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r215122 - head/sys/boot/fdt/dts

2010-11-11 Thread Rafal Jaworowski
Author: raj
Date: Thu Nov 11 13:48:48 2010
New Revision: 215122
URL: http://svn.freebsd.org/changeset/base/215122

Log:
  Correct RAM size of the MPC8555CDS board.

Modified:
  head/sys/boot/fdt/dts/mpc8555cds.dts

Modified: head/sys/boot/fdt/dts/mpc8555cds.dts
==
--- head/sys/boot/fdt/dts/mpc8555cds.dtsThu Nov 11 13:46:28 2010
(r215121)
+++ head/sys/boot/fdt/dts/mpc8555cds.dtsThu Nov 11 13:48:48 2010
(r215122)
@@ -97,7 +97,7 @@
 
memory {
device_type = memory;
-   reg = 0x0 0x800;  // 128M at 0x0
+   reg = 0x0 0x1000; // 256M at 0x0
};
 
local...@e0005000 {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r213346 - in head/sys: contrib/octeon-sdk mips/cavium mips/cavium/octe

2010-10-04 Thread Rafal Jaworowski

On 2010-10-02, at 07:43, Juli Mallett wrote:

 Author: jmallett
 Date: Sat Oct  2 05:43:17 2010
 New Revision: 213346
 URL: http://svn.freebsd.org/changeset/base/213346
 
 Log:
  o) Allow devices to override the MDIO read and write functions presented to
 the miibus attached to octe interfaces.
  o) Add an SMI/MDIO interface to the MV88E61XX and use it for the switch PHY 
 on
 the Lanner MR-320.  An actual driver for the switch PHY will come later.
 Note that for now it intercepts and fakes MII_BMSR reads to prevent the
 miibus from talking to anything but the switch itself.

Hi Juli,
Here's some related work we've done for this switch family, although not fully 
featured (the user space config is still missing etc.)  Maybe it can ease your 
efforts somehow: http://people.freebsd.org/~raj/misc/e6000sw.c

Rafal

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r210246 - in head/sys: arm/mv conf dev/fdt

2010-07-19 Thread Rafal Jaworowski
Author: raj
Date: Mon Jul 19 18:41:50 2010
New Revision: 210246
URL: http://svn.freebsd.org/changeset/base/210246

Log:
  Move MRVL FDT fixups and PIC decode routine to a platform specific area.
  
  This allows for better encapsulation (and eliminates generic fdt_arm.c, at
  least for now).

Deleted:
  head/sys/dev/fdt/fdt_arm.c
Modified:
  head/sys/arm/mv/common.c
  head/sys/conf/files.arm

Modified: head/sys/arm/mv/common.c
==
--- head/sys/arm/mv/common.cMon Jul 19 18:20:44 2010(r210245)
+++ head/sys/arm/mv/common.cMon Jul 19 18:41:50 2010(r210246)
@@ -1834,3 +1834,45 @@ fdt_win_setup(void)
 
return (0);
 }
+
+static void
+fdt_fixup_busfreq(phandle_t root)
+{
+   phandle_t sb;
+   pcell_t freq;
+
+   /*
+* This fixup sets the simple-bus bus-frequency property.
+*/
+
+   if ((sb = fdt_find_compatible(root, simple-bus, 1)) == 0)
+   return;
+
+   freq = cpu_to_fdt32(get_tclk());
+   OF_setprop(sb, bus-frequency, (void *)freq, sizeof(freq));
+}
+
+struct fdt_fixup_entry fdt_fixup_table[] = {
+   { mrvl,DB-88F6281, fdt_fixup_busfreq },
+   { NULL, NULL }
+};
+
+static int
+fdt_pic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
+int *pol)
+{
+
+   if (!fdt_is_compatible(node, mrvl,pic))
+   return (ENXIO);
+
+   *interrupt = fdt32_to_cpu(intr[0]);
+   *trig = INTR_TRIGGER_CONFORM;
+   *pol = INTR_POLARITY_CONFORM;
+
+   return (0);
+}
+
+fdt_pic_decode_t fdt_pic_table[] = {
+   fdt_pic_decode_ic,
+   NULL
+};

Modified: head/sys/conf/files.arm
==
--- head/sys/conf/files.arm Mon Jul 19 18:20:44 2010(r210245)
+++ head/sys/conf/files.arm Mon Jul 19 18:41:50 2010(r210246)
@@ -47,7 +47,6 @@ arm/arm/vm_machdep.c  standard
 arm/fpe-arm/armfpe_glue.S  optionalarmfpe
 arm/fpe-arm/armfpe_init.c  optionalarmfpe
 arm/fpe-arm/armfpe.S   optionalarmfpe
-dev/fdt/fdt_arm.c  optionalfdt
 dev/hwpmc/hwpmc_arm.c  optionalhwpmc
 dev/ofw/openfirm.c optionalfdt
 dev/ofw/openfirmio.c   optionalfdt
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r210247 - in head/sys: arm/include arm/mv dev/fdt dev/uart powerpc/booke powerpc/include

2010-07-19 Thread Rafal Jaworowski
Author: raj
Date: Mon Jul 19 18:47:18 2010
New Revision: 210247
URL: http://svn.freebsd.org/changeset/base/210247

Log:
  Eliminate FDT_IMMR_VA define.
  
  This removes platform dependencies from machine/fdt.h for the benfit of
  portability.

Modified:
  head/sys/arm/include/fdt.h
  head/sys/arm/mv/mv_machdep.c
  head/sys/dev/fdt/fdt_common.c
  head/sys/dev/fdt/fdt_common.h
  head/sys/dev/uart/uart_bus_fdt.c
  head/sys/powerpc/booke/machdep.c
  head/sys/powerpc/include/fdt.h

Modified: head/sys/arm/include/fdt.h
==
--- head/sys/arm/include/fdt.h  Mon Jul 19 18:41:50 2010(r210246)
+++ head/sys/arm/include/fdt.h  Mon Jul 19 18:47:18 2010(r210247)
@@ -37,18 +37,10 @@
 #include vm/vm.h
 #include vm/pmap.h
 
+#include machine/bus.h
 #include machine/pmap.h
 #include machine/intr.h
 
-#include arm/mv/mvvar.h
-#include arm/mv/mvwin.h
-
-/*
- * This is the base virtual address the internal mem-mapped registers (IMMR)
- * range is available at.
- */
-#define FDT_IMMR_VAMV_BASE
-
 /* Max interrupt number */
 #define FDT_INTR_MAX   NIRQ
 

Modified: head/sys/arm/mv/mv_machdep.c
==
--- head/sys/arm/mv/mv_machdep.cMon Jul 19 18:41:50 2010
(r210246)
+++ head/sys/arm/mv/mv_machdep.cMon Jul 19 18:47:18 2010
(r210247)
@@ -380,7 +380,7 @@ initarm(void *mdp, void *unused __unused
memsize) != 0)
while(1);
 
-   if (fdt_immr_addr() != 0)
+   if (fdt_immr_addr(MV_BASE) != 0)
while (1);
 
/* Platform-specific initialisation */

Modified: head/sys/dev/fdt/fdt_common.c
==
--- head/sys/dev/fdt/fdt_common.c   Mon Jul 19 18:41:50 2010
(r210246)
+++ head/sys/dev/fdt/fdt_common.c   Mon Jul 19 18:47:18 2010
(r210247)
@@ -63,7 +63,7 @@ vm_offset_t fdt_immr_va;
 vm_offset_t fdt_immr_size;
 
 int
-fdt_immr_addr(void)
+fdt_immr_addr(vm_offset_t immr_va)
 {
pcell_t ranges[6], *rangesptr;
phandle_t node;
@@ -122,7 +122,7 @@ moveon:
size = fdt_data_get((void *)rangesptr, size_cells);
 
fdt_immr_pa = base;
-   fdt_immr_va = FDT_IMMR_VA;
+   fdt_immr_va = immr_va;
fdt_immr_size = size;
 
return (0);

Modified: head/sys/dev/fdt/fdt_common.h
==
--- head/sys/dev/fdt/fdt_common.h   Mon Jul 19 18:41:50 2010
(r210246)
+++ head/sys/dev/fdt/fdt_common.h   Mon Jul 19 18:47:18 2010
(r210247)
@@ -90,7 +90,7 @@ int fdt_data_verify(void *, int);
 phandle_t fdt_find_compatible(phandle_t, const char *, int);
 int fdt_get_mem_regions(struct mem_region *, int *, uint32_t *);
 int fdt_get_phyaddr(phandle_t node, int *);
-int fdt_immr_addr(void);
+int fdt_immr_addr(vm_offset_t);
 int fdt_regsize(phandle_t, u_long *, u_long *);
 int fdt_intr_decode(phandle_t, pcell_t *, int *, int *, int *);
 int fdt_intr_to_rl(phandle_t, struct resource_list *, struct fdt_sense_level 
*);

Modified: head/sys/dev/uart/uart_bus_fdt.c
==
--- head/sys/dev/uart/uart_bus_fdt.cMon Jul 19 18:41:50 2010
(r210246)
+++ head/sys/dev/uart/uart_bus_fdt.cMon Jul 19 18:47:18 2010
(r210247)
@@ -188,7 +188,7 @@ uart_cpu_getdev(int devtype, struct uart
err = fdt_regsize(node, start, size);
if (err)
return (ENXIO);
-   start += FDT_IMMR_VA;
+   start += fdt_immr_va;
 
uart_bus_space_mem = fdtbus_bs_tag;
uart_bus_space_io = NULL;

Modified: head/sys/powerpc/booke/machdep.c
==
--- head/sys/powerpc/booke/machdep.cMon Jul 19 18:41:50 2010
(r210246)
+++ head/sys/powerpc/booke/machdep.cMon Jul 19 18:47:18 2010
(r210247)
@@ -319,7 +319,7 @@ e500_init(u_int32_t startkernel, u_int32
if (OF_init((void *)dtbp) != 0)
while (1);
 
-   if (fdt_immr_addr() != 0)
+   if (fdt_immr_addr(CCSRBAR_VA) != 0)
while (1);
 
OF_interpret(perform-fixup, 0);

Modified: head/sys/powerpc/include/fdt.h
==
--- head/sys/powerpc/include/fdt.h  Mon Jul 19 18:41:50 2010
(r210246)
+++ head/sys/powerpc/include/fdt.h  Mon Jul 19 18:47:18 2010
(r210247)
@@ -34,14 +34,6 @@
 
 #include machine/bus.h
 #include machine/intr_machdep.h
-#include machine/platform.h
-#include machine/vmparam.h
-
-/*
- * This is the base virtual address the internal mem-mapped registers (IMMR)
- * range is available at.
- */
-#define FDT_IMMR_VACCSRBAR_VA
 
 /* Max interrupt number */
 #define FDT_INTR_MAX   INTR_VECTORS

svn commit: r210249 - in head/sys: arm/mv arm/mv/discovery arm/mv/kirkwood arm/mv/orion conf

2010-07-19 Thread Rafal Jaworowski
Author: raj
Date: Mon Jul 19 19:19:33 2010
New Revision: 210249
URL: http://svn.freebsd.org/changeset/base/210249

Log:
  Now that we are fully FDT-driven on MRVL platforms, remove PHYSMEM_SIZE 
option.

Modified:
  head/sys/arm/mv/discovery/std.db78xxx
  head/sys/arm/mv/kirkwood/std.db88f6xxx
  head/sys/arm/mv/kirkwood/std.sheevaplug
  head/sys/arm/mv/mv_machdep.c
  head/sys/arm/mv/orion/std.db88f5xxx
  head/sys/conf/options.arm

Modified: head/sys/arm/mv/discovery/std.db78xxx
==
--- head/sys/arm/mv/discovery/std.db78xxx   Mon Jul 19 18:56:18 2010
(r210248)
+++ head/sys/arm/mv/discovery/std.db78xxx   Mon Jul 19 19:19:33 2010
(r210249)
@@ -9,5 +9,4 @@ makeoptions KERNVIRTADDR=0xc090
 optionsKERNPHYSADDR=0x0090
 optionsKERNVIRTADDR=0xc090
 optionsPHYSADDR=0x
-optionsPHYSMEM_SIZE=0x2000
 optionsSTARTUP_PAGETABLE_ADDR=0x0010

Modified: head/sys/arm/mv/kirkwood/std.db88f6xxx
==
--- head/sys/arm/mv/kirkwood/std.db88f6xxx  Mon Jul 19 18:56:18 2010
(r210248)
+++ head/sys/arm/mv/kirkwood/std.db88f6xxx  Mon Jul 19 19:19:33 2010
(r210249)
@@ -3,5 +3,3 @@
 include../mv/std.mv
 include ../mv/kirkwood/std.kirkwood
 files  ../mv/kirkwood/files.kirkwood
-
-optionsPHYSMEM_SIZE=0x2000

Modified: head/sys/arm/mv/kirkwood/std.sheevaplug
==
--- head/sys/arm/mv/kirkwood/std.sheevaplug Mon Jul 19 18:56:18 2010
(r210248)
+++ head/sys/arm/mv/kirkwood/std.sheevaplug Mon Jul 19 19:19:33 2010
(r210249)
@@ -3,5 +3,3 @@
 include../mv/std.mv
 include ../mv/kirkwood/std.kirkwood
 files  ../mv/kirkwood/files.sheevaplug
-
-optionsPHYSMEM_SIZE=0x2000

Modified: head/sys/arm/mv/mv_machdep.c
==
--- head/sys/arm/mv/mv_machdep.cMon Jul 19 18:56:18 2010
(r210248)
+++ head/sys/arm/mv/mv_machdep.cMon Jul 19 19:19:33 2010
(r210249)
@@ -153,7 +153,7 @@ static int availmem_regions_sz;
 static void print_kenv(void);
 static void print_kernel_section_addr(void);
 
-static void physmap_init(int);
+static void physmap_init(void);
 static int platform_devmap_init(void);
 static int platform_mpp_init(void);
 
@@ -202,7 +202,7 @@ print_kernel_section_addr(void)
 }
 
 static void
-physmap_init(int hardcoded)
+physmap_init(void)
 {
int i, j, cnt;
vm_offset_t phys_kernelend, kernload;
@@ -213,22 +213,6 @@ physmap_init(int hardcoded)
kernload = KERNPHYSADDR;
 
/*
-* Use hardcoded physical addresses if we don't use memory regions
-* from metadata.
-*/
-   if (hardcoded) {
-   phys_avail[0] = 0;
-   phys_avail[1] = kernload;
-
-   phys_avail[2] = phys_kernelend;
-   phys_avail[3] = PHYSMEM_SIZE;
-
-   phys_avail[4] = 0;
-   phys_avail[5] = 0;
-   return;
-   }
-
-   /*
 * Remove kernel physical address range from avail
 * regions list. Page align all regions.
 * Non-page aligned memory isn't very interesting to us.
@@ -352,12 +336,6 @@ initarm(void *mdp, void *unused __unused
} else {
/* Fall back to hardcoded metadata. */
lastaddr = fake_preload_metadata();
-
-   /*
-* Assume a single memory region of size specified in board
-* configuration file.
-*/
-   memsize = PHYSMEM_SIZE;
}
 
 #if defined(FDT_DTB_STATIC)
@@ -602,10 +580,8 @@ initarm(void *mdp, void *unused __unused
 
/*
 * Prepare map of physical memory regions available to vm subsystem.
-* If metadata pointer doesn't point to a valid address, use hardcoded
-* values.
 */
-   physmap_init((mdp != NULL) ? 0 : 1);
+   physmap_init();
 
/* Do basic tuning, hz etc */
init_param1();

Modified: head/sys/arm/mv/orion/std.db88f5xxx
==
--- head/sys/arm/mv/orion/std.db88f5xxx Mon Jul 19 18:56:18 2010
(r210248)
+++ head/sys/arm/mv/orion/std.db88f5xxx Mon Jul 19 19:19:33 2010
(r210249)
@@ -9,5 +9,4 @@ makeoptions KERNVIRTADDR=0xc090
 optionsKERNPHYSADDR=0x0090
 optionsKERNVIRTADDR=0xc090
 optionsPHYSADDR=0x
-optionsPHYSMEM_SIZE=0x0800
 optionsSTARTUP_PAGETABLE_ADDR=0x0010

Modified: head/sys/conf/options.arm
==
--- 

svn commit: r210112 - head

2010-07-15 Thread Rafal Jaworowski
Author: raj
Date: Thu Jul 15 10:49:07 2010
New Revision: 210112
URL: http://svn.freebsd.org/changeset/base/210112

Log:
  Fix FDT_DTS_FILE parsing to properly retrieve its value. This unbreaks the
  'builddtb' target.
  
  Make the processing more robust against non-existent kernel config files
  (pointed out by imp@).

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Jul 15 10:37:49 2010(r210111)
+++ head/Makefile.inc1  Thu Jul 15 10:49:07 2010(r210112)
@@ -1477,8 +1477,12 @@ _xi-links:
 DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
 
 .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
-FDT_DTS_FILE!= awk '/^makeoptions[[:space:]]+FDT_DTS_FILE/ {FS==|[ \t]+; 
print $$3}' \
+.if exists(${KERNCONFDIR}/${KERNCONF})
+FDT_DTS_FILE!= awk 'BEGIN {FS==} /^makeoptions[[:space:]]+FDT_DTS_FILE/ 
{print $$2}' \
${KERNCONFDIR}/${KERNCONF}
+.else
+.error ERROR: kernel config file not found.
+.endif
 .endif
 
 .endif
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r210116 - head

2010-07-15 Thread Rafal Jaworowski
Author: raj
Date: Thu Jul 15 13:21:25 2010
New Revision: 210116
URL: http://svn.freebsd.org/changeset/base/210116

Log:
  Relax FDT_DTS_FILE validation (and unbreak world build).
  
  Pointed out by:   kib

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Jul 15 12:17:17 2010(r210115)
+++ head/Makefile.inc1  Thu Jul 15 13:21:25 2010(r210116)
@@ -1480,8 +1480,6 @@ DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}
 .if exists(${KERNCONFDIR}/${KERNCONF})
 FDT_DTS_FILE!= awk 'BEGIN {FS==} /^makeoptions[[:space:]]+FDT_DTS_FILE/ 
{print $$2}' \
${KERNCONFDIR}/${KERNCONF}
-.else
-.error ERROR: kernel config file not found.
 .endif
 .endif
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r210053 - head/share/man/man4

2010-07-14 Thread Rafal Jaworowski
 in the kernel to retrieve information about
+hardware resources from a unified origin, which brings advantages to the
+embedded applications (eliminates hard-coded configuration approach, enforces
+code to be data driven and extensible) leading to easier porting and
+maintenance.
+.Sh DEFINITIONS
+.Bl -tag -width Ar
+.It Va Device tree source (DTS)
+The device tree source is a text file which describes hardware resources of a
+computer system in a human-readable form, with certain hierarchical structure
+(a tree). The default location for DTS files
+in the
+.Fx
+source repository is
+.Pa sys/boot/fdt/dts
+directory.
+.It Va Device tree blob (DTB)
+The textual device tree description (DTS file) is first converted (compiled)
+into a binary object (the device tree blob) i.e. the DTB, which is handed over
+to the final consumer (typically kernel) for parsing and processing of its
+contents.
+.It Va Device tree compiler (DTC)
+A utility program executed on the host, which transforms (compiles) a textual
+description of a device tree (DTS) into a binary object (DTB).
+.It Va Device tree bindings
+While the device tree textual description and the binary object are media to
+convey the hardware configuration information, an actual meaning and
+interpretation of the contents are defined by the device tree
+.Pa bindings .
+They are certain conventions describing definitions (encoding) of particular
+nodes in a device tree and their properties, allowed values, ranges and so on.
+Such reference conventions were provided by the legacy Open Firmware bindings,
+further supplemented by the ePAPR specification.
+.El
+.Sh BUILDING THE WORLD
+In order for the system to support
+.Nm
+it is required that
+.Fx
+world be built with the
+.Pa WITH_FDT
+build knob supplied either via
+.Xr src.conf 5
+or command line defined with -D.
+.Pp
+This creates the user space
+.Pa dtc
+compiler and enables
+.Nm
+support in
+.Xr loader 8 .
+.Sh BUILDING KERNEL
+There is a couple of options for managing
+.Nm
+support at the
+.Fx
+kernel level.
+.Bl -tag -width Ar
+.It Va options FDT
+The primary option for enabling
+.Nm
+support in the kernel. It covers all low-level and infrastructure parts of
+.Nm
+kernel support, which primarily are the
+.Xr fdtbus 4 and
+.Xr simplebus 4 drivers, as well as helper routines and libraries.
+.It Va makeoptions FDT_DTS_FILE=board name.dts
+Specifies a preferred (default) device tree source (DTS) file for a given
+kernel. The indicated DTS file will be converted (compiled) into a binary form
+along with building the kernel itself. The DTS file name is relative
+to the default location of DTS sources i.e.
+.Pa sys/boot/fdt/dts .
+This makeoption is not mandatory unless FDT_DTB_STATIC is also defined (see
+below).
+.It Va options FDT_DTB_STATIC
+Typically, the device tree blob (DTB) is a stand-alone file, physically
+separate from the kernel, but this option lets statically embed a
+DTB file into a kernel image. Note that when this is specified the
+FDT_DTS_FILE makeoption becomes mandatory (as there needs to be a DTS file
+specified in order to embed it into the kernel image).
+.El
+.Sh SEE ALSO
+.Xr fdtbus 4 ,
+.Xr openfirm 4 ,
+.Xr simplebus 4 ,
+.Sh STANDARDS
+IEEE Std 1275: IEEE Standard for Boot (Initialization Configuration) Firmware:
+Core Requirements and Practices
+.Pq Vt Open Firmware .
+.Pp
+Power.org Standard for Embedded Power Architecture Platform Requirements
+.Pq Vt ePAPR .
+.Sh HISTORY
+The
+.Nm
+support first appeared in
+.Fx 9.0 .
+.Sh AUTHORS
+The
+.Nm
+support was developed by Semihalf under sponsorship from the FreeBSD
+Foundation. This manual page was written by
+.An Rafal Jaworowski .

Added: head/share/man/man4/fdtbus.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/fdtbus.4Wed Jul 14 13:03:00 2010
(r210053)
@@ -0,0 +1,87 @@
+.\
+.\ Copyright (c) 2010 The FreeBSD Foundation
+.\ All rights reserved.
+.\
+.\ This software was developed by Semihalf under sponsorship from
+.\ the FreeBSD Foundation.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL

svn commit: r209903 - head/sys/boot/fdt/dts

2010-07-11 Thread Rafal Jaworowski
Author: raj
Date: Sun Jul 11 20:29:34 2010
New Revision: 209903
URL: http://svn.freebsd.org/changeset/base/209903

Log:
  Provide a missing interrupt-parent for the CPM / QUICC node in the DTS.

Modified:
  head/sys/boot/fdt/dts/mpc8555cds.dts

Modified: head/sys/boot/fdt/dts/mpc8555cds.dts
==
--- head/sys/boot/fdt/dts/mpc8555cds.dtsSun Jul 11 20:11:44 2010
(r209902)
+++ head/sys/boot/fdt/dts/mpc8555cds.dtsSun Jul 11 20:29:34 2010
(r209903)
@@ -343,6 +343,7 @@
compatible = fsl,mpc8555-cpm, fsl,cpm2;
reg = 0x8 0x2;
interrupts = 46 2;
+   interrupt-parent = mpic;
};
};
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r209904 - head/sys/dev/fdt

2010-07-11 Thread Rafal Jaworowski
Author: raj
Date: Sun Jul 11 20:30:59 2010
New Revision: 209904
URL: http://svn.freebsd.org/changeset/base/209904

Log:
  Let simplebus(4) diagnostics be a bit more descriptive.

Modified:
  head/sys/dev/fdt/simplebus.c

Modified: head/sys/dev/fdt/simplebus.c
==
--- head/sys/dev/fdt/simplebus.cSun Jul 11 20:29:34 2010
(r209903)
+++ head/sys/dev/fdt/simplebus.cSun Jul 11 20:30:59 2010
(r209904)
@@ -187,16 +187,16 @@ simplebus_attach(device_t dev)
resource_list_init(di-di_res);
 
if (fdt_reg_to_rl(dt_child, di-di_res, sc-sc_start_va)) {
-   device_printf(dev, could not process 'reg' 
-   property\n);
+   device_printf(dev, %s: could not process 'reg' 
+   property\n, di-di_ofw.obd_name);
ofw_bus_gen_destroy_devinfo(di-di_ofw);
free(di, M_SIMPLEBUS);
continue;
}
 
if (fdt_intr_to_rl(dt_child, di-di_res, di-di_intr_sl)) {
-   device_printf(dev, could not process 'interrupts' 
-   property\n);
+   device_printf(dev, %s: could not process 
+   'interrupts' property\n, di-di_ofw.obd_name);
resource_list_free(di-di_res);
ofw_bus_gen_destroy_devinfo(di-di_ofw);
free(di, M_SIMPLEBUS);
@@ -213,6 +213,9 @@ simplebus_attach(device_t dev)
free(di, M_SIMPLEBUS);
continue;
}
+#ifdef DEBUG
+   device_printf(dev, added child: %s\n\n, di-di_ofw.obd_name);
+#endif
device_set_ivars(dev_child, di);
}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r209905 - head/sys/dev/fdt

2010-07-11 Thread Rafal Jaworowski
Author: raj
Date: Sun Jul 11 20:33:39 2010
New Revision: 209905
URL: http://svn.freebsd.org/changeset/base/209905

Log:
  Save fdtbus trigger / polarity data at their correct index.

Modified:
  head/sys/dev/fdt/fdt_common.c

Modified: head/sys/dev/fdt/fdt_common.c
==
--- head/sys/dev/fdt/fdt_common.c   Sun Jul 11 20:30:59 2010
(r209904)
+++ head/sys/dev/fdt/fdt_common.c   Sun Jul 11 20:33:39 2010
(r209905)
@@ -529,8 +529,8 @@ fdt_intr_to_rl(phandle_t node, struct re
debugf(decoded intr = %d, trig = %d, pol = %d\n, interrupt,
trig, pol);
 
-   intr_sl[intr_num].trig = trig;
-   intr_sl[intr_num].pol = pol;
+   intr_sl[i].trig = trig;
+   intr_sl[i].pol = pol;
 
resource_list_add(rl, SYS_RES_IRQ, i, interrupt, interrupt, 1);
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r209906 - head/sys/dev/fdt

2010-07-11 Thread Rafal Jaworowski
Author: raj
Date: Sun Jul 11 20:49:36 2010
New Revision: 209906
URL: http://svn.freebsd.org/changeset/base/209906

Log:
  Introduce PowerPC-specific helper routines for FDT.
  
  Reviewed by:  imp
  Sponsored by: The FreeBSD Foundation

Added:
  head/sys/dev/fdt/fdt_powerpc.c   (contents, props changed)

Added: head/sys/dev/fdt/fdt_powerpc.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/fdt/fdt_powerpc.c  Sun Jul 11 20:49:36 2010
(r209906)
@@ -0,0 +1,168 @@
+/*-
+ * Copyright (c) 2009-2010 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Semihalf under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/kernel.h
+#include sys/module.h
+#include sys/bus.h
+
+#include machine/intr_machdep.h
+
+#include dev/ofw/ofw_bus.h
+#include dev/ofw/ofw_bus_subr.h
+#include dev/ofw/openfirm.h
+
+#include ofw_bus_if.h
+#include fdt_common.h
+
+static void
+fdt_fixup_busfreq(phandle_t root)
+{
+   phandle_t sb, cpus, child;
+   pcell_t freq;
+
+   /*
+* Do a strict check so as to skip non-SOC nodes, which also claim
+* simple-bus compatibility such as eLBC etc.
+*/
+   if ((sb = fdt_find_compatible(root, simple-bus, 1)) == 0)
+   return;
+
+   /*
+* This fixup uses /cpus/ bus-frequency prop value to set simple-bus
+* bus-frequency property.
+*/
+   if ((cpus = OF_finddevice(/cpus)) == 0)
+   return;
+
+   if ((child = OF_child(cpus)) == 0)
+   return;
+
+   if (OF_getprop(child, bus-frequency, (void *)freq,
+   sizeof(freq)) = 0)
+   return;
+
+   OF_setprop(sb, bus-frequency, (void *)freq, sizeof(freq));
+}
+
+struct fdt_fixup_entry fdt_fixup_table[] = {
+   { fsl,MPC8572DS, fdt_fixup_busfreq },
+   { MPC8555CDS, fdt_fixup_busfreq },
+   { NULL, NULL }
+};
+
+static int
+fdt_pic_decode_iic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
+int *pol)
+{
+   if (!fdt_is_compatible(node, chrp,iic))
+   return (ENXIO);
+
+   *interrupt = intr[0];
+
+   switch (intr[1]) {
+   case 0:
+   /* Active L level */
+   *trig = INTR_TRIGGER_LEVEL;
+   *pol = INTR_POLARITY_LOW;
+   break;
+   case 1:
+   /* Active H level */
+   *trig = INTR_TRIGGER_LEVEL;
+   *pol = INTR_POLARITY_HIGH;
+   break;
+   case 2:
+   /* H to L edge */
+   *trig = INTR_TRIGGER_EDGE;
+   *pol = INTR_POLARITY_LOW;
+   break;
+   case 3:
+   /* L to H edge */
+   *trig = INTR_TRIGGER_EDGE;
+   *pol = INTR_POLARITY_HIGH;
+   break;
+   default:
+   *trig = INTR_TRIGGER_CONFORM;
+   *pol = INTR_POLARITY_CONFORM;
+   }
+   return (0);
+}
+
+static int
+fdt_pic_decode_openpic(phandle_t node, pcell_t *intr, int *interrupt,
+int *trig, int *pol)
+{
+
+   if (!fdt_is_compatible(node, chrp,open-pic))
+   return (ENXIO);
+
+   /*
+* XXX The interrupt number read out from the MPC85XX device tree is
+* already offset by 16 to reflect the 'internal' IRQ range shift on
+* the OpenPIC.
+*/
+   *interrupt = intr[0];
+
+   switch (intr[1]) {
+   case 0:
+   /* L to H edge */
+   *trig = INTR_TRIGGER_EDGE;
+ 

svn commit: r209907 - head/sys/dev/pci

2010-07-11 Thread Rafal Jaworowski
Author: raj
Date: Sun Jul 11 20:55:39 2010
New Revision: 209907
URL: http://svn.freebsd.org/changeset/base/209907

Log:
  Provide more defines for PCI-Express device ctrl.

Modified:
  head/sys/dev/pci/pcireg.h

Modified: head/sys/dev/pci/pcireg.h
==
--- head/sys/dev/pci/pcireg.h   Sun Jul 11 20:49:36 2010(r209906)
+++ head/sys/dev/pci/pcireg.h   Sun Jul 11 20:55:39 2010(r209907)
@@ -605,6 +605,9 @@
 #definePCIR_EXPRESS_DEVICE_CAP 0x4
 #definePCIM_EXP_CAP_MAX_PAYLOAD0x0007
 #definePCIR_EXPRESS_DEVICE_CTL 0x8
+#definePCIM_EXP_CTL_NFER_ENABLE0x0002
+#definePCIM_EXP_CTL_FER_ENABLE 0x0004
+#definePCIM_EXP_CTL_URR_ENABLE 0x0008
 #definePCIM_EXP_CTL_RELAXED_ORD_ENABLE 0x0010
 #definePCIM_EXP_CTL_MAX_PAYLOAD0x00e0
 #definePCIM_EXP_CTL_NOSNOOP_ENABLE 0x0800
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r209908 - in head/sys: conf dev/cfi dev/fdt dev/quicc dev/sec dev/tsec dev/uart powerpc/booke powerpc/conf powerpc/include powerpc/mpc85xx powerpc/powerpc

2010-07-11 Thread Rafal Jaworowski
==
--- head/sys/dev/sec/sec.c  Sun Jul 11 20:55:39 2010(r209907)
+++ head/sys/dev/sec/sec.c  Sun Jul 11 21:08:29 2010(r209908)
@@ -45,12 +45,12 @@ __FBSDID($FreeBSD$);
 #include sys/rman.h
 
 #include machine/bus.h
-#include machine/ocpbus.h
 #include machine/resource.h
 
 #include opencrypto/cryptodev.h
 #include cryptodev_if.h
 
+#include dev/ofw/ofw_bus_subr.h
 #include dev/sec/sec.h
 
 static int sec_probe(device_t dev);
@@ -153,7 +153,7 @@ static driver_t sec_driver = {
 };
 
 static devclass_t sec_devclass;
-DRIVER_MODULE(sec, ocpbus, sec_driver, sec_devclass, 0, 0);
+DRIVER_MODULE(sec, simplebus, sec_driver, sec_devclass, 0, 0);
 MODULE_DEPEND(sec, crypto, 1, 1, 1);
 
 static struct sec_eu_methods sec_eus[] = {
@@ -201,24 +201,16 @@ static int
 sec_probe(device_t dev)
 {
struct sec_softc *sc;
-   device_t parent;
-   uintptr_t devtype;
uint64_t id;
-   int error;
 
-   parent = device_get_parent(dev);
-   error = BUS_READ_IVAR(parent, dev, OCPBUS_IVAR_DEVTYPE, devtype);
-   if (error)
-   return (error);
-
-   if (devtype != OCPBUS_DEVTYPE_SEC)
+   if (!ofw_bus_is_compatible(dev, fsl,sec2.0))
return (ENXIO);
 
sc = device_get_softc(dev);
 
sc-sc_rrid = 0;
-   sc-sc_rres = bus_alloc_resource(dev, SYS_RES_MEMORY, sc-sc_rrid,
-   0ul, ~0ul, SEC_IO_SIZE, RF_ACTIVE);
+   sc-sc_rres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, sc-sc_rrid,
+   RF_ACTIVE);
 
if (sc-sc_rres == NULL)
return (ENXIO);
@@ -276,8 +268,8 @@ sec_attach(device_t dev)
 
/* Allocate I/O memory for SEC registers */
sc-sc_rrid = 0;
-   sc-sc_rres = bus_alloc_resource(dev, SYS_RES_MEMORY, sc-sc_rrid,
-   0ul, ~0ul, SEC_IO_SIZE, RF_ACTIVE);
+   sc-sc_rres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, sc-sc_rrid,
+   RF_ACTIVE);
 
if (sc-sc_rres == NULL) {
device_printf(dev, could not allocate I/O memory!\n);
@@ -295,12 +287,15 @@ sec_attach(device_t dev)
if (error)
goto fail2;
 
-   sc-sc_sec_irid = 1;
-   error = sec_setup_intr(sc, sc-sc_sec_ires, sc-sc_sec_ihand,
-   sc-sc_sec_irid, sec_secondary_intr, secondary);
 
-   if (error)
-   goto fail3;
+   if (sc-sc_version == 3) {
+   sc-sc_sec_irid = 1;
+   error = sec_setup_intr(sc, sc-sc_sec_ires, sc-sc_sec_ihand,
+   sc-sc_sec_irid, sec_secondary_intr, secondary);
+
+   if (error)
+   goto fail3;
+   }
 
/* Alloc DMA memory for descriptors and link tables */
error = sec_alloc_dma_mem(sc, (sc-sc_desc_dmem),

Modified: head/sys/dev/tsec/if_tsec.c
==
--- head/sys/dev/tsec/if_tsec.c Sun Jul 11 20:55:39 2010(r209907)
+++ head/sys/dev/tsec/if_tsec.c Sun Jul 11 21:08:29 2010(r209908)
@@ -1,6 +1,6 @@
 /*-
- * Copyright (C) 2007-2008 Semihalf, Rafal Jaworowski r...@semihalf.com
- * Copyright (C) 2006-2007 Semihalf, Piotr Kruszynski p...@semihalf.com
+ * Copyright (C) 2007-2008 Semihalf, Rafal Jaworowski
+ * Copyright (C) 2006-2007 Semihalf, Piotr Kruszynski
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -1563,7 +1563,7 @@ tsec_miibus_readreg(device_t dev, int ph
 
sc = device_get_softc(dev);
 
-   if (device_get_unit(dev) != phy)
+   if (sc-phyaddr != phy)
return (0);
 
sc = tsec0_sc;
@@ -1591,9 +1591,8 @@ tsec_miibus_writereg(device_t dev, int p
 
sc = device_get_softc(dev);
 
-   if (device_get_unit(dev) != phy)
-   device_printf(dev, Trying to write to an alien PHY(%d)\n,
-   phy);
+   if (sc-phyaddr != phy)
+   return (0);
 
sc = tsec0_sc;
 

Modified: head/sys/dev/tsec/if_tsec.h
==
--- head/sys/dev/tsec/if_tsec.h Sun Jul 11 20:55:39 2010(r209907)
+++ head/sys/dev/tsec/if_tsec.h Sun Jul 11 21:08:29 2010(r209908)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (C) 2006-2007 Semihalf, Piotr Kruszynski p...@semihalf.com
+ * Copyright (C) 2006-2007 Semihalf, Piotr Kruszynski
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -28,6 +28,8 @@
 #ifndef _IF_TSEC_H
 #define _IF_TSEC_H
 
+#include dev/ofw/openfirm.h
+
 #define TSEC_RX_NUM_DESC   256
 #define TSEC_TX_NUM_DESC   256
 
@@ -49,6 +51,7 @@ struct tsec_softc {
struct mtx  transmit_lock;  /* transmitter lock */
struct mtx  receive_lock;   /* receiver lock */
 
+   phandle_t   node;
device_tdev;
device_ttsec_miibus;
struct mii_data *tsec_mii;  /* MII media control */
@@ -128,6 +131,8 @@ struct tsec_softc

svn commit: r209909 - in head/sys: arm/include boot/uboot/common

2010-07-11 Thread Rafal Jaworowski
Author: raj
Date: Sun Jul 11 21:11:23 2010
New Revision: 209909
URL: http://svn.freebsd.org/changeset/base/209909

Log:
  Get rid of bootinfo for good in loader (U-Boot-based) and ARM.
  
  For FDT-enabled platforms the device tree is a modern replacement for bootinfo
  config data.

Deleted:
  head/sys/arm/include/bootinfo.h
Modified:
  head/sys/arm/include/metadata.h
  head/sys/boot/uboot/common/metadata.c

Modified: head/sys/arm/include/metadata.h
==
--- head/sys/arm/include/metadata.h Sun Jul 11 21:08:29 2010
(r209908)
+++ head/sys/arm/include/metadata.h Sun Jul 11 21:11:23 2010
(r209909)
@@ -31,10 +31,4 @@
 
 #defineMODINFOMD_DTBP  0x1001
 
-/*
- * XXX this is for tinderbox compilation sake only and will go away once the
- * FDT transition is complete.
- */
-#define MODINFOMD_BOOTINFO 0x2000
-
 #endif /* !_MACHINE_METADATA_H_ */

Modified: head/sys/boot/uboot/common/metadata.c
==
--- head/sys/boot/uboot/common/metadata.c   Sun Jul 11 21:08:29 2010
(r209908)
+++ head/sys/boot/uboot/common/metadata.c   Sun Jul 11 21:11:23 2010
(r209909)
@@ -36,9 +36,6 @@ __FBSDID($FreeBSD$);
 
 #include machine/elf.h
 #include machine/metadata.h
-#if !defined(LOADER_FDT_SUPPORT)
-#include machine/bootinfo.h
-#endif
 
 #include api_public.h
 #include bootstrap.h
@@ -259,114 +256,6 @@ md_copymodules(vm_offset_t addr)
return(addr);
 }
 
-#if !defined(LOADER_FDT_SUPPORT)
-/*
- * Prepare the bootinfo structure. Put a ptr to the allocated struct in addr,
- * return size.
- */
-static int
-md_bootinfo(struct bootinfo **addr)
-{
-#defineTMP_MAX_ETH 8
-#defineTMP_MAX_MR  8
-   struct bootinfo *bi;
-   struct bi_mem_regiontmp_mr[TMP_MAX_MR];
-   struct bi_eth_addr  tmp_eth[TMP_MAX_ETH];
-   struct sys_info *si;
-   char*str, *end;
-   const char  *env;
-   void*ptr;
-   u_int8_ttmp_addr[6];
-   int i, n, mr_no, eth_no, size;
-
-   if ((si = ub_get_sys_info()) == NULL)
-   panic(can't retrieve U-Boot sysinfo);
-
-   /*
-* Handle mem regions (we only care about DRAM)
-*/
-   for (i = 0, mr_no = 0; i  si-mr_no; i++) {
-   if (si-mr[i].flags == MR_ATTR_DRAM) {
-   if (mr_no = TMP_MAX_MR) {
-   printf(too many memory regions: %d\n, mr_no);
-   break;
-   }
-   tmp_mr[mr_no].mem_base = si-mr[i].start;
-   tmp_mr[mr_no].mem_size = si-mr[i].size;
-   mr_no++;
-   continue;
-   }
-   }
-   if (mr_no == 0)
-   panic(can't retrieve RAM info);
-
-   size = (mr_no * sizeof(struct bi_mem_region) - sizeof(bi-bi_data));
-
-   /*
-* Handle Ethernet addresses: parse u-boot env for eth%daddr
-*/
-   env = NULL;
-   eth_no = 0;
-   while ((env = ub_env_enum(env)) != NULL) {
-   if (strncmp(env, eth, 3) == 0 
-   strncmp(env + (strlen(env) - 4), addr, 4) == 0) {
-
-   /* Extract interface number */
-   i = strtol(env + 3, end, 10);
-   if (end == (env + 3))
-   /* 'ethaddr' means interface 0 address */
-   n = 0;
-   else
-   n = i;
-
-   if (n = TMP_MAX_MR) {
-   printf(Ethernet interface number too high: %d. 

-   Skipping...\n);
-   continue;
-   }
-
-   str = ub_env_get(env);
-   for (i = 0; i  6; i++) {
-   tmp_addr[i] = str ? strtol(str, end, 16) : 0;
-   if (str)
-   str = (*end) ? end + 1 : end;
-
-   tmp_eth[n].mac_addr[i] = tmp_addr[i];
-   }
-
-   /* eth_no is 1-based number of all interfaces defined */
-   if (n + 1  eth_no)
-   eth_no = n + 1;
-   }
-   }
-
-   size += (eth_no * sizeof(struct bi_eth_addr)) + sizeof(struct bootinfo);
-
-   /*
-* Once its whole size is calculated, allocate space for the bootinfo
-* and copy over the contents from temp containers.
-*/
-   if ((bi = malloc(size)) == NULL)
-   panic(can't allocate mem for bootinfo);
-
-   ptr = (struct bi_mem_region *)bi-bi_data;
-   bcopy(tmp_mr, ptr, mr_no * 

svn commit: r209910 - head/sys/conf

2010-07-11 Thread Rafal Jaworowski
Author: raj
Date: Sun Jul 11 21:12:42 2010
New Revision: 209910
URL: http://svn.freebsd.org/changeset/base/209910

Log:
  Sort platform options.

Modified:
  head/sys/conf/options.powerpc

Modified: head/sys/conf/options.powerpc
==
--- head/sys/conf/options.powerpc   Sun Jul 11 21:11:23 2010
(r209909)
+++ head/sys/conf/options.powerpc   Sun Jul 11 21:12:42 2010
(r209910)
@@ -10,8 +10,8 @@ GFB_DEBUG opt_gfb.h
 GFB_NO_FONT_LOADINGopt_gfb.h
 GFB_NO_MODE_CHANGE opt_gfb.h
 
-POWERMAC   opt_platform.h
 MPC85XXopt_platform.h
+POWERMAC   opt_platform.h
 PSIM
 
 SC_OFWFB   opt_ofwfb.h
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r209232 - head/sys/arm/arm

2010-06-16 Thread Rafal Jaworowski
Author: raj
Date: Wed Jun 16 14:10:39 2010
New Revision: 209232
URL: http://svn.freebsd.org/changeset/base/209232

Log:
  Move ARM nexus rman initialization to attach routine.
  
  This fixes a panic, which started to trigger after r209129 cleanup.
  
  Submitted by: Andrew Turner

Modified:
  head/sys/arm/arm/nexus.c

Modified: head/sys/arm/arm/nexus.c
==
--- head/sys/arm/arm/nexus.cWed Jun 16 12:55:14 2010(r209231)
+++ head/sys/arm/arm/nexus.cWed Jun 16 14:10:39 2010(r209232)
@@ -110,13 +110,6 @@ nexus_probe(device_t dev)
 
device_quiet(dev);  /* suppress attach message for neatness */
 
-   mem_rman.rm_start = 0;
-   mem_rman.rm_end = ~0u;
-   mem_rman.rm_type = RMAN_ARRAY;
-   mem_rman.rm_descr = I/O memory addresses;
-   if (rman_init(mem_rman) || rman_manage_region(mem_rman, 0, ~0u))
-   panic(nexus_probe mem_rman);
-
return (BUS_PROBE_DEFAULT);
 }
 
@@ -144,6 +137,13 @@ static int
 nexus_attach(device_t dev)
 {
 
+   mem_rman.rm_start = 0;
+   mem_rman.rm_end = ~0u;
+   mem_rman.rm_type = RMAN_ARRAY;
+   mem_rman.rm_descr = I/O memory addresses;
+   if (rman_init(mem_rman) || rman_manage_region(mem_rman, 0, ~0u))
+   panic(nexus_probe mem_rman);
+
/*
 * First, deal with the children we know about already
 */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r209129 - head/sys/arm/arm

2010-06-16 Thread Rafal Jaworowski

On 2010-06-16, at 11:03, Andrew Turner wrote:

 On Sun, 13 Jun 2010 13:08:23 + (UTC)
 Rafal Jaworowski r...@freebsd.org wrote:
 
 Author: raj
 Date: Sun Jun 13 13:08:23 2010
 New Revision: 209129
 URL: http://svn.freebsd.org/changeset/base/209129
 
 Log:
  Improve style.
 
 Modified:
  head/sys/arm/arm/nexus.c
 
 Modified: head/sys/arm/arm/nexus.c
 ==
 --- head/sys/arm/arm/nexus.c Sun Jun 13 13:02:43 2010
 (r209128) +++ head/sys/arm/arm/nexus.c   Sun Jun 13 13:08:23
 2010 (r209129) @@ -107,6 +107,7 @@ static devclass_t
 nexus_devclass; static int
 nexus_probe(device_t dev)
 {
 +
  device_quiet(dev);  /* suppress attach message for
 neatness */ 
  mem_rman.rm_start = 0;
 @@ -116,7 +117,7 @@ nexus_probe(device_t dev)
  if (rman_init(mem_rman) || rman_manage_region(mem_rman, 0,
 ~0u)) panic(nexus_probe mem_rman);
 
 -return (0);
 +return (BUS_PROBE_DEFAULT);
 Changing the return value of nexus_probe from 0 to BUS_PROBE_DEFAULT
 causes the following panic for me when the s3c24x0 driver calls
 rman_init. The attached patch fixes it by moving the call to rman_init
 from nexus_probe to nexus_attach.

Thanks (and sorry for the breakage -- it wasn't seen on FDT-enabled platforms 
as they use their own rman(s)..), should be fixed in r209232.

Rafal

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r209240 - head

2010-06-16 Thread Rafal Jaworowski
Author: raj
Date: Wed Jun 16 16:52:35 2010
New Revision: 209240
URL: http://svn.freebsd.org/changeset/base/209240

Log:
  Use awk alone for extracting FDT_DTS_FILE instead of grep/cut, which is
  simpler and more robust.
  
  Submitted by: Andrzej Tobola

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Wed Jun 16 16:39:01 2010(r209239)
+++ head/Makefile.inc1  Wed Jun 16 16:52:35 2010(r209240)
@@ -1458,8 +1458,8 @@ _xi-links:
 DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
 
 .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
-FDT_DTS_FILE!=  grep ^makeoptions[[:space:]]\+FDT_DTS_FILE \
-   ${KERNCONFDIR}/${KERNCONF} 2 /dev/null | cut -d= -f2
+FDT_DTS_FILE!= awk '/^makeoptions[[:space:]]+FDT_DTS_FILE/ {FS==|[ \t]+; 
print $$3}' \
+   ${KERNCONFDIR}/${KERNCONF}
 .endif
 
 .endif
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r209130 - in head/sys: arm/include dev/fdt

2010-06-15 Thread Rafal Jaworowski

On 2010-06-14, at 00:43, Andrew Turner wrote:

 On Sun, 13 Jun 2010 13:12:52 + (UTC)
 Rafal Jaworowski r...@freebsd.org wrote:
 
 Author: raj
 Date: Sun Jun 13 13:12:52 2010
 New Revision: 209130
 URL: http://svn.freebsd.org/changeset/base/209130
 
 Log:
  Initial FDT infrastructure elements for ARM.
 
  Reviewed by:imp
  Sponsored by:   The FreeBSD Foundation
 
 Added:
  head/sys/arm/include/fdt.h   (contents, props changed)
  head/sys/arm/include/ofw_machdep.h   (contents, props changed)
  head/sys/dev/fdt/fdt_arm.c   (contents, props changed)
 
 Added: head/sys/arm/include/fdt.h
 ==
 --- /dev/null00:00:00 1970   (empty, because file is
 newly added)
 +++ head/sys/arm/include/fdt.h   Sun Jun 13
 13:12:52 2010(r209130)
 @@ -0,0 +1,68 @@
 +/*-
 + * Copyright (c) 2010 The FreeBSD Foundation
 + * All rights reserved.
 + *
 + * This software was developed by Semihalf under sponsorship from
 + * the FreeBSD Foundation.
 + *
 + * Redistribution and use in source and binary forms, with or without
 + * modification, are permitted provided that the following conditions
 + * are met:
 + * 1. Redistributions of source code must retain the above copyright
 + *notice, this list of conditions and the following disclaimer.
 + * 2. Redistributions in binary form must reproduce the above
 copyright
 + *notice, this list of conditions and the following disclaimer
 in the
 + *documentation and/or other materials provided with the
 distribution.
 + *
 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS
 IS'' AND
 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 THE
 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 PARTICULAR PURPOSE
 + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
 LIABLE
 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 CONSEQUENTIAL
 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 GOODS
 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 INTERRUPTION)
 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 CONTRACT, STRICT
 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 ANY WAY
 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 POSSIBILITY OF
 + * SUCH DAMAGE.
 + *
 + * $FreeBSD$
 + */
 +
 +#ifndef _MACHINE_FDT_H_
 +#define _MACHINE_FDT_H_
 +
 +#include dev/ofw/openfirm.h
 +
 +#include vm/vm.h
 +#include vm/pmap.h
 +
 +#include machine/pmap.h
 +#include machine/intr.h
 +
 +#include arm/mv/mvvar.h
 +#include arm/mv/mvwin.h
 Are the mv headders supposed to be here? They are including a soc
 specific file from an ARM header.

They are required for now, but will go away with another conversion of ARM 
platform other than Marvell. We still need to factor out some pieces, but they 
are really tiny.

Rafal

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r209161 - head/sys/arm/include

2010-06-14 Thread Rafal Jaworowski
Author: raj
Date: Mon Jun 14 16:05:21 2010
New Revision: 209161
URL: http://svn.freebsd.org/changeset/base/209161

Log:
  Temporarily bring back the ARM bootinfo (and make tinderbox happy).
  
  BI will be eliminated for good when powerpc transition to FDT is complete.

Added:
 - copied unchanged from r209130, head/sys/arm/include/bootinfo.h
Directory Properties:
  head/sys/arm/include/bootinfo.h   (props changed)
Modified:
  head/sys/arm/include/metadata.h

Copied: head/sys/arm/include/bootinfo.h (from r209130, 
head/sys/arm/include/bootinfo.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/include/bootinfo.h Mon Jun 14 16:05:21 2010
(r209161, copy of r209130, head/sys/arm/include/bootinfo.h)
@@ -0,0 +1,72 @@
+/*-
+ * Copyright (C) 2006-2008 Semihalf, Marian Balakowicz m...@semihalf.com
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_BOOTINFO_H_
+#define _MACHINE_BOOTINFO_H_
+
+#if !defined(LOCORE)
+
+/* Platform hardware spec, received from loader(8) */
+
+#define BI_VERSION 1
+
+struct bi_mem_region {
+   vm_paddr_t  mem_base;
+   vm_size_t   mem_size;
+};
+
+struct bi_eth_addr {
+   u_int8_tmac_addr[6];
+   u_int8_tpadding[2];
+};
+
+struct bootinfo {
+   u_int32_t   bi_version;
+   vm_offset_t bi_bar_base;
+   u_int32_t   bi_cpu_clk;
+   u_int32_t   bi_bus_clk;
+   u_int8_tbi_mem_reg_no;
+   u_int8_tbi_eth_addr_no;
+   u_int8_tpadding[2];
+
+   u_int8_tbi_data[1];
+   /*
+* The bi_data container is allocated in run time and has the
+* following layout:
+*
+* - bi_mem_reg_no elements of struct bi_mem_region
+* - bi_eth_addr_no elements of struct bi_eth_addr
+*/
+};
+
+extern struct bootinfo *bootinfo;
+
+struct bi_mem_region *bootinfo_mr(void);
+struct bi_eth_addr *bootinfo_eth(void);
+#endif
+
+#endif /* _MACHINE_BOOTINFO_H_ */

Modified: head/sys/arm/include/metadata.h
==
--- head/sys/arm/include/metadata.h Mon Jun 14 15:52:50 2010
(r209160)
+++ head/sys/arm/include/metadata.h Mon Jun 14 16:05:21 2010
(r209161)
@@ -31,4 +31,10 @@
 
 #defineMODINFOMD_DTBP  0x1001
 
+/*
+ * XXX this is for tinderbox compilation sake only and will go away once the
+ * FDT transition is complete.
+ */
+#define MODINFOMD_BOOTINFO 0x2000
+
 #endif /* !_MACHINE_METADATA_H_ */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r209125 - in head/sys/boot: arm/uboot powerpc/uboot uboot/common

2010-06-13 Thread Rafal Jaworowski
Author: raj
Date: Sun Jun 13 12:46:32 2010
New Revision: 209125
URL: http://svn.freebsd.org/changeset/base/209125

Log:
  Fix conditional FDT support in loader(8).

Modified:
  head/sys/boot/arm/uboot/Makefile
  head/sys/boot/powerpc/uboot/Makefile
  head/sys/boot/uboot/common/metadata.c

Modified: head/sys/boot/arm/uboot/Makefile
==
--- head/sys/boot/arm/uboot/MakefileSun Jun 13 12:39:22 2010
(r209124)
+++ head/sys/boot/arm/uboot/MakefileSun Jun 13 12:46:32 2010
(r209125)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+.include bsd.own.mk
+
 PROG=  ubldr
 NEWVERSWHAT=   U-Boot loader ${MACHINE_ARCH}
 BINDIR?=   /boot
@@ -18,7 +20,7 @@ LOADER_NFS_SUPPORT?=  yes
 LOADER_TFTP_SUPPORT?=  no
 LOADER_GZIP_SUPPORT?=  no
 LOADER_BZIP2_SUPPORT?= no
-.if defined(WITH_FDT)
+.if ${MK_FDT} != no
 LOADER_FDT_SUPPORT=yes
 .else
 LOADER_FDT_SUPPORT=no

Modified: head/sys/boot/powerpc/uboot/Makefile
==
--- head/sys/boot/powerpc/uboot/MakefileSun Jun 13 12:39:22 2010
(r209124)
+++ head/sys/boot/powerpc/uboot/MakefileSun Jun 13 12:46:32 2010
(r209125)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+.include bsd.own.mk
+
 PROG=  ubldr
 NEWVERSWHAT=   U-Boot loader ${MACHINE_ARCH}
 BINDIR?=   /boot
@@ -18,7 +20,7 @@ LOADER_NFS_SUPPORT?=  yes
 LOADER_TFTP_SUPPORT?=  no
 LOADER_GZIP_SUPPORT?=  no
 LOADER_BZIP2_SUPPORT?= no
-.if defined(WITH_FDT)
+.if ${MK_FDT} != no
 LOADER_FDT_SUPPORT=yes
 .else
 LOADER_FDT_SUPPORT=no

Modified: head/sys/boot/uboot/common/metadata.c
==
--- head/sys/boot/uboot/common/metadata.c   Sun Jun 13 12:39:22 2010
(r209124)
+++ head/sys/boot/uboot/common/metadata.c   Sun Jun 13 12:46:32 2010
(r209125)
@@ -36,7 +36,9 @@ __FBSDID($FreeBSD$);
 
 #include machine/elf.h
 #include machine/metadata.h
+#if !defined(LOADER_FDT_SUPPORT)
 #include machine/bootinfo.h
+#endif
 
 #include api_public.h
 #include bootstrap.h
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r209126 - head/share/mk

2010-06-13 Thread Rafal Jaworowski
Author: raj
Date: Sun Jun 13 12:53:44 2010
New Revision: 209126
URL: http://svn.freebsd.org/changeset/base/209126

Log:
  Do not set WITH_FDT by default based on arch, as this does not work for
  a bootstrap stage tool.
  
  FDT-enabled platforms will have to specify WITH_FDT explicitly at buildworld
  time for now until TBEMD is complete, which is going to provide means for such
  arch based selection of build components.
  
  Discussed with:   imp

Modified:
  head/share/mk/bsd.own.mk

Modified: head/share/mk/bsd.own.mk
==
--- head/share/mk/bsd.own.mkSun Jun 13 12:46:32 2010(r209125)
+++ head/share/mk/bsd.own.mkSun Jun 13 12:53:44 2010(r209126)
@@ -278,15 +278,6 @@ WITH_HESIOD=
 WITH_IDEA=
 .endif
 
-# Enable FDT by default for selected platforms.
-.if ${MACHINE_ARCH} == arm || ${MACHINE_ARCH} == powerpc
-# XXX this is temporarily disabled until all FDT support code is in place.
-#_fdt= FDT
-_no_fdt= FDT
-.else
-_no_fdt= FDT
-.endif
-
 #
 # Default behaviour of MK_CLANG depends on the architecture.
 #
@@ -335,7 +326,6 @@ _clang_no=CLANG
 DICT \
 DYNAMICROOT \
 EXAMPLES \
-${_fdt} \
 FLOPPY \
 FORTH \
 FP_LIBC \
@@ -431,7 +421,7 @@ MK_${var}:= yes
 BIND_SIGCHASE \
 BIND_XML \
 ${_clang_no} \
-${_no_fdt} \
+FDT \
 HESIOD \
 IDEA
 .if defined(WITH_${var})  defined(WITHOUT_${var})
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r209127 - head/sys/dev/fdt

2010-06-13 Thread Rafal Jaworowski
Author: raj
Date: Sun Jun 13 12:58:31 2010
New Revision: 209127
URL: http://svn.freebsd.org/changeset/base/209127

Log:
  Provide identify method for the fdtbus(4).
  
  Reviewed by:  imp
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/fdt/fdtbus.c

Modified: head/sys/dev/fdt/fdtbus.c
==
--- head/sys/dev/fdt/fdtbus.c   Sun Jun 13 12:53:44 2010(r209126)
+++ head/sys/dev/fdt/fdtbus.c   Sun Jun 13 12:58:31 2010(r209127)
@@ -77,6 +77,7 @@ struct fdtbus_softc {
 /*
  * Prototypes.
  */
+static void fdtbus_identify(driver_t *, device_t);
 static int fdtbus_probe(device_t);
 static int fdtbus_attach(device_t);
 
@@ -109,6 +110,7 @@ static void newbus_device_from_fdt_node(
  */
 static device_method_t fdtbus_methods[] = {
/* Device interface */
+   DEVMETHOD(device_identify,  fdtbus_identify),
DEVMETHOD(device_probe, fdtbus_probe),
DEVMETHOD(device_attach,fdtbus_attach),
DEVMETHOD(device_detach,bus_generic_detach),
@@ -144,6 +146,14 @@ devclass_t fdtbus_devclass;
 
 DRIVER_MODULE(fdtbus, nexus, fdtbus_driver, fdtbus_devclass, 0, 0);
 
+static void
+fdtbus_identify(driver_t *driver, device_t parent)
+{
+
+   if (device_find_child(parent, fdtbus, -1) == NULL)
+   BUS_ADD_CHILD(parent, 0, fdtbus, -1);
+}
+
 static int
 fdtbus_probe(device_t dev)
 {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r209128 - in head: . gnu/usr.bin sys/conf

2010-06-13 Thread Rafal Jaworowski
Author: raj
Date: Sun Jun 13 13:02:43 2010
New Revision: 209128
URL: http://svn.freebsd.org/changeset/base/209128

Log:
  Connect FDT infrastructure to the build system.
  
  Reviewed by:  imp
  Sponsored by: The FreeBSD Foundation

Modified:
  head/Makefile
  head/Makefile.inc1
  head/gnu/usr.bin/Makefile
  head/sys/conf/files

Modified: head/Makefile
==
--- head/Makefile   Sun Jun 13 12:58:31 2010(r209127)
+++ head/Makefile   Sun Jun 13 13:02:43 2010(r209128)
@@ -89,7 +89,8 @@ TGTS= all all-man buildenv buildenvvars 
obj objlink regress rerelease showconfig tags toolchain update \
_worldtmp _legacy _bootstrap-tools _cleanobj _obj \
_build-tools _cross-tools _includes _libraries _depend \
-   build32 distribute32 install32 xdev xdev-build xdev-install
+   build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
+
 TGTS+= ${SUBDIR_TARGETS}
 
 BITGTS=files includes

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Sun Jun 13 12:58:31 2010(r209127)
+++ head/Makefile.inc1  Sun Jun 13 13:02:43 2010(r209128)
@@ -968,6 +968,10 @@ _dtrace_tools= cddl/usr.bin/sgsmsg cddl/
 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
 .endif
 
+.if ${MK_FDT} != no
+_dtc= gnu/usr.bin/dtc
+.endif
+
 bootstrap-tools:
 .for _tool in \
 ${_clang_tblgen} \
@@ -976,6 +980,7 @@ bootstrap-tools:
 ${_gperf} \
 ${_groff} \
 ${_ar} \
+${_dtc} \
 usr.bin/lorder \
 usr.bin/makewhatis \
 ${_mklocale} \
@@ -1448,3 +1453,39 @@ _xi-links:
../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
done
 .endif
+
+.if !empty(KRNLOBJDIR)  !empty(KERNCONF)
+DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
+
+.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
+FDT_DTS_FILE!=  grep ^makeoptions[[:space:]]\+FDT_DTS_FILE \
+   ${KERNCONFDIR}/${KERNCONF} 2 /dev/null | cut -d= -f2
+.endif
+
+.endif
+
+.if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
+DTBOUTPUTPATH= ${.CURDIR}
+.endif
+
+#
+# Build 'standalone' Device Tree Blob
+#
+builddtb:
+   @if [ ${FDT_DTS_FILE} =  ]; then \
+   echo ERROR: FDT_DTS_FILE must be specified!; \
+   exit 1; \
+   fi; \
+   if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \
+   echo ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
+   exist!; \
+   exit 1; \
+   fi; \
+   if [ ${DTBOUTPUTPATH} = ${.CURDIR} ]; then  \
+   echo WARNING: DTB will be placed in the current working \
+   directory; \
+   fi
+   @PATH=${TMPPATH} \
+   dtc -O dtb -o \
+   ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \
+   -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE}

Modified: head/gnu/usr.bin/Makefile
==
--- head/gnu/usr.bin/Makefile   Sun Jun 13 12:58:31 2010(r209127)
+++ head/gnu/usr.bin/Makefile   Sun Jun 13 13:02:43 2010(r209128)
@@ -8,6 +8,7 @@ SUBDIR= ${_binutils} \
dialog \
diff \
diff3 \
+   ${_dtc} \
${_gdb} \
${_gperf} \
${_grep} \
@@ -31,6 +32,10 @@ _groff=  groff
 _cvs=  cvs
 .endif
 
+.if ${MK_FDT}  != no
+_dtc=  dtc
+.endif
+
 .if ${MK_GNU_GREP} != no
 _grep= grep
 .endif

Modified: head/sys/conf/files
==
--- head/sys/conf/files Sun Jun 13 12:58:31 2010(r209127)
+++ head/sys/conf/files Sun Jun 13 13:02:43 2010(r209128)
@@ -55,6 +55,18 @@ emu10k1-alsa%diked.h optional snd_emu10
compile-withCC='${CC}' AWK=${AWK} sh 
$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/emu10k1-alsa.h 
emu10k1-alsa%diked.h \
no-obj no-implicit-rule before-depend  \
clean   emu10k1-alsa%diked.h
+#
+# The 'fdt_dtb_file' target covers an actual DTB file name, which is derived
+# from the specified source (DTS) file: platform.dts - platform.dtb
+#
+fdt_dtb_file   optional fdt \
+   compile-with if [ -f $S/boot/fdt/dts/${FDT_DTS_FILE} ]; then dtc -O 
dtb -o `echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 -p 1024 
$S/boot/fdt/dts/${FDT_DTS_FILE}; fi \
+   no-obj no-implicit-rule before-depend   \
+   clean   `echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb
+fdt_static_dtb.h   optional fdt fdt_dtb_static \
+   compile-with sh $S/tools/fdt/make_dtbh.sh ${FDT_DTS_FILE} . \
+   no-obj no-implicit-rule before-depend \
+   clean   fdt_static_dtb.h
 p16v-alsa%diked.h  optional snd_emu10kx pci
   \

svn commit: r209129 - head/sys/arm/arm

2010-06-13 Thread Rafal Jaworowski
Author: raj
Date: Sun Jun 13 13:08:23 2010
New Revision: 209129
URL: http://svn.freebsd.org/changeset/base/209129

Log:
  Improve style.

Modified:
  head/sys/arm/arm/nexus.c

Modified: head/sys/arm/arm/nexus.c
==
--- head/sys/arm/arm/nexus.cSun Jun 13 13:02:43 2010(r209128)
+++ head/sys/arm/arm/nexus.cSun Jun 13 13:08:23 2010(r209129)
@@ -107,6 +107,7 @@ static devclass_t nexus_devclass;
 static int
 nexus_probe(device_t dev)
 {
+
device_quiet(dev);  /* suppress attach message for neatness */
 
mem_rman.rm_start = 0;
@@ -116,7 +117,7 @@ nexus_probe(device_t dev)
if (rman_init(mem_rman) || rman_manage_region(mem_rman, 0, ~0u))
panic(nexus_probe mem_rman);
 
-   return (0);
+   return (BUS_PROBE_DEFAULT);
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r209130 - in head/sys: arm/include dev/fdt

2010-06-13 Thread Rafal Jaworowski
Author: raj
Date: Sun Jun 13 13:12:52 2010
New Revision: 209130
URL: http://svn.freebsd.org/changeset/base/209130

Log:
  Initial FDT infrastructure elements for ARM.
  
  Reviewed by:  imp
  Sponsored by: The FreeBSD Foundation

Added:
  head/sys/arm/include/fdt.h   (contents, props changed)
  head/sys/arm/include/ofw_machdep.h   (contents, props changed)
  head/sys/dev/fdt/fdt_arm.c   (contents, props changed)

Added: head/sys/arm/include/fdt.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/include/fdt.h  Sun Jun 13 13:12:52 2010(r209130)
@@ -0,0 +1,68 @@
+/*-
+ * Copyright (c) 2010 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Semihalf under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_FDT_H_
+#define _MACHINE_FDT_H_
+
+#include dev/ofw/openfirm.h
+
+#include vm/vm.h
+#include vm/pmap.h
+
+#include machine/pmap.h
+#include machine/intr.h
+
+#include arm/mv/mvvar.h
+#include arm/mv/mvwin.h
+
+/*
+ * This is the base virtual address the internal mem-mapped registers (IMMR)
+ * range is available at.
+ */
+#define FDT_IMMR_VAMV_BASE
+
+/* Max interrupt number */
+#define FDT_INTR_MAX   NIRQ
+
+/*
+ * Bus space tag. XXX endianess info needs to be derived from the blob.
+ */
+extern bus_space_tag_t fdtbus_bs_tag;
+
+struct mem_region {
+   vm_offset_t mr_start;
+   vm_size_t   mr_size;
+};
+
+int fdt_pci_devmap(phandle_t, struct pmap_devmap *devmap, vm_offset_t,
+vm_offset_t);
+
+#endif /* _MACHINE_FDT_H_ */

Added: head/sys/arm/include/ofw_machdep.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/include/ofw_machdep.h  Sun Jun 13 13:12:52 2010
(r209130)
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (c) 2009 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Semihalf under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_OFW_MACHDEP_H_
+#define _MACHINE_OFW_MACHDEP_H_
+
+typedefuint32_tcell_t;
+
+#endif /* _MACHINE_OFW_MACHDEP_H_ */

Added: head/sys/dev/fdt/fdt_arm.c

svn commit: r209131 - in head/sys: arm/conf arm/include arm/mv arm/mv/discovery arm/mv/kirkwood arm/mv/orion conf dev/mge dev/uart dev/usb/controller

2010-06-13 Thread Rafal Jaworowski
Author: raj
Date: Sun Jun 13 13:28:53 2010
New Revision: 209131
URL: http://svn.freebsd.org/changeset/base/209131

Log:
  Convert Marvell ARM platforms to FDT convention.
  
  The following systems are involved:
  
- DB-88F5182
- DB-88F5281
- DB-88F6281
- DB-78100
- SheevaPlug
  
  This overhaul covers the following major changes:
  
- All integrated peripherals drivers for Marvell ARM SoC, which are
  currently in the FreeBSD source tree are reworked and adjusted so they
  derive config data out of the device tree blob (instead of hard coded /
  tabelarized values).
  
- Since the common FDT infrastrucutre (fdtbus, simplebus) is used we say
  good by to obio / mbus drivers and numerous hard-coded config data.
  
  Note that world needs to be built WITH_FDT for the affected platforms.
  
  Reviewed by:  imp
  Sponsored by: The FreeBSD Foundation.

Added:
  head/sys/dev/usb/controller/ehci_mv.c   (contents, props changed)
Deleted:
  head/sys/arm/include/bootinfo.h
  head/sys/arm/mv/discovery/db78xxx.c
  head/sys/arm/mv/kirkwood/db88f6xxx.c
  head/sys/arm/mv/kirkwood/files.db88f6xxx
  head/sys/arm/mv/obio.c
  head/sys/dev/uart/uart_bus_mbus.c
  head/sys/dev/uart/uart_cpu_mv.c
  head/sys/dev/usb/controller/ehci_mbus.c
Modified:
  head/sys/arm/conf/DB-78XXX
  head/sys/arm/conf/DB-88F5XXX
  head/sys/arm/conf/DB-88F6XXX
  head/sys/arm/conf/SHEEVAPLUG
  head/sys/arm/include/metadata.h
  head/sys/arm/mv/bus_space.c
  head/sys/arm/mv/common.c
  head/sys/arm/mv/discovery/discovery.c
  head/sys/arm/mv/discovery/files.db78xxx
  head/sys/arm/mv/files.mv
  head/sys/arm/mv/gpio.c
  head/sys/arm/mv/ic.c
  head/sys/arm/mv/kirkwood/kirkwood.c
  head/sys/arm/mv/kirkwood/sheevaplug.c
  head/sys/arm/mv/kirkwood/std.db88f6xxx
  head/sys/arm/mv/kirkwood/std.sheevaplug
  head/sys/arm/mv/mv_machdep.c
  head/sys/arm/mv/mv_pci.c
  head/sys/arm/mv/mv_sata.c
  head/sys/arm/mv/mvreg.h
  head/sys/arm/mv/mvvar.h
  head/sys/arm/mv/mvwin.h
  head/sys/arm/mv/orion/db88f5xxx.c
  head/sys/arm/mv/orion/orion.c
  head/sys/arm/mv/rtc.c
  head/sys/arm/mv/timer.c
  head/sys/arm/mv/twsi.c
  head/sys/conf/Makefile.arm
  head/sys/conf/files.arm
  head/sys/conf/options.arm
  head/sys/dev/mge/if_mge.c
  head/sys/dev/mge/if_mgevar.h

Modified: head/sys/arm/conf/DB-78XXX
==
--- head/sys/arm/conf/DB-78XXX  Sun Jun 13 13:12:52 2010(r209130)
+++ head/sys/arm/conf/DB-78XXX  Sun Jun 13 13:28:53 2010(r209131)
@@ -83,3 +83,7 @@ deviceds133x
 # SATA
 device ata
 device atadisk
+
+# Flattened Device Tree
+optionsFDT
+makeoptionsFDT_DTS_FILE=db78100.dts

Modified: head/sys/arm/conf/DB-88F5XXX
==
--- head/sys/arm/conf/DB-88F5XXXSun Jun 13 13:12:52 2010
(r209130)
+++ head/sys/arm/conf/DB-88F5XXXSun Jun 13 13:28:53 2010
(r209131)
@@ -85,3 +85,7 @@ deviceda
 # SATA
 device ata
 device atadisk
+
+# Flattened Device Tree
+optionsFDT
+makeoptionsFDT_DTS_FILE=db88f5281.dts

Modified: head/sys/arm/conf/DB-88F6XXX
==
--- head/sys/arm/conf/DB-88F6XXXSun Jun 13 13:12:52 2010
(r209130)
+++ head/sys/arm/conf/DB-88F6XXXSun Jun 13 13:28:53 2010
(r209131)
@@ -82,3 +82,7 @@ deviceiicbus
 # SATA
 device ata
 device atadisk
+
+# Flattened Device Tree
+optionsFDT
+makeoptionsFDT_DTS_FILE=db88f6281.dts

Modified: head/sys/arm/conf/SHEEVAPLUG
==
--- head/sys/arm/conf/SHEEVAPLUGSun Jun 13 13:12:52 2010
(r209130)
+++ head/sys/arm/conf/SHEEVAPLUGSun Jun 13 13:28:53 2010
(r209131)
@@ -69,3 +69,7 @@ devicescbus
 device pass
 device da
 
+# Flattened Device Tree
+optionsFDT
+optionsFDT_DTB_STATIC
+makeoptionsFDT_DTS_FILE=sheevaplug.dts

Modified: head/sys/arm/include/metadata.h
==
--- head/sys/arm/include/metadata.h Sun Jun 13 13:12:52 2010
(r209130)
+++ head/sys/arm/include/metadata.h Sun Jun 13 13:28:53 2010
(r209131)
@@ -29,7 +29,6 @@
 #ifndef _MACHINE_METADATA_H_
 #define_MACHINE_METADATA_H_
 
-#defineMODINFOMD_BOOTINFO  0x1001
-#defineMODINFOMD_DTBP  0x1002
+#defineMODINFOMD_DTBP  0x1001
 
 #endif /* !_MACHINE_METADATA_H_ */

Modified: head/sys/arm/mv/bus_space.c
==
--- head/sys/arm/mv/bus_space.c Sun Jun 13 13:12:52 2010(r209130)
+++ head/sys/arm/mv/bus_space.c Sun Jun 13 13:28:53 2010(r209131)
@@ -49,7 

svn commit: r209132 - head/usr.sbin

2010-06-13 Thread Rafal Jaworowski
Author: raj
Date: Sun Jun 13 13:30:26 2010
New Revision: 209132
URL: http://svn.freebsd.org/changeset/base/209132

Log:
  Enable ofwdump(8) on ARM as this is a useful tool to inspect a flattened
  device tree.

Modified:
  head/usr.sbin/Makefile

Modified: head/usr.sbin/Makefile
==
--- head/usr.sbin/Makefile  Sun Jun 13 13:28:53 2010(r209131)
+++ head/usr.sbin/Makefile  Sun Jun 13 13:30:26 2010(r209132)
@@ -498,6 +498,10 @@ _spkrtest= spkrtest
 _zzz=  zzz
 .endif
 
+.if ${MACHINE_ARCH} == arm
+_ofwdump=  ofwdump
+.endif
+
 .if ${MACHINE_ARCH} == ia64
 .if ${MK_ACPI} != no
 _acpi= acpi
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r208964 - in head: . etc/mtree lib share/mk usr.bin

2010-06-12 Thread Rafal Jaworowski

On 2010-06-10, at 17:25, M. Warner Losh wrote:

 In message: 201006091957.o59jvkbu025...@svn.freebsd.org
Roman Divacky rdiva...@freebsd.org writes:
 : Modified: head/share/mk/bsd.own.mk
 : 
 ==
 : --- head/share/mk/bsd.own.mkWed Jun  9 19:32:20 2010
 (r208963)
 : +++ head/share/mk/bsd.own.mkWed Jun  9 19:57:20 2010
 (r208964)
 : @@ -288,6 +288,18 @@ _no_fdt= FDT
 :  .endif
 :  
 :  #
 : +# Default behaviour of MK_CLANG depends on the architecture.
 : +#
 : +.if ${MACHINE_ARCH} == amd64 || ${MACHINE_ARCH} == i386 || \
 : +${MACHINE_ARCH} == powerpc
 : +_clang_yes=CLANG
 : +_clang_no=
 : +.else
 : +_clang_yes=
 : +_clang_no=CLANG
 : +.endif
 
 We really should *NOT* be encoding architecture stuff like this into
 bsd.own.mk.  Sometimes the right thing here is MACHINE_ARCH, and for
 the moment, since clang is not a bootstrap tool, this is correct.
 However, once clang is a bootstrap tool, this will be incorrect
 because during the bootstrapping for cross building TARGET_ARCH is
 what should be tested.  We have the same problem with the FTD stuff
 that was recently committed.  raj@ and I have been talking about the
 best ways to fix it.

I think I'm going to drop setting WITH_FDT by default for selected arches until 
the tdbemd arrives, and for this little (I hope :-) while it will just be 
required for FDT-enabled platforms to specify WITH_FDT explicitly.

Rafal

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r208747 - head/sys/dev/fdt

2010-06-03 Thread Rafal Jaworowski

On 2010-06-02, at 20:58, Doug Barton wrote:

 On 06/02/10 10:17, Rafal Jaworowski wrote:
  o simplebus(4) - bus driver representing ePAPR
 
 Do we write on it with eINK?


Hm, it's been eAPPROVED already 
(http://www.power.org/resources/downloads/Power_ePAPR_APPROVED_v1.0.pdf), but 
maybe with the next update or so..

Rafal

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r208747 - head/sys/dev/fdt

2010-06-02 Thread Rafal Jaworowski
Author: raj
Date: Wed Jun  2 17:17:45 2010
New Revision: 208747
URL: http://svn.freebsd.org/changeset/base/208747

Log:
  Import the common Flattened Device Tree infrastructure.
  
  o fdtbus(4) - the main abstract bus driver for all FDT-compliant systems. This
is a direct replacement for the many incompatible bus drivers grouping
integrated peripherals on embedded platforms (like obio(4), ocpbus(4) etc.)
  
  o simplebus(4) - bus driver representing ePAPR style 'simple-bus' node, which
is an umbrella device for most of the integrated peripherals on a typical
system-on-chip device.
  
  o Other components (common routines library, PCI node processing helper
functions)
  
  Reviewed by:  imp
  Sponsored by: The FreeBSD Foundation

Added:
  head/sys/dev/fdt/
  head/sys/dev/fdt/fdt_common.c   (contents, props changed)
  head/sys/dev/fdt/fdt_common.h   (contents, props changed)
  head/sys/dev/fdt/fdt_pci.c   (contents, props changed)
  head/sys/dev/fdt/fdt_static_dtb.S   (contents, props changed)
  head/sys/dev/fdt/fdtbus.c   (contents, props changed)
  head/sys/dev/fdt/simplebus.c   (contents, props changed)

Added: head/sys/dev/fdt/fdt_common.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/fdt/fdt_common.c   Wed Jun  2 17:17:45 2010
(r208747)
@@ -0,0 +1,629 @@
+/*-
+ * Copyright (c) 2009-2010 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Semihalf under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/kernel.h
+#include sys/module.h
+#include sys/bus.h
+
+#include machine/fdt.h
+#include machine/resource.h
+
+#include dev/fdt/fdt_common.h
+#include dev/ofw/ofw_bus.h
+#include dev/ofw/ofw_bus_subr.h
+#include dev/ofw/openfirm.h
+
+#include ofw_bus_if.h
+
+#ifdef DEBUG
+#define debugf(fmt, args...) do { printf(%s(): , __func__);  \
+printf(fmt,##args); } while (0)
+#else
+#define debugf(fmt, args...)
+#endif
+
+#define FDT_COMPAT_LEN 255
+#define FDT_TYPE_LEN   64
+
+#define FDT_REG_CELLS  4
+
+vm_paddr_t fdt_immr_pa;
+vm_offset_t fdt_immr_va;
+vm_offset_t fdt_immr_size;
+
+int
+fdt_immr_addr(void)
+{
+   pcell_t ranges[6], *rangesptr;
+   phandle_t node;
+   u_long base, size;
+   pcell_t addr_cells, size_cells, par_addr_cells;
+   int len, tuple_size, tuples;
+
+   /*
+* Try to access the SOC node directly i.e. through /aliases/.
+*/
+   if ((node = OF_finddevice(soc)) != 0)
+   if (fdt_is_compatible_strict(node, simple-bus))
+   goto moveon;
+   /*
+* Find the node the long way.
+*/
+   if ((node = OF_finddevice(/)) == 0)
+   return (ENXIO);
+
+   if ((node = fdt_find_compatible(node, simple-bus, 1)) == 0)
+   return (ENXIO);
+
+moveon:
+   if ((fdt_addrsize_cells(node, addr_cells, size_cells)) != 0)
+   return (ENXIO);
+   /*
+* Process 'ranges' property.
+*/
+   par_addr_cells = fdt_parent_addr_cells(node);
+   if (par_addr_cells  2)
+   return (ERANGE);
+
+   len = OF_getproplen(node, ranges);
+   if (len  sizeof(ranges))
+   return (ENOMEM);
+
+   if (OF_getprop(node, ranges, ranges, sizeof(ranges)) = 0)
+   return (EINVAL);
+
+   tuple_size = sizeof(pcell_t) * (addr_cells + par_addr_cells +
+   size_cells);
+   tuples = len / tuple_size;
+
+   if (fdt_ranges_verify(ranges, tuples, 

svn commit: r208748 - head/sys/dev/uart

2010-06-02 Thread Rafal Jaworowski
Author: raj
Date: Wed Jun  2 17:20:00 2010
New Revision: 208748
URL: http://svn.freebsd.org/changeset/base/208748

Log:
  FDT (simplebus) compatible attachment for uart(4).
  
  This will be a single uart(4) attachment code shared by all FDT-enabled
  platforms.
  
  Reviewed by:  imp
  Sponsored by: The FreeBSD Foundation

Added:
  head/sys/dev/uart/uart_bus_fdt.c   (contents, props changed)

Added: head/sys/dev/uart/uart_bus_fdt.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/uart/uart_bus_fdt.cWed Jun  2 17:20:00 2010
(r208748)
@@ -0,0 +1,200 @@
+/*-
+ * Copyright (c) 2009-2010 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Semihalf under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+#include sys/param.h
+#include sys/bus.h
+#include sys/kernel.h
+#include sys/module.h
+
+#include machine/bus.h
+#include machine/fdt.h
+
+#include dev/fdt/fdt_common.h
+#include dev/ofw/ofw_bus.h
+#include dev/ofw/ofw_bus_subr.h
+#include dev/uart/uart.h
+#include dev/uart/uart_bus.h
+#include dev/uart/uart_cpu.h
+
+static int uart_fdt_probe(device_t);
+
+static device_method_t uart_fdt_methods[] = {
+   /* Device interface */
+   DEVMETHOD(device_probe, uart_fdt_probe),
+   DEVMETHOD(device_attach,uart_bus_attach),
+   DEVMETHOD(device_detach,uart_bus_detach),
+   { 0, 0 }
+};
+
+static driver_t uart_fdt_driver = {
+   uart_driver_name,
+   uart_fdt_methods,
+   sizeof(struct uart_softc),
+};
+
+static int
+uart_fdt_get_clock(phandle_t node, pcell_t *cell)
+{
+   pcell_t clock;
+
+   if ((OF_getprop(node, clock-frequency, clock,
+   sizeof(clock))) = 0)
+   return (ENXIO);
+
+   if (clock == 0)
+   /* Try to retrieve parent 'bus-frequency' */
+   /* XXX this should go to simple-bus fixup or so */
+   if ((OF_getprop(OF_parent(node), bus-frequency, clock,
+   sizeof(clock))) = 0)
+   clock = 0;
+
+   *cell = fdt32_to_cpu(clock);
+   return (0);
+}
+
+static int
+uart_fdt_get_shift(phandle_t node, pcell_t *cell)
+{
+   pcell_t shift;
+
+   if ((OF_getprop(node, reg-shift, shift, sizeof(shift))) = 0)
+   shift = 0;
+   *cell = fdt32_to_cpu(shift);
+   return (0);
+}
+
+static int
+uart_fdt_probe(device_t dev)
+{
+   struct uart_softc *sc;
+   phandle_t node;
+   pcell_t clock, shift;
+   int err;
+
+   if (!ofw_bus_is_compatible(dev, ns16550))
+   return (ENXIO);
+
+   sc = device_get_softc(dev);
+   sc-sc_class = uart_ns8250_class;
+
+   node = ofw_bus_get_node(dev);
+
+   if ((err = uart_fdt_get_clock(node, clock)) != 0)
+   return (err);
+   uart_fdt_get_shift(node, shift);
+
+   return (uart_bus_probe(dev, (int)shift, (int)clock, 0, 0));
+}
+
+DRIVER_MODULE(uart, simplebus, uart_fdt_driver, uart_devclass, 0, 0);
+
+/*
+ * UART console routines.
+ */
+bus_space_tag_t uart_bus_space_io;
+bus_space_tag_t uart_bus_space_mem;
+
+int
+uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
+{
+
+   return ((b1-bsh == b2-bsh  b1-bst == b2-bst) ? 1 : 0);
+}
+
+int
+uart_cpu_getdev(int devtype, struct uart_devinfo *di)
+{
+   char buf[64];
+   struct uart_class *class;
+   phandle_t node, chosen;
+   pcell_t shift, br, rclk;
+   u_long start, size;
+   int err;
+
+   if (devtype != UART_DEV_CONSOLE)
+   return (ENXIO);
+
+  

svn commit: r208749 - head/sys/tools/fdt

2010-06-02 Thread Rafal Jaworowski
Author: raj
Date: Wed Jun  2 17:22:38 2010
New Revision: 208749
URL: http://svn.freebsd.org/changeset/base/208749

Log:
  Flattened Device Tree helper scripts.
  
  Reviewed by:  imp
  Sponsored by: The FreeBSD Foundation

Added:
  head/sys/tools/fdt/
  head/sys/tools/fdt/embed_dtb.sh   (contents, props changed)
  head/sys/tools/fdt/make_dtbh.sh   (contents, props changed)

Added: head/sys/tools/fdt/embed_dtb.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/tools/fdt/embed_dtb.sh Wed Jun  2 17:22:38 2010
(r208749)
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# Copyright (c) 2010 The FreeBSD Foundation
+# All rights reserved.
+#
+# This software was developed by Semihalf under sponsorship from
+# the FreeBSD Foundation.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+# $1: kernel filename
+# $2: device tree blob filename
+
+dtbsize=`ls -l $2 | awk '{print $5}'`
+obs=`strings -at d $1 | grep Device Tree Blob STARTS here | awk '{print $1}'`
+eol=`strings -at d $1 | grep Device Tree Blob STOPS here | awk '{print $1}'`
+sz=$((eol - obs));
+if [ $sz -lt $dtbsize ]
+then
+   echo Selected blob is too big to reembed. Please rebuild the kernel.
+   exit
+fi
+dd if=$2 ibs=${dtbsize} of=$1 obs=${obs} oseek=1 conv=notrunc 2 /dev/null

Added: head/sys/tools/fdt/make_dtbh.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/tools/fdt/make_dtbh.sh Wed Jun  2 17:22:38 2010
(r208749)
@@ -0,0 +1,8 @@
+#!/bin/sh
+#
+# $FreeBSD$
+
+# Script generates a $2/fdt_static_dtb.h file.
+
+dtb_base_name=`basename $1 .dts`
+echo '#define FDT_DTB_FILE '${dtb_base_name}.dtb''  $2/fdt_static_dtb.h
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r208750 - head/sys/contrib/libfdt

2010-06-02 Thread Rafal Jaworowski
Author: raj
Date: Wed Jun  2 17:24:41 2010
New Revision: 208750
URL: http://svn.freebsd.org/changeset/base/208750

Log:
  Provide kernel level headers for the libfdt code.
  
  Reviewed by:  imp
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/contrib/libfdt/libfdt_env.h

Modified: head/sys/contrib/libfdt/libfdt_env.h
==
--- head/sys/contrib/libfdt/libfdt_env.hWed Jun  2 17:22:38 2010
(r208749)
+++ head/sys/contrib/libfdt/libfdt_env.hWed Jun  2 17:24:41 2010
(r208750)
@@ -1,9 +1,17 @@
 #ifndef _LIBFDT_ENV_H
 #define _LIBFDT_ENV_H
 
+#ifdef _KERNEL
+#include sys/cdefs.h
+#include sys/param.h
+#include sys/types.h
+#include sys/systm.h
+#include sys/stdint.h
+#else
 #include stddef.h
 #include stdint.h
 #include string.h
+#endif
 
 #define _B(n)  ((unsigned long long)((uint8_t *)x)[n])
 static inline uint32_t fdt32_to_cpu(uint32_t x)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r208751 - in head/sys: libkern sys

2010-06-02 Thread Rafal Jaworowski
Author: raj
Date: Wed Jun  2 17:27:23 2010
New Revision: 208751
URL: http://svn.freebsd.org/changeset/base/208751

Log:
  Provide memchr() in the libkern.
  
  This is required by libfdt and will be compiled in conditionally only for
  FDT-enabled platforms.
  
  Reviewed by:  imp
  Sponsored by: The FreeBSD Foundation

Added:
  head/sys/libkern/memchr.c   (contents, props changed)
Modified:
  head/sys/sys/libkern.h

Added: head/sys/libkern/memchr.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/libkern/memchr.c   Wed Jun  2 17:27:23 2010(r208751)
@@ -0,0 +1,51 @@
+/*-
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *may be used to endorse or promote products derived from this software
+ *without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+#include sys/libkern.h
+#include sys/param.h
+
+void *
+memchr(const void *s, int c, size_t n)
+{
+   if (n != 0) {
+   const unsigned char *p = s;
+
+   do {
+   if (*p++ == (unsigned char)c)
+   return ((void *)(uintptr_t)(p - 1));
+   } while (--n != 0);
+   }
+   return (NULL);
+}

Modified: head/sys/sys/libkern.h
==
--- head/sys/sys/libkern.h  Wed Jun  2 17:24:41 2010(r208750)
+++ head/sys/sys/libkern.h  Wed Jun  2 17:27:23 2010(r208751)
@@ -92,6 +92,7 @@ intflsl(long);
 int fnmatch(const char *, const char *, int);
 voidgets(char *, size_t, int);
 int locc(int, char *, u_int);
+void   *memchr(const void *s, int c, size_t n);
 int memcmp(const void *b1, const void *b2, size_t len);
 voidqsort(void *base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *));
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r208613 - head/sys/conf

2010-05-28 Thread Rafal Jaworowski
Author: raj
Date: Fri May 28 10:35:44 2010
New Revision: 208613
URL: http://svn.freebsd.org/changeset/base/208613

Log:
  Introduce kernel build options for the Flattened Device Tree support.
  
  Reviewed by:  imp
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/conf/options

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Fri May 28 09:30:13 2010(r208612)
+++ head/sys/conf/options   Fri May 28 10:35:44 2010(r208613)
@@ -848,3 +848,7 @@ SND_PCM_64  opt_snd.h
 SND_OLDSTEREO  opt_snd.h
 
 X86BIOS
+
+# Flattened device tree options
+FDTopt_platform.h
+FDT_DTB_STATIC opt_platform.h
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r208614 - in head/sys: dev/ofw powerpc/ofw

2010-05-28 Thread Rafal Jaworowski
Author: raj
Date: Fri May 28 10:43:56 2010
New Revision: 208614
URL: http://svn.freebsd.org/changeset/base/208614

Log:
  Prepare and extend OFW layer for FDT support.
  
  o Let OFW_INIT() and OF_init() return status value.
  
  o Provide helper routines for 'compatible' property handling.
  
  o Only compile OF and OFW code, which is relevant in FDT scenario.
  
  o Other minor cosmetics
  
  Reviewed by:  imp
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/ofw/ofw_bus_subr.c
  head/sys/dev/ofw/ofw_bus_subr.h
  head/sys/dev/ofw/ofw_if.m
  head/sys/dev/ofw/ofw_standard.c
  head/sys/dev/ofw/openfirm.c
  head/sys/dev/ofw/openfirm.h
  head/sys/powerpc/ofw/ofw_real.c

Modified: head/sys/dev/ofw/ofw_bus_subr.c
==
--- head/sys/dev/ofw/ofw_bus_subr.c Fri May 28 10:35:44 2010
(r208613)
+++ head/sys/dev/ofw/ofw_bus_subr.c Fri May 28 10:43:56 2010
(r208614)
@@ -30,6 +30,7 @@
 #include sys/cdefs.h
 __FBSDID($FreeBSD$);
 
+#include opt_platform.h
 #include sys/param.h
 #include sys/systm.h
 #include sys/bus.h
@@ -146,6 +147,53 @@ ofw_bus_gen_get_type(device_t bus, devic
return (obd-obd_type);
 }
 
+int
+ofw_bus_is_compatible(device_t dev, const char *onecompat)
+{
+   phandle_t node;
+   const char *compat;
+   int len, onelen, l;
+
+   if ((compat = ofw_bus_get_compat(dev)) == NULL)
+   return (0);
+
+   if ((node = ofw_bus_get_node(dev)) == 0)
+   return (0);
+
+   /* Get total 'compatible' prop len */
+   if ((len = OF_getproplen(node, compatible)) = 0)
+   return (0);
+
+   onelen = strlen(onecompat);
+
+   while (len  0) {
+   if (strncasecmp(compat, onecompat, onelen) == 0)
+   /* Found it. */
+   return (1);
+
+   /* Slide to the next sub-string. */
+   l = strlen(compat) + 1;
+   compat += l;
+   len -= l;
+   }
+   return (0);
+}
+
+int
+ofw_bus_is_compatible_strict(device_t dev, const char *compatible)
+{
+   const char *compat;
+
+   if ((compat = ofw_bus_get_compat(dev)) == NULL)
+   return (0);
+
+   if (strncasecmp(compat, compatible, strlen(compatible)) == 0)
+   return (1);
+
+   return (0);
+}
+
+#ifndef FDT
 void
 ofw_bus_setup_iinfo(phandle_t node, struct ofw_bus_iinfo *ii, int intrsz)
 {
@@ -262,3 +310,4 @@ ofw_bus_search_intrmap(void *intr, int i
}
return (0);
 }
+#endif /* !FDT */

Modified: head/sys/dev/ofw/ofw_bus_subr.h
==
--- head/sys/dev/ofw/ofw_bus_subr.h Fri May 28 10:35:44 2010
(r208613)
+++ head/sys/dev/ofw/ofw_bus_subr.h Fri May 28 10:43:56 2010
(r208614)
@@ -67,4 +67,8 @@ int   ofw_bus_lookup_imap(phandle_t, struc
 intofw_bus_search_intrmap(void *, int, void *, int, void *, int, void *,
void *, void *, int);
 
+/* Helper routine for checking compat prop */
+int ofw_bus_is_compatible(device_t, const char *);
+int ofw_bus_is_compatible_strict(device_t, const char *);
+
 #endif /* !_DEV_OFW_OFW_BUS_SUBR_H_ */

Modified: head/sys/dev/ofw/ofw_if.m
==
--- head/sys/dev/ofw/ofw_if.m   Fri May 28 10:35:44 2010(r208613)
+++ head/sys/dev/ofw/ofw_if.m   Fri May 28 10:43:56 2010(r208614)
@@ -43,7 +43,7 @@ INTERFACE ofw;
  * @param _cookie  A handle to the client interface, generally the OF
  * callback routine.
  */
-METHOD void init {
+METHOD int init {
ofw_t   _ofw;
void*_cookie;
 };

Modified: head/sys/dev/ofw/ofw_standard.c
==
--- head/sys/dev/ofw/ofw_standard.c Fri May 28 10:35:44 2010
(r208613)
+++ head/sys/dev/ofw/ofw_standard.c Fri May 28 10:43:56 2010
(r208614)
@@ -70,7 +70,7 @@ __FBSDID($FreeBSD$);
 
 #include ofw_if.h
 
-static void ofw_std_init(ofw_t ofw, void *openfirm);
+static int ofw_std_init(ofw_t ofw, void *openfirm);
 static int ofw_std_test(ofw_t ofw, const char *name);
 static int ofw_std_interpret(ofw_t ofw, const char *cmd, int nreturns,
 unsigned long *returns);
@@ -150,11 +150,12 @@ static int (*openfirmware)(void *);
 
 /* Initializer */
 
-static void
+static int
 ofw_std_init(ofw_t ofw, void *openfirm)
 {
 
openfirmware = (int (*)(void *))openfirm;
+   return (0);
 }
 
 /*

Modified: head/sys/dev/ofw/openfirm.c
==
--- head/sys/dev/ofw/openfirm.c Fri May 28 10:35:44 2010(r208613)
+++ head/sys/dev/ofw/openfirm.c Fri May 28 10:43:56 2010(r208614)
@@ -58,6 +58,8 @@
 #include sys/cdefs.h
 __FBSDID($FreeBSD$);
 
+#include opt_platform.h
+
 #include 

svn commit: r208615 - head/sys/dev/ofw

2010-05-28 Thread Rafal Jaworowski
Author: raj
Date: Fri May 28 10:51:44 2010
New Revision: 208615
URL: http://svn.freebsd.org/changeset/base/208615

Log:
  Initial implementation of the OFW i/f methods for FDT back-end.
  
  Reviewed by:  imp
  Sponsored by: The FreeBSD Foundation

Added:
  head/sys/dev/ofw/ofw_fdt.c   (contents, props changed)

Added: head/sys/dev/ofw/ofw_fdt.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/ofw/ofw_fdt.c  Fri May 28 10:51:44 2010(r208615)
@@ -0,0 +1,458 @@
+/*-
+ * Copyright (c) 2009-2010 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Semihalf under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+#include sys/param.h
+#include sys/kernel.h
+#include sys/malloc.h
+#include sys/systm.h
+
+#include contrib/libfdt/libfdt.h
+
+#include machine/stdarg.h
+
+#include dev/fdt/fdt_common.h
+#include dev/ofw/ofwvar.h
+#include dev/ofw/openfirm.h
+
+#include ofw_if.h
+
+#ifdef DEBUG
+#define debugf(fmt, args...) do { printf(%s(): , __func__);  \
+printf(fmt,##args); } while (0)
+#else
+#define debugf(fmt, args...)
+#endif
+
+static int ofw_fdt_init(ofw_t, void *);
+static phandle_t ofw_fdt_peer(ofw_t, phandle_t);
+static phandle_t ofw_fdt_child(ofw_t, phandle_t);
+static phandle_t ofw_fdt_parent(ofw_t, phandle_t);
+static phandle_t ofw_fdt_instance_to_package(ofw_t, ihandle_t);
+static ssize_t ofw_fdt_getproplen(ofw_t, phandle_t, const char *);
+static ssize_t ofw_fdt_getprop(ofw_t, phandle_t, const char *, void *, size_t);
+static int ofw_fdt_nextprop(ofw_t, phandle_t, const char *, char *, size_t);
+static int ofw_fdt_setprop(ofw_t, phandle_t, const char *, const void *,
+size_t);
+static ssize_t ofw_fdt_canon(ofw_t, const char *, char *, size_t);
+static phandle_t ofw_fdt_finddevice(ofw_t, const char *);
+static ssize_t ofw_fdt_instance_to_path(ofw_t, ihandle_t, char *, size_t);
+static ssize_t ofw_fdt_package_to_path(ofw_t, phandle_t, char *, size_t);
+static int ofw_fdt_interpret(ofw_t, const char *, int, unsigned long *);
+
+static ofw_method_t ofw_fdt_methods[] = {
+   OFWMETHOD(ofw_init, ofw_fdt_init),
+   OFWMETHOD(ofw_peer, ofw_fdt_peer),
+   OFWMETHOD(ofw_child,ofw_fdt_child),
+   OFWMETHOD(ofw_parent,   ofw_fdt_parent),
+   OFWMETHOD(ofw_instance_to_package,  ofw_fdt_instance_to_package),
+   OFWMETHOD(ofw_getproplen,   ofw_fdt_getproplen),
+   OFWMETHOD(ofw_getprop,  ofw_fdt_getprop),
+   OFWMETHOD(ofw_nextprop, ofw_fdt_nextprop),
+   OFWMETHOD(ofw_setprop,  ofw_fdt_setprop),
+   OFWMETHOD(ofw_canon,ofw_fdt_canon),
+   OFWMETHOD(ofw_finddevice,   ofw_fdt_finddevice),
+   OFWMETHOD(ofw_instance_to_path, ofw_fdt_instance_to_path),
+   OFWMETHOD(ofw_package_to_path,  ofw_fdt_package_to_path),
+   OFWMETHOD(ofw_interpret,ofw_fdt_interpret),
+   { 0, 0 }
+};
+
+static ofw_def_t ofw_fdt = {
+   OFW_FDT,
+   ofw_fdt_methods,
+   0
+};
+OFW_DEF(ofw_fdt);
+
+static void *fdtp = NULL;
+
+static int
+ofw_fdt_init(ofw_t ofw, void *data)
+{
+   int err;
+
+   /* Check FDT blob integrity */
+   if ((err = fdt_check_header(data)) != 0)
+   return (err);
+
+   fdtp = data;
+   return (0);
+}
+
+/*
+ * Device tree functions
+ */
+
+static int
+fdt_phandle_offset(phandle_t p)
+{
+   const char *dt_struct;
+   

svn commit: r208559 - head/share/mk

2010-05-26 Thread Rafal Jaworowski
Author: raj
Date: Wed May 26 09:23:51 2010
New Revision: 208559
URL: http://svn.freebsd.org/changeset/base/208559

Log:
  Use MACHINE_ARCH instead of TARGET_ARCH.
  
  Pointed out by:   imp

Modified:
  head/share/mk/bsd.own.mk

Modified: head/share/mk/bsd.own.mk
==
--- head/share/mk/bsd.own.mkWed May 26 04:14:29 2010(r208558)
+++ head/share/mk/bsd.own.mkWed May 26 09:23:51 2010(r208559)
@@ -279,8 +279,7 @@ WITH_IDEA=
 .endif
 
 # Enable FDT by default for selected platforms.
-.if defined(TARGET_ARCH)  \
-   (${TARGET_ARCH} == arm || ${TARGET_ARCH} == powerpc)
+.if ${MACHINE_ARCH} == arm || ${MACHINE_ARCH} == powerpc
 # XXX this is temporarily disabled until all FDT support code is in place.
 #_fdt= FDT
 _no_fdt= FDT
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r208560 - head/sys/boot/fdt/dts

2010-05-26 Thread Rafal Jaworowski
Author: raj
Date: Wed May 26 09:34:02 2010
New Revision: 208560
URL: http://svn.freebsd.org/changeset/base/208560

Log:
  Import device tree source (DTS) files for PowerPC MPC8555CDS and MPC8572DS
  development systems.
  
  Special thanks to Phil Brownfield for help with BSD-style relicensing of
  these files.
  
  Obtained from:Freescale

Added:
  head/sys/boot/fdt/dts/
  head/sys/boot/fdt/dts/mpc8555cds.dts   (contents, props changed)
  head/sys/boot/fdt/dts/mpc8572ds.dts   (contents, props changed)

Added: head/sys/boot/fdt/dts/mpc8555cds.dts
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/boot/fdt/dts/mpc8555cds.dtsWed May 26 09:34:02 2010
(r208560)
@@ -0,0 +1,442 @@
+/*
+ * MPC8555 CDS Device Tree Source
+ *
+ * Copyright 2006, 2008 Freescale Semiconductor Inc. All rights reserved
+ *
+ * Neither the name of Freescale Semiconductor, Inc nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Freescale hereby publishes it under the following licenses:
+ *
+ *   BSD License
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ *   GNU General Public License, version 2
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * You may select the license of your choice.
+ *--
+ *
+ * $FreeBSD$
+ */
+
+/dts-v1/;
+
+/ {
+   model = MPC8555CDS;
+   compatible = MPC8555CDS, MPC85xxCDS;
+   #address-cells = 1;
+   #size-cells = 1;
+
+   aliases {
+   ethernet0 = enet0;
+   ethernet1 = enet1;
+   serial0 = serial0;
+   serial1 = serial1;
+   pci0 = pci0;
+   pci1 = pci1;
+   };
+
+   cpus {
+   #address-cells = 1;
+   #size-cells = 0;
+
+   PowerPC,8...@0 {
+   device_type = cpu;
+   reg = 0x0;
+   d-cache-line-size = 32;   // 32 bytes
+   i-cache-line-size = 32;   // 32 bytes
+   d-cache-size = 0x8000;// L1, 32K
+   i-cache-size = 0x8000;// L1, 32K
+   timebase-frequency = 0;   //  33 MHz, from uboot
+   bus-frequency = 0;// 166 MHz
+   clock-frequency = 0;  // 825 MHz, from uboot
+   next-level-cache = L2;
+   };
+   };
+
+   memory {
+   device_type = memory;
+   reg = 0x0 0x800;  // 128M at 0x0
+   };
+
+   local...@e0005000 {
+   #address-cells = 2;
+   #size-cells = 1;

svn commit: r208561 - head/sys/boot/fdt/dts

2010-05-26 Thread Rafal Jaworowski
Author: raj
Date: Wed May 26 09:50:09 2010
New Revision: 208561
URL: http://svn.freebsd.org/changeset/base/208561

Log:
  Initial device tree source (DTS) files for Marvell ARM systems:
  
o DB-88F5182
o DB-88F5281
o DB-88F6281
o DB-78100
o SheevaPlug
  
  This also includes device tree bindings definitions for some newly introduced
  nodes (mpp, gpio).
  
  Reviewed by:  imp
  Sponsored by: The FreeBSD Foundation

Added:
  head/sys/boot/fdt/dts/bindings-gpio.txt   (contents, props changed)
  head/sys/boot/fdt/dts/bindings-mpp.txt   (contents, props changed)
  head/sys/boot/fdt/dts/db78100.dts   (contents, props changed)
  head/sys/boot/fdt/dts/db88f5182.dts   (contents, props changed)
  head/sys/boot/fdt/dts/db88f5281.dts   (contents, props changed)
  head/sys/boot/fdt/dts/db88f6281.dts   (contents, props changed)
  head/sys/boot/fdt/dts/sheevaplug.dts   (contents, props changed)

Added: head/sys/boot/fdt/dts/bindings-gpio.txt
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/boot/fdt/dts/bindings-gpio.txt Wed May 26 09:50:09 2010
(r208561)
@@ -0,0 +1,101 @@
+$FreeBSD$
+
+GPIO configuration.
+===
+
+1. Properties for GPIO Controllers
+
+1.1 #gpio-cells
+
+Property:  #gpio-cells
+
+Value type:u32
+
+Description:   The #gpio-cells property defines the number of cells required
+   to encode a gpio specifier.
+
+
+1.2 gpio-controller
+
+Property:  gpio-controller
+
+Value type:empty
+
+Description:   The presence of a gpio-controller property defines a node as a
+   GPIO controller node.
+
+
+1.3 pin-count
+
+Property:  pin-count
+
+Value type:u32
+
+Description:   The pin-count property defines the number of GPIO pins.
+
+
+1.4 Example
+
+   GPIO: g...@10100 {
+   #gpio-cells = 3;
+   compatible = mrvl,gpio;
+   reg = 0x10100 0x20;
+   gpio-controller;
+   interrupts = 6 7 8 9;
+   interrupt-parent = PIC;
+   pin-count = 50
+   };
+
+2. Properties for GPIO consumer nodes.
+
+2.1 gpios
+
+Property:  gpios
+
+Value type:prop-encoded-array encoded as arbitrary number of GPIO
+   specifiers.
+
+Description:   The gpios property of a device node defines the GPIO or GPIOs
+   that are used by the device. The value of the gpios property
+   consists of an arbitrary number of GPIO specifiers.
+   
+   The first cell of the GPIO specifier is phandle of the node's
+   parent GPIO controller and remaining cells are defined by the
+   binding describing the GPIO parent, typically include
+   information like pin number, direction and various flags.
+
+Example:
+   gpios = GPIO 0 1 0/* GPIO[0]:  IN,  NONE */
+GPIO 1 2 0;  /* GPIO[1]:  OUT, NONE */
+
+
+3. mrvl,gpio controller GPIO specifier
+
+   phandle pin dir flags
+
+
+pin:   0-MAX   GPIO pin number.
+
+dir:
+   1   IN  Input direction.
+   2   OUT Output direction.
+
+flags:
+   0x  IN_NONE
+   0x0001  IN_POL_LOW  Polarity low (inverted input value.
+   0x0002  IN_IRQ_EDGE Interrupt, edge triggered.
+   0x0004  IN_IRQ_LEVELInterrupt, level triggered.
+   
+   0x  OUT_NONE
+   0x0001  OUT_BLINK   Blink on the pin.
+   0x0002  OUT_OPEN_DRAIN  Open drain output line.
+   0x0004  OUT_OPEN_SRCOpen source output line.
+
+
+Example:
+   gpios = GPIO 0  1 0x  /* GPIO[0]:   IN */
+GPIO 1  2 0x  /* GPIO[1]:   OUT */
+GPIO 2  1 0x0002  /* GPIO[2]:   IN, IRQ (edge) */
+GPIO 3  1 0x0004  /* GPIO[3]:   IN, IRQ (level) */
+...
+GPIO 10 2 0x0001;/* GPIO[10]:  OUT, blink */

Added: head/sys/boot/fdt/dts/bindings-mpp.txt
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/boot/fdt/dts/bindings-mpp.txt  Wed May 26 09:50:09 2010
(r208561)
@@ -0,0 +1,50 @@
+$FreeBSD$
+
+* Multi purpose pin (MPP) configuration.
+
+Required properties:
+
+- pin-map : array of pin configurations. Each pin is defined by 2 cells,
+  respectively: pin function. Pins not specified in the pin-map property
+  are assumed to have default value of function = 0, which means GPIO.
+
+  - pin : pin number.
+
+  - function : function ID of the pin according to the assignment tables in
+User Manual. Each pin can have many possible functions depending on the
+MPP unit incarnation.
+
+- 

svn commit: r208534 - in head/sys/boot/uboot: common lib

2010-05-25 Thread Rafal Jaworowski
Author: raj
Date: Tue May 25 09:59:53 2010
New Revision: 208534
URL: http://svn.freebsd.org/changeset/base/208534

Log:
  Use loader devices only when they initialized properly.

Modified:
  head/sys/boot/uboot/common/main.c
  head/sys/boot/uboot/lib/disk.c

Modified: head/sys/boot/uboot/common/main.c
==
--- head/sys/boot/uboot/common/main.c   Tue May 25 05:45:16 2010
(r208533)
+++ head/sys/boot/uboot/common/main.c   Tue May 25 09:59:53 2010
(r208534)
@@ -157,20 +157,22 @@ main(void)
panic(no U-Boot devices found);
printf(Number of U-Boot devices: %d\n, devs_no);
 
-   /*
-* March through the device switch probing for things.
-*/
-   for (i = 0; devsw[i] != NULL; i++)
-   if (devsw[i]-dv_init != NULL)
-   (devsw[i]-dv_init)();
-
printf(\n);
printf(%s, Revision %s\n, bootprog_name, bootprog_rev);
printf((%s, %s)\n, bootprog_maker, bootprog_date);
meminfo();
 
+   /*
+* March through the device switch probing for things.
+*/
for (i = 0; devsw[i] != NULL; i++) {
-   printf(\nDevice %d: %s\n, i, devsw[i]-dv_name);
+
+   if (devsw[i]-dv_init == NULL)
+   continue;
+   if ((devsw[i]-dv_init)() != 0)
+   continue;
+
+   printf(\nDevice: %s\n, devsw[i]-dv_name);
 
currdev.d_dev = devsw[i];
currdev.d_type = currdev.d_dev-dv_type;

Modified: head/sys/boot/uboot/lib/disk.c
==
--- head/sys/boot/uboot/lib/disk.c  Tue May 25 05:45:16 2010
(r208533)
+++ head/sys/boot/uboot/lib/disk.c  Tue May 25 09:59:53 2010
(r208534)
@@ -157,7 +157,7 @@ stor_init(void)
}
 
if (!found) {
-   printf(No storage devices\n);
+   debugf(No storage devices\n);
return (-1);
}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r208535 - head/sys/boot/uboot/lib

2010-05-25 Thread Rafal Jaworowski
Author: raj
Date: Tue May 25 10:15:30 2010
New Revision: 208535
URL: http://svn.freebsd.org/changeset/base/208535

Log:
  Mostly revert r200691. U-Boot syscall() entry point returns 1 on success.

Modified:
  head/sys/boot/uboot/lib/glue.c

Modified: head/sys/boot/uboot/lib/glue.c
==
--- head/sys/boot/uboot/lib/glue.c  Tue May 25 09:59:53 2010
(r208534)
+++ head/sys/boot/uboot/lib/glue.c  Tue May 25 10:15:30 2010
(r208535)
@@ -574,7 +574,7 @@ ub_env_enum(const char *last)
 * internally, which handles such case
 */
env = NULL;
-   if (syscall(API_ENV_ENUM, NULL, (uint32_t)last, (uint32_t)env) != 0)
+   if (!syscall(API_ENV_ENUM, NULL, (uint32_t)last, (uint32_t)env))
return (NULL);
 
if (env == NULL)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r208536 - head/gnu/usr.bin/dtc

2010-05-25 Thread Rafal Jaworowski
Author: raj
Date: Tue May 25 13:27:55 2010
New Revision: 208536
URL: http://svn.freebsd.org/changeset/base/208536

Log:
  Correct dtc version header autogen location.
  
  While there unify brackets usage.

Modified:
  head/gnu/usr.bin/dtc/Makefile

Modified: head/gnu/usr.bin/dtc/Makefile
==
--- head/gnu/usr.bin/dtc/Makefile   Tue May 25 10:15:30 2010
(r208535)
+++ head/gnu/usr.bin/dtc/Makefile   Tue May 25 13:27:55 2010
(r208536)
@@ -11,18 +11,18 @@ PROG=   dtc
 SRCS=  dtc.c checks.c fstree.c livetree.c treesource.c data.c \
flattree.c srcpos.c util.c \
fdt.c fdt_ro.c fdt_rw.c fdt_strerror.c \
-   fdt_sw.c fdt_wip.c $(DTCDIR)/version_gen.h
+   fdt_sw.c fdt_wip.c ${DTCVERSIONFILE}
 
 CFLAGS = -Wall -g -Os -fPIC -Wpointer-arith -Wcast-qual
 CFLAGS+= -I. -I${.CURDIR} -I${DTCDIR} -I${LIBFDTDIR}
 
-VERSIONMAJ!= awk '/^VERSION =/ { print $$3 }' $(DTCDIR)/Makefile
-VERSIONMIN!= awk '/^PATCHLEVEL =/ { print $$3 }' $(DTCDIR)/Makefile
-VERSIONSUB!= awk '/^SUBLEVEL =/ { print $$3 }' $(DTCDIR)/Makefile
-VERSIONEXTRA!= $(DTCDIR)/scripts/setlocalversion
+VERSIONMAJ!= awk '/^VERSION =/ { print $$3 }' ${DTCDIR}/Makefile
+VERSIONMIN!= awk '/^PATCHLEVEL =/ { print $$3 }' ${DTCDIR}/Makefile
+VERSIONSUB!= awk '/^SUBLEVEL =/ { print $$3 }' ${DTCDIR}/Makefile
+VERSIONEXTRA=
 
 DTCVERSION:=   ${VERSIONMAJ}.${VERSIONMIN}.${VERSIONSUB}${VERSIONEXTRA}
-DTCVERSIONFILE:=   $(DTCDIR)/version_gen.h
+DTCVERSIONFILE:=   version_gen.h
 
 MAN=
 
@@ -34,18 +34,18 @@ OBJS+= dtc-parser.tab.o dtc-lexer.lex.o
 CLEANFILES+= dtc-parser.tab.o dtc-lexer.lex.o dtc-parser.tab.c \
dtc-parser.tab.h dtc-lexer.lex.c ${DTCVERSIONFILE}
 
-$(DTCVERSIONFILE):
+${DTCVERSIONFILE}:
@echo '#define DTC_VERSION DTC ${DTCVERSION}'  ${DTCVERSIONFILE}
 
 dtc-parser.tab.o:  dtc-parser.tab.c dtc-parser.tab.h
 dtc-lexer.lex.o:   dtc-lexer.lex.c dtc-parser.tab.h
 
 dtc-parser.tab.c:  dtc-parser.y
-   $(BISON) -o$@ -d $(DTCDIR)/dtc-parser.y
+   ${BISON} -o$@ -d ${DTCDIR}/dtc-parser.y
 
 dtc-parser.tab.h:  dtc-parser.tab.c
 
 dtc-lexer.lex.c: dtc-lexer.l
-   $(LEX) -o$@ $(DTCDIR)/dtc-lexer.l
+   ${LEX} -o$@ ${DTCDIR}/dtc-lexer.l
 
 .include bsd.prog.mk
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r208537 - in head: share/mk tools/build/options

2010-05-25 Thread Rafal Jaworowski
Author: raj
Date: Tue May 25 15:12:21 2010
New Revision: 208537
URL: http://svn.freebsd.org/changeset/base/208537

Log:
  Introduce a new build knob for Flattened Device Tree support.
  
  Reviewed by:  imp
  Sponsored by: The FreeBSD Foundation

Added:
  head/tools/build/options/WITH_FDT   (contents, props changed)
Modified:
  head/share/mk/bsd.own.mk

Modified: head/share/mk/bsd.own.mk
==
--- head/share/mk/bsd.own.mkTue May 25 13:27:55 2010(r208536)
+++ head/share/mk/bsd.own.mkTue May 25 15:12:21 2010(r208537)
@@ -278,6 +278,16 @@ WITH_HESIOD=
 WITH_IDEA=
 .endif
 
+# Enable FDT by default for selected platforms.
+.if defined(TARGET_ARCH)  \
+   (${TARGET_ARCH} == arm || ${TARGET_ARCH} == powerpc)
+# XXX this is temporarily disabled until all FDT support code is in place.
+#_fdt= FDT
+_no_fdt= FDT
+.else
+_no_fdt= FDT
+.endif
+
 #
 # MK_* options which default to yes.
 #
@@ -313,6 +323,7 @@ WITH_IDEA=
 DICT \
 DYNAMICROOT \
 EXAMPLES \
+${_fdt} \
 FLOPPY \
 FORTH \
 FP_LIBC \
@@ -407,6 +418,7 @@ MK_${var}:= yes
 BIND_LIBS \
 BIND_SIGCHASE \
 BIND_XML \
+${_no_fdt} \
 HESIOD \
 IDEA
 .if defined(WITH_${var})  defined(WITHOUT_${var})

Added: head/tools/build/options/WITH_FDT
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/build/options/WITH_FDT   Tue May 25 15:12:21 2010
(r208537)
@@ -0,0 +1,3 @@
+.\ $FreeBSD$
+Set to build Flattened Device Tree support as part of the base system. This
+includes the device tree compiler (dtc) and libfdt support library.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r208538 - in head/sys: arm/include boot/arm/uboot boot/fdt boot/powerpc/uboot boot/uboot/common boot/uboot/lib powerpc/include

2010-05-25 Thread Rafal Jaworowski
Author: raj
Date: Tue May 25 15:21:39 2010
New Revision: 208538
URL: http://svn.freebsd.org/changeset/base/208538

Log:
  Initial loader(8) support for Flattened Device Tree.
  
  o This is disabled by default for now, and can be enabled using WITH_FDT at
build time.
  
  o Tested with ARM and PowerPC.
  
  Reviewed by:  imp
  Sponsored by: The FreeBSD Foundation

Added:
  head/sys/boot/fdt/
  head/sys/boot/fdt/Makefile   (contents, props changed)
  head/sys/boot/fdt/fdt_loader_cmd.c   (contents, props changed)
Modified:
  head/sys/arm/include/metadata.h
  head/sys/boot/arm/uboot/Makefile
  head/sys/boot/arm/uboot/version
  head/sys/boot/powerpc/uboot/Makefile
  head/sys/boot/powerpc/uboot/version
  head/sys/boot/uboot/common/main.c
  head/sys/boot/uboot/common/metadata.c
  head/sys/boot/uboot/lib/Makefile
  head/sys/powerpc/include/metadata.h

Modified: head/sys/arm/include/metadata.h
==
--- head/sys/arm/include/metadata.h Tue May 25 15:12:21 2010
(r208537)
+++ head/sys/arm/include/metadata.h Tue May 25 15:21:39 2010
(r208538)
@@ -30,5 +30,6 @@
 #define_MACHINE_METADATA_H_
 
 #defineMODINFOMD_BOOTINFO  0x1001
+#defineMODINFOMD_DTBP  0x1002
 
 #endif /* !_MACHINE_METADATA_H_ */

Modified: head/sys/boot/arm/uboot/Makefile
==
--- head/sys/boot/arm/uboot/MakefileTue May 25 15:12:21 2010
(r208537)
+++ head/sys/boot/arm/uboot/MakefileTue May 25 15:21:39 2010
(r208538)
@@ -18,6 +18,11 @@ LOADER_NFS_SUPPORT?= yes
 LOADER_TFTP_SUPPORT?=  no
 LOADER_GZIP_SUPPORT?=  no
 LOADER_BZIP2_SUPPORT?= no
+.if defined(WITH_FDT)
+LOADER_FDT_SUPPORT=yes
+.else
+LOADER_FDT_SUPPORT=no
+.endif
 
 .if ${LOADER_DISK_SUPPORT} == yes
 CFLAGS+=   -DLOADER_DISK_SUPPORT
@@ -46,6 +51,12 @@ CFLAGS+= -DLOADER_NFS_SUPPORT
 .if ${LOADER_TFTP_SUPPORT} == yes
 CFLAGS+=   -DLOADER_TFTP_SUPPORT
 .endif
+.if ${LOADER_FDT_SUPPORT} == yes
+CFLAGS+=   -I${.CURDIR}/../../fdt
+CFLAGS+=   -I${.OBJDIR}/../../fdt
+CFLAGS+=   -DLOADER_FDT_SUPPORT
+LIBFDT=${.OBJDIR}/../../fdt/libfdt.a
+.endif
 
 .if !defined(NO_FORTH)
 # Enable BootForth
@@ -79,8 +90,8 @@ CFLAGS+=  -I${.OBJDIR}/../../uboot/lib
 # where to get libstand from
 CFLAGS+=   -I${.CURDIR}/../../../../lib/libstand/
 
-DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBSTAND}
-LDADD= ${LIBFICL} ${LIBUBOOT} -lstand
+DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBSTAND}
+LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} -lstand
 
 vers.c:${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}

Modified: head/sys/boot/arm/uboot/version
==
--- head/sys/boot/arm/uboot/version Tue May 25 15:12:21 2010
(r208537)
+++ head/sys/boot/arm/uboot/version Tue May 25 15:21:39 2010
(r208538)
@@ -3,5 +3,6 @@ $FreeBSD$
 NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE.  The format of this
 file is important.  Make sure the current version number is on line 6.
 
+1.1:   Flattened Device Tree blob support.
 1.0:   Added storage support. Booting from HDD, USB, etc. is now possible.
 0.5:   Initial U-Boot/arm version (netbooting only).

Added: head/sys/boot/fdt/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/boot/fdt/Makefile  Tue May 25 15:21:39 2010(r208538)
@@ -0,0 +1,25 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../contrib/libfdt/
+
+LIB=   fdt
+INTERNALLIB=
+
+# Vendor sources of libfdt.
+SRCS+= fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c
+
+# Loader's fdt commands extension sources.
+SRCS+= fdt_loader_cmd.c
+
+CFLAGS+=   -I${.CURDIR}/../../contrib/libfdt/ -I${.CURDIR}/../common/ \
+   -I${.CURDIR}/../uboot/lib
+
+CFLAGS+=   -ffreestanding
+
+.if ${MACHINE_ARCH} == powerpc || ${MACHINE_ARCH} == arm
+CFLAGS+=   -msoft-float
+.endif
+
+CFLAGS+=   -Wformat -Wall
+
+.include bsd.lib.mk

Added: head/sys/boot/fdt/fdt_loader_cmd.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/boot/fdt/fdt_loader_cmd.c  Tue May 25 15:21:39 2010
(r208538)
@@ -0,0 +1,1290 @@
+/*-
+ * Copyright (c) 2009-2010 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Semihalf under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must 

svn commit: r208539 - head/sys/boot

2010-05-25 Thread Rafal Jaworowski
Author: raj
Date: Tue May 25 15:32:07 2010
New Revision: 208539
URL: http://svn.freebsd.org/changeset/base/208539

Log:
  Bring a missing FDT piece (omitted in the previous commit).

Modified:
  head/sys/boot/Makefile

Modified: head/sys/boot/Makefile
==
--- head/sys/boot/Makefile  Tue May 25 15:21:39 2010(r208538)
+++ head/sys/boot/Makefile  Tue May 25 15:32:07 2010(r208539)
@@ -26,6 +26,10 @@ SUBDIR+= uboot
 SUBDIR+=   zfs
 .endif
 
+.if ${MK_FDT} != no
+SUBDIR+=   fdt
+.endif
+
 # Pick the machine-dependent subdir based on the target architecture.
 ADIR=  ${MACHINE:S/amd64/i386/:S/sun4v/sparc64/}
 .if exists(${.CURDIR}/${ADIR}/.)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r208278 - head/sys/powerpc/include

2010-05-18 Thread Rafal Jaworowski
Author: raj
Date: Tue May 18 21:23:51 2010
New Revision: 208278
URL: http://svn.freebsd.org/changeset/base/208278

Log:
  Provide missing members for Book-E pmap (and fix build).

Modified:
  head/sys/powerpc/include/pmap.h

Modified: head/sys/powerpc/include/pmap.h
==
--- head/sys/powerpc/include/pmap.h Tue May 18 21:01:42 2010
(r208277)
+++ head/sys/powerpc/include/pmap.h Tue May 18 21:23:51 2010
(r208278)
@@ -125,6 +125,8 @@ struct pmap {
struct mtx  pm_mtx; /* pmap mutex */
tlbtid_tpm_tid[MAXCPU]; /* TID to identify this pmap 
entries in TLB */
u_int   pm_active;  /* active on cpus */
+   uint32_tpm_gen_count;   /* generation count (pmap lock 
dropped) */
+   u_int   pm_retries;
int pm_refs;/* ref count */
struct pmap_statistics  pm_stats;   /* pmap statistics */
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205278 - stable/8/sys/arm/arm

2010-03-18 Thread Rafal Jaworowski
Author: raj
Date: Thu Mar 18 11:53:32 2010
New Revision: 205278
URL: http://svn.freebsd.org/changeset/base/205278

Log:
  MFC r205027
  
  Let detailed info about CPU features print on Marvell Sheeva CPU as well.
  
  Provide missing entry in the cpu_classes[].
  
  Reported by:  Maks Verver

Modified:
  stable/8/sys/arm/arm/identcpu.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/arm/arm/identcpu.c
==
--- stable/8/sys/arm/arm/identcpu.c Thu Mar 18 11:06:38 2010
(r205277)
+++ stable/8/sys/arm/arm/identcpu.c Thu Mar 18 11:53:32 2010
(r205278)
@@ -343,6 +343,7 @@ const struct cpu_classtab cpu_classes[] 
{ SA-1,   CPU_SA110 },  /* CPU_CLASS_SA1 */
{ XScale, CPU_XSCALE_... }, /* CPU_CLASS_XSCALE */
{ ARM11J, CPU_ARM11 },  /* CPU_CLASS_ARM11J */
+   { Marvell,CPU_MARVELL },/* CPU_CLASS_MARVELL */
 };
 
 /*
@@ -418,6 +419,7 @@ identify_arm_cpu(void)
case CPU_CLASS_SA1:
case CPU_CLASS_XSCALE:
case CPU_CLASS_ARM11J:
+   case CPU_CLASS_MARVELL:
if ((ctrl  CPU_CONTROL_DC_ENABLE) == 0)
printf( DC disabled);
else
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


  1   2   3   >