Re: svn commit: r368700 - head/sys/dev/e1000
On 16.12.2020 15:48, Jessica Clarke wrote: Author: jrtc27 Date: Wed Dec 16 14:48:46 2020 New Revision: 368700 URL: https://svnweb.freebsd.org/changeset/base/368700 Log: Fix whitespace in r368698 MFC with: r368698 I just started to be ashamed :( Thanks for fixing the bugs created by my tangled fingers. Michal Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c == --- head/sys/dev/e1000/if_em.c Wed Dec 16 14:47:49 2020(r368699) +++ head/sys/dev/e1000/if_em.c Wed Dec 16 14:48:46 2020(r368700) @@ -847,7 +847,7 @@ em_if_attach_pre(if_ctx_t ctx) ** use a different BAR, so we need to keep ** track of which is used. */ - scctx->isc_msix_bar = pci_msix_table_bar(dev); + scctx->isc_msix_bar = pci_msix_table_bar(dev); } else if (adapter->hw.mac.type >= em_mac_min) { scctx->isc_txqsizes[0] = roundup2(scctx->isc_ntxd[0]* sizeof(struct e1000_tx_desc), EM_DBA_ALIGN); scctx->isc_rxqsizes[0] = roundup2(scctx->isc_nrxd[0] * sizeof(union e1000_rx_desc_extended), EM_DBA_ALIGN); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368698 - head/sys/dev/e1000
Author: mmel Date: Wed Dec 16 14:39:24 2020 New Revision: 368698 URL: https://svnweb.freebsd.org/changeset/base/368698 Log: Use the standard method for localizing of MSI-X table bar. Current way, hardcoded value plus heuristic is not conform to the PCI(e) specification and it fails on systems where MSI-X bar is not initialized by BIOS/ACPI (many arm or arm64 systems for example). Instead, use the standard PCI(e) capability for determining of MSIX table bar address. MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D27265 Modified: head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_em.h Modified: head/sys/dev/e1000/if_em.c == --- head/sys/dev/e1000/if_em.c Wed Dec 16 14:36:57 2020(r368697) +++ head/sys/dev/e1000/if_em.c Wed Dec 16 14:39:24 2020(r368698) @@ -847,9 +847,7 @@ em_if_attach_pre(if_ctx_t ctx) ** use a different BAR, so we need to keep ** track of which is used. */ - scctx->isc_msix_bar = PCIR_BAR(EM_MSIX_BAR); - if (pci_read_config(dev, scctx->isc_msix_bar, 4) == 0) - scctx->isc_msix_bar += 4; + scctx->isc_msix_bar = pci_msix_table_bar(dev); } else if (adapter->hw.mac.type >= em_mac_min) { scctx->isc_txqsizes[0] = roundup2(scctx->isc_ntxd[0]* sizeof(struct e1000_tx_desc), EM_DBA_ALIGN); scctx->isc_rxqsizes[0] = roundup2(scctx->isc_nrxd[0] * sizeof(union e1000_rx_desc_extended), EM_DBA_ALIGN); @@ -883,7 +881,7 @@ em_if_attach_pre(if_ctx_t ctx) * that it shall give MSI at least a try with other devices. */ if (adapter->hw.mac.type == e1000_82574) { - scctx->isc_msix_bar = PCIR_BAR(EM_MSIX_BAR); + scctx->isc_msix_bar = pci_msix_table_bar(dev);; } else { scctx->isc_msix_bar = -1; scctx->isc_disable_msix = 1; Modified: head/sys/dev/e1000/if_em.h == --- head/sys/dev/e1000/if_em.h Wed Dec 16 14:36:57 2020(r368697) +++ head/sys/dev/e1000/if_em.h Wed Dec 16 14:39:24 2020(r368698) @@ -316,7 +316,6 @@ #define EM_BAR_MEM_TYPE_MASK 0x0006 #define EM_BAR_MEM_TYPE_32BIT 0x #define EM_BAR_MEM_TYPE_64BIT 0x0004 -#define EM_MSIX_BAR3 /* On 82575 */ /* More backward compatibility */ #if __FreeBSD_version < 90 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368697 - head/sys/arm64/arm64
Author: mmel Date: Wed Dec 16 14:36:57 2020 New Revision: 368697 URL: https://svnweb.freebsd.org/changeset/base/368697 Log: Allocate right number of pages for the bounced buffers crossing the page. One of the disadvantages of our current busdma code is the fact that we process the bounced buffer in a page-by-page manner. This means that the short (subpage) buffer allocated across page boundaries is bounced to 2 separate pages. This suboptimal behavior is consistent across all platforms and can be related to (probably unimplementable or incompatible with bouncing) BUS_DMA_KEEP_PG_OFFSET flag. Therefore, allocate one additional page to be fully comply with this requirement. Discused with:markj PR: 251018 Modified: head/sys/arm64/arm64/busdma_bounce.c Modified: head/sys/arm64/arm64/busdma_bounce.c == --- head/sys/arm64/arm64/busdma_bounce.cWed Dec 16 14:01:04 2020 (r368696) +++ head/sys/arm64/arm64/busdma_bounce.cWed Dec 16 14:36:57 2020 (r368697) @@ -297,6 +297,12 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_si if ((flags & BUS_DMA_ALLOCNOW) != 0) { struct bounce_zone *bz; + /* +* Round size up to a full page, and add one more page because +* there can always be one more boundary crossing than the +* number of pages in a transfer. +*/ + maxsize = roundup2(maxsize, PAGE_SIZE) + PAGE_SIZE; /* Must bounce */ if ((error = alloc_bounce_zone(newtag)) != 0) { @@ -308,7 +314,7 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_si if (ptoa(bz->total_bpages) < maxsize) { int pages; - pages = atop(round_page(maxsize)) - bz->total_bpages; + pages = atop(maxsize) + 1 - bz->total_bpages; /* Add pages to our bounce pool */ if (alloc_bounce_pages(newtag, pages) < pages) @@ -436,8 +442,10 @@ bounce_bus_dmamap_create(bus_dma_tag_t dmat, int flags bz = dmat->bounce_zone; /* -* Attempt to add pages to our pool on a per-instance -* basis up to a sane limit. +* Attempt to add pages to our pool on a per-instancebasis up to a sane +* limit. Even if the tag isn't subject of bouncing due to alignment +* and boundary constraints, it could still auto-bounce due to +* cacheline alignment, which requires at most two bounce pages. */ if (dmat->common.alignment > 1) maxpages = MAX_BPAGES; @@ -446,9 +454,9 @@ bounce_bus_dmamap_create(bus_dma_tag_t dmat, int flags atop(dmat->common.lowaddr)); if ((dmat->bounce_flags & BF_MIN_ALLOC_COMP) == 0 || (bz->map_count > 0 && bz->total_bpages < maxpages)) { - pages = MAX(atop(dmat->common.maxsize), 1); + pages = atop(roundup2(dmat->common.maxsize, PAGE_SIZE)) + 1; pages = MIN(maxpages - bz->total_bpages, pages); - pages = MAX(pages, 1); + pages = MAX(pages, 2); if (alloc_bounce_pages(dmat, pages) < pages) error = ENOMEM; if ((dmat->bounce_flags & BF_MIN_ALLOC_COMP) == 0) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368635 - in head/sys/arm: arm include
Author: mmel Date: Mon Dec 14 14:00:54 2020 New Revision: 368635 URL: https://svnweb.freebsd.org/changeset/base/368635 Log: Remove unused functions and variables in cpufunc.[ch]. Modified: head/sys/arm/arm/cpufunc.c head/sys/arm/arm/cpufunc_asm.S head/sys/arm/include/cpufunc.h head/sys/arm/include/machdep.h Modified: head/sys/arm/arm/cpufunc.c == --- head/sys/arm/arm/cpufunc.c Mon Dec 14 13:10:19 2020(r368634) +++ head/sys/arm/arm/cpufunc.c Mon Dec 14 14:00:54 2020(r368635) @@ -62,24 +62,10 @@ __FBSDID("$FreeBSD$"); #include /* PRIMARY CACHE VARIABLES */ -intarm_picache_size; -intarm_picache_line_size; -intarm_picache_ways; -intarm_pdcache_size; /* and unified */ -intarm_pdcache_line_size; -intarm_pdcache_ways; - -intarm_pcache_type; -intarm_pcache_unified; - intarm_dcache_align; intarm_dcache_align_mask; -u_int arm_cache_level; -u_int arm_cache_type[14]; -u_int arm_cache_loc; - #ifdef CPU_MV_PJ4B static void pj4bv7_setup(void); #endif @@ -155,16 +141,10 @@ u_int cputype; static void get_cachetype_cp15(void); -/* Additional cache information local to this file. Log2 of some of the - above numbers. */ -static int arm_dcache_l2_nsets; -static int arm_dcache_l2_assoc; -static int arm_dcache_l2_linesize; - static void get_cachetype_cp15(void) { - u_int ctype, isize, dsize, cpuid; + u_int ctype, dsize, cpuid; u_int clevel, csize, i, sel; u_int multiplier; u_char type; @@ -184,8 +164,6 @@ get_cachetype_cp15(void) if (CPU_CT_FORMAT(ctype) == CPU_CT_ARMV7) { __asm __volatile("mrc p15, 1, %0, c0, c0, 1" : "=r" (clevel)); - arm_cache_level = clevel; - arm_cache_loc = CPU_CLIDR_LOC(arm_cache_level); i = 0; while ((type = (clevel & 0x7)) && i < 7) { if (type == CACHE_DCACHE || type == CACHE_UNI_CACHE || @@ -195,7 +173,6 @@ get_cachetype_cp15(void) : : "r" (sel)); __asm __volatile("mrc p15, 1, %0, c0, c0, 0" : "=r" (csize)); - arm_cache_type[sel] = csize; arm_dcache_align = 1 << (CPUV7_CT_xSIZE_LEN(csize) + 4); arm_dcache_align_mask = arm_dcache_align - 1; @@ -206,57 +183,22 @@ get_cachetype_cp15(void) : : "r" (sel)); __asm __volatile("mrc p15, 1, %0, c0, c0, 0" : "=r" (csize)); - arm_cache_type[sel] = csize; } i++; clevel >>= 3; } } else { - if ((ctype & CPU_CT_S) == 0) - arm_pcache_unified = 1; - /* * If you want to know how this code works, go read the ARM ARM. */ - arm_pcache_type = CPU_CT_CTYPE(ctype); - - if (arm_pcache_unified == 0) { - isize = CPU_CT_ISIZE(ctype); - multiplier = (isize & CPU_CT_xSIZE_M) ? 3 : 2; - arm_picache_line_size = 1U << (CPU_CT_xSIZE_LEN(isize) + 3); - if (CPU_CT_xSIZE_ASSOC(isize) == 0) { - if (isize & CPU_CT_xSIZE_M) - arm_picache_line_size = 0; /* not present */ - else - arm_picache_ways = 1; - } else { - arm_picache_ways = multiplier << - (CPU_CT_xSIZE_ASSOC(isize) - 1); - } - arm_picache_size = multiplier << (CPU_CT_xSIZE_SIZE(isize) + 8); - } - dsize = CPU_CT_DSIZE(ctype); multiplier = (dsize & CPU_CT_xSIZE_M) ? 3 : 2; - arm_pdcache_line_size = 1U << (CPU_CT_xSIZE_LEN(dsize) + 3); + arm_dcache_align = 1U << (CPU_CT_xSIZE_LEN(dsize) + 3); if (CPU_CT_xSIZE_ASSOC(dsize) == 0) { if (dsize & CPU_CT_xSIZE_M) - arm_pdcache_line_size = 0; /* not present */ - else - arm_pdcache_ways = 1; - } else { - arm_pdcache_ways = multiplier << - (CPU_CT_xSIZE_ASSOC(dsize) - 1); + arm_dcache_align = 0; /* not present */ } - arm_pdcache_size = multiplier << (CPU_CT_xSIZE_SIZE(dsize) + 8); - -
svn commit: r368634 - head/sys/arm/arm
Author: mmel Date: Mon Dec 14 13:10:19 2020 New Revision: 368634 URL: https://svnweb.freebsd.org/changeset/base/368634 Log: Finish implementation of ARM PMU interrupts. The ARM PMU may use single per-core interrupt or may use multiple generic interrupts, one per core. In this case, special attention must be paid to the correct identification of the physical location of the core, its order in the external database (FDT) and the associated cpuid. Also keep in mind that a SoC can have multiple different PMUs (usually one per cluster) Modified: head/sys/arm/arm/pmu.c Modified: head/sys/arm/arm/pmu.c == --- head/sys/arm/arm/pmu.c Mon Dec 14 11:57:43 2020(r368633) +++ head/sys/arm/arm/pmu.c Mon Dec 14 13:10:19 2020(r368634) @@ -60,33 +60,19 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef notyet #defineMAX_RLEN8 -#else -#defineMAX_RLEN1 -#endif +struct pmu_intr { + struct resource *res; + void*ih; + int cpuid; +}; + struct pmu_softc { - struct resource *res[MAX_RLEN]; device_tdev; - void*ih[MAX_RLEN]; + struct pmu_intr irq[MAX_RLEN]; }; -static struct resource_spec pmu_spec[] = { - { SYS_RES_IRQ, 0, RF_ACTIVE }, - /* We don't currently handle pmu events, other than on cpu 0 */ -#ifdef notyet - { SYS_RES_IRQ, 1, RF_ACTIVE | RF_OPTIONAL }, - { SYS_RES_IRQ, 2, RF_ACTIVE | RF_OPTIONAL }, - { SYS_RES_IRQ, 3, RF_ACTIVE | RF_OPTIONAL }, - { SYS_RES_IRQ, 4, RF_ACTIVE | RF_OPTIONAL }, - { SYS_RES_IRQ, 5, RF_ACTIVE | RF_OPTIONAL }, - { SYS_RES_IRQ, 6, RF_ACTIVE | RF_OPTIONAL }, - { SYS_RES_IRQ, 7, RF_ACTIVE | RF_OPTIONAL }, -#endif - { -1, 0 } -}; - /* CCNT */ #if __ARM_ARCH > 6 int pmu_attched = 0; @@ -131,34 +117,163 @@ pmu_intr(void *arg) } static int +pmu_parse_affinity(struct pmu_softc *sc, struct pmu_intr *irq, phandle_t xref, +uint32_t mpidr) +{ + struct pcpu *pcpu; + int i, err; + + + if (xref != 0) { + err = OF_getencprop(OF_node_from_xref(xref), "reg", , + sizeof(mpidr)); + if (err < 0) { + device_printf(sc->dev, "missing 'reg' property\n"); + return (ENXIO); + } + } + + for (i = 0; i < MAXCPU; i++) { + pcpu = pcpu_find(i); + if (pcpu != NULL && pcpu->pc_mpidr == mpidr) { + irq->cpuid = i; + return (0); + } + } + + device_printf(sc->dev, "Cannot find CPU with MPIDR: 0x%08X\n", mpidr); + return (ENXIO); +} + +static int +pmu_parse_intr(struct pmu_softc *sc) +{ + bool has_affinity; + phandle_t node, *cpus; + int rid, err, ncpus, i; + + + node = ofw_bus_get_node(sc->dev); + has_affinity = OF_hasprop(node, "interrupt-affinity"); + + for (i = 0; i < MAX_RLEN; i++) + sc->irq[i].cpuid = -1; + + cpus = NULL; + if (has_affinity) { + ncpus = OF_getencprop_alloc_multi(node, "interrupt-affinity", + sizeof(*cpus), (void **)); + if (ncpus < 0) { + device_printf(sc->dev, + "Cannot read interrupt affinity property\n"); + return (ENXIO); + } + } + + /* Process first interrupt */ + rid = 0; + sc->irq[0].res = bus_alloc_resource_any(sc->dev, SYS_RES_IRQ, , + RF_ACTIVE | RF_SHAREABLE); + + if (sc->irq[0].res == NULL) { + device_printf(sc->dev, "Cannot get interrupt\n"); + err = ENXIO; + goto done; + } + + /* Check if PMU have one per-CPU interrupt */ + if (intr_is_per_cpu(sc->irq[0].res)) { + if (has_affinity) { + device_printf(sc->dev, + "Per CPU interupt have declared affinity\n"); + err = ENXIO; + goto done; + } + return (0); + } + + /* +* PMU with set of generic interrupts (one per core) +* Each one must be binded to exact core. +*/ + err = pmu_parse_affinity(sc, sc->irq + 0, has_affinity ? cpus[0]: 0, + 0); + if (err != 0) { + device_printf(sc->dev, "Cannot parse affinity for CPUid: 0\n"); + goto done; + } + + for (i = 1; i < MAX_RLEN; i++) { + rid = i; + sc->irq[i].res = bus_alloc_resource_any(sc->dev, SYS_RES_IRQ, + , RF_ACTIVE | RF_SHAREABLE); +
svn commit: r368633 - head/sys/arm64/arm64
Author: mmel Date: Mon Dec 14 11:57:43 2020 New Revision: 368633 URL: https://svnweb.freebsd.org/changeset/base/368633 Log: Verify (and fix) the context_id argument passed to the mpentry () by PSCI. Some older PSCI implementations corrupt (or do not pass) the context_id argument to newly started secondary cores. Although the ideal solution to this problem is u-boot update, we can find the correct value for the argument (cpuid) by comparing of real core mpidr register with the value stored in pcu->mpidr. MFC after:2 weeks Modified: head/sys/arm64/arm64/mp_machdep.c Modified: head/sys/arm64/arm64/mp_machdep.c == --- head/sys/arm64/arm64/mp_machdep.c Mon Dec 14 11:56:16 2020 (r368632) +++ head/sys/arm64/arm64/mp_machdep.c Mon Dec 14 11:57:43 2020 (r368633) @@ -206,6 +206,21 @@ init_secondary(uint64_t cpu) { struct pcpu *pcpup; pmap_t pmap0; + u_int mpidr; + + /* +* Verify that the value passed in 'cpu' argument (aka context_id) is +* valid. Some older U-Boot based PSCI implementations are buggy, +* they can pass random value in it. +*/ + mpidr = READ_SPECIALREG(mpidr_el1) & CPU_AFF_MASK; + if (cpu >= MAXCPU || __pcpu[cpu].pc_mpidr != mpidr) { + for (cpu = 0; cpu < mp_maxid; cpu++) + if (__pcpu[cpu].pc_mpidr == mpidr) + break; + if ( cpu >= MAXCPU) + panic("MPIDR for this CPU is not in pcpu table"); + } pcpup = &__pcpu[cpu]; /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r368159 - in head/sys: arm/conf conf
On 05.12.2020 17:18, Mateusz Guzik wrote: On 11/29/20, Michal Meloun wrote: Author: mmel Date: Sun Nov 29 17:42:32 2020 New Revision: 368159 URL: https://svnweb.freebsd.org/changeset/base/368159 Log: Remove unused options. Marvell files and their related SOC_MV_ options should be cleaned up in another pass. Since this change tinderbox fails to build VERSATILEPB and EFIKA_MX: /usr/src/sys/dev/syscons/scgfbrndr.c:35:10: fatal error: 'opt_gfb.h' file not found #include "opt_gfb.h" ^~~ Fixed in r368373. thanks for report. Michal ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368373 - in head/sys: conf dev/syscons
Author: mmel Date: Sat Dec 5 19:44:00 2020 New Revision: 368373 URL: https://svnweb.freebsd.org/changeset/base/368373 Log: Remove remaning definition of GFB_ options. They are not used in source files. This fixes build of some arm boards after r368159. Reported by: mjg Modified: head/sys/conf/options.mips head/sys/conf/options.powerpc head/sys/dev/syscons/scgfbrndr.c Modified: head/sys/conf/options.mips == --- head/sys/conf/options.mips Sat Dec 5 14:53:24 2020(r368372) +++ head/sys/conf/options.mips Sat Dec 5 19:44:00 2020(r368373) @@ -66,10 +66,6 @@ CFE_CONSOLE opt_global.h CFE_ENVopt_global.h CFE_ENV_SIZE opt_global.h -GFB_DEBUG opt_gfb.h -GFB_NO_FONT_LOADINGopt_gfb.h -GFB_NO_MODE_CHANGE opt_gfb.h - NOFPU opt_global.h TICK_USE_YAMON_FREQopt_global.h Modified: head/sys/conf/options.powerpc == --- head/sys/conf/options.powerpc Sat Dec 5 14:53:24 2020 (r368372) +++ head/sys/conf/options.powerpc Sat Dec 5 19:44:00 2020 (r368373) @@ -15,10 +15,6 @@ FPU_EMU COMPAT_FREEBSD32 opt_global.h -GFB_DEBUG opt_gfb.h -GFB_NO_FONT_LOADINGopt_gfb.h -GFB_NO_MODE_CHANGE opt_gfb.h - MOEA64_STATS opt_pmap.h AMIGAONE opt_platform.h MIKROTIK opt_platform.h Modified: head/sys/dev/syscons/scgfbrndr.c == --- head/sys/dev/syscons/scgfbrndr.cSat Dec 5 14:53:24 2020 (r368372) +++ head/sys/dev/syscons/scgfbrndr.cSat Dec 5 19:44:00 2020 (r368373) @@ -32,7 +32,6 @@ __FBSDID("$FreeBSD$"); #include "opt_syscons.h" -#include "opt_gfb.h" #ifdef __powerpc__ #include "opt_ofwfb.h" #endif ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368370 - in head/sys/arm64: arm64 include
Author: mmel Date: Sat Dec 5 14:06:01 2020 New Revision: 368370 URL: https://svnweb.freebsd.org/changeset/base/368370 Log: Simplify startup of secondary cores and store MPIDR register to pcpu. - record MPIDR for all started cores in pcpu, they will be used as link between physical locality of given core, ID in external description (FDT or ACPI) and cupid. - because of above, cpuid can (and should) be freely assigned, only boot CPU must have cpuid 0. Simplify startup code according this. Please note that pure cpuid is not sufficient instrument to hold any information about core or cluster topology, nor to determistically iterate over subpart of cores in CPU (iterate over all cores in single cluster for example). Situation is more complicated by fact that PSCI can reject start of core without reporting error (because power budget for example), or by fact that is possible that we booted on non-first core in cluster (thus with cpuid 0 assigned to random core). Given cores topology should be exhibited to other parts of system (for example to scheduler for big.little or multicluster systems) by using smp_topo interface. Differential Revision: https://reviews.freebsd.org/D13863 Modified: head/sys/arm64/arm64/machdep.c head/sys/arm64/arm64/mp_machdep.c head/sys/arm64/include/pcpu.h Modified: head/sys/arm64/arm64/machdep.c == --- head/sys/arm64/arm64/machdep.c Sat Dec 5 12:08:37 2020 (r368369) +++ head/sys/arm64/arm64/machdep.c Sat Dec 5 14:06:01 2020 (r368370) @@ -661,6 +661,7 @@ cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t siz { pcpu->pc_acpi_id = 0x; + pcpu->pc_mpidr = 0x; } void Modified: head/sys/arm64/arm64/mp_machdep.c == --- head/sys/arm64/arm64/mp_machdep.c Sat Dec 5 12:08:37 2020 (r368369) +++ head/sys/arm64/arm64/mp_machdep.c Sat Dec 5 14:06:01 2020 (r368370) @@ -125,12 +125,9 @@ static void ipi_stop(void *); struct pcb stoppcbs[MAXCPU]; -/* - * Not all systems boot from the first CPU in the device tree. To work around - * this we need to find which CPU we have booted from so when we later - * enable the secondary CPUs we skip this one. - */ -static int cpu0 = -1; +#ifdef FDT +static u_int fdt_cpuid; +#endif void mpentry(unsigned long cpuid); void init_secondary(uint64_t); @@ -432,36 +429,23 @@ cpu_mp_probe(void) } static bool -start_cpu(u_int id, uint64_t target_cpu) +start_cpu(u_int cpuid, uint64_t target_cpu) { struct pcpu *pcpup; vm_paddr_t pa; - u_int cpuid; int err, naps; /* Check we are able to start this cpu */ - if (id > mp_maxid) + if (cpuid > mp_maxid) return (false); - KASSERT(id < MAXCPU, ("Too many CPUs")); + KASSERT(cpuid < MAXCPU, ("Too many CPUs")); + KASSERT(__pcpu[0].pc_mpidr != (target_cpu & CPU_AFF_MASK), + ("Start_cpu() was called on the boot CPU")); - /* We are already running on cpu 0 */ - if (id == cpu0) - return (true); - - /* -* Rotate the CPU IDs to put the boot CPU as CPU 0. We keep the other -* CPUs ordered as they are likely grouped into clusters so it can be -* useful to keep that property, e.g. for the GICv3 driver to send -* an IPI to all CPUs in the cluster. -*/ - cpuid = id; - if (cpuid < cpu0) - cpuid += mp_maxid + 1; - cpuid -= cpu0; - pcpup = &__pcpu[cpuid]; pcpu_init(pcpup, cpuid, sizeof(struct pcpu)); + pcpup->pc_mpidr = target_cpu & CPU_AFF_MASK; dpcpu[cpuid - 1] = (void *)kmem_malloc(DPCPU_SIZE, M_WAITOK | M_ZERO); dpcpu_init(dpcpu[cpuid - 1], cpuid); @@ -483,7 +467,7 @@ start_cpu(u_int id, uint64_t target_cpu) KASSERT(err == PSCI_MISSING || (mp_quirks & MP_QUIRK_CPULIST) == MP_QUIRK_CPULIST, ("Failed to start CPU %u (%lx), error %d\n", - id, target_cpu, err)); + cpuid, target_cpu, err)); pcpu_destroy(pcpup); kmem_free((vm_offset_t)dpcpu[cpuid - 1], DPCPU_SIZE); @@ -492,9 +476,6 @@ start_cpu(u_int id, uint64_t target_cpu) bootstacks[cpuid] = NULL; mp_ncpus--; - /* Notify the user that the CPU failed to start */ - printf("Failed to start CPU %u (%lx), error %d\n", - id, target_cpu, err); } else { /* Wait for the AP to switch to its boot stack. */ while (atomic_load_int(_started) < naps + 1) @@ -518,6 +499,13 @@ madt_handler(ACPI_SUBTABLE_HEADER *entry, void *arg) intr = (ACPI_MADT_GENERIC_INTERRUPT *)entry; cpuid = arg;
svn commit: r368369 - in head/sys: arm/freescale/vybrid arm64/qoriq arm64/qoriq/clk conf dev/ahci dev/iicbus/mux
Author: mmel Date: Sat Dec 5 12:08:37 2020 New Revision: 368369 URL: https://svnweb.freebsd.org/changeset/base/368369 Log: Add basic support for Freescale LX2160A SoC. All peripherals but the network processor are supported. Added: head/sys/arm64/qoriq/clk/lx2160a_clkgen.c (contents, props changed) head/sys/arm64/qoriq/qoriq_dw_pci.c (contents, props changed) head/sys/arm64/qoriq/qoriq_therm.c (contents, props changed) head/sys/arm64/qoriq/qoriq_therm_if.m (contents, props changed) head/sys/dev/iicbus/mux/pca9547.c (contents, props changed) Modified: head/sys/arm/freescale/vybrid/vf_i2c.c head/sys/conf/files head/sys/conf/files.arm64 head/sys/dev/ahci/ahci_fsl_fdt.c Modified: head/sys/arm/freescale/vybrid/vf_i2c.c == --- head/sys/arm/freescale/vybrid/vf_i2c.c Sat Dec 5 11:18:37 2020 (r368368) +++ head/sys/arm/freescale/vybrid/vf_i2c.c Sat Dec 5 12:08:37 2020 (r368369) @@ -147,7 +147,8 @@ static struct i2c_div_type vf610_div_table[] = { { 0x2C, 576 }, { 0x2D, 640 }, { 0x2E, 768 }, { 0x32, 896 }, { 0x2F, 960 }, { 0x33, 1024 }, { 0x34, 1152 }, { 0x35, 1280 }, { 0x36, 1536 }, { 0x3A, 1792 }, { 0x37, 1920 }, { 0x3B, 2048 }, - { 0x3C, 2304 }, { 0x3D, 2560 }, { 0x3E, 3072 }, { 0x3F, 3840 } + { 0x3C, 2304 }, { 0x3D, 2560 }, { 0x3E, 3072 }, { 0x3F, 3840 }, + { 0x3F, 3840 }, { 0x7B, 4096 }, { 0x7D, 5120 }, { 0x7E, 6144 }, }; #endif @@ -307,7 +308,15 @@ wait_for_icf(struct i2c_softc *sc) return (IIC_ETIMEOUT); } +/* Get ACK bit from last write */ +static bool +tx_acked(struct i2c_softc *sc) +{ + return (READ1(sc, I2C_IBSR) & IBSR_RXAK) ? false : true; + +} + static int i2c_repeated_start(device_t dev, u_char slave, int timeout) { @@ -342,6 +351,12 @@ i2c_repeated_start(device_t dev, u_char slave, int tim error = wait_for_iif(sc); + if (!tx_acked(sc)) { + vf_i2c_dbg(sc, + "cant i2c start: missing ACK after slave addres\n"); + return (IIC_ENOACK); + } + mtx_unlock(>mutex); if (error != 0) @@ -384,13 +399,19 @@ i2c_start(device_t dev, u_char slave, int timeout) WRITE1(sc, I2C_IBDR, slave); error = wait_for_iif(sc); - - mtx_unlock(>mutex); if (error != 0) { + mtx_unlock(>mutex); vf_i2c_dbg(sc, "cant i2c start: iif error\n"); return (error); } + mtx_unlock(>mutex); + if (!tx_acked(sc)) { + vf_i2c_dbg(sc, + "cant i2c start: missing QACK after slave addres\n"); + return (IIC_ENOACK); + } + return (IIC_NOERR); } @@ -568,10 +589,15 @@ i2c_write(device_t dev, const char *buf, int len, int return (error); } + if (!tx_acked(sc) && (*sent = (len - 2)) ){ + mtx_unlock(>mutex); + vf_i2c_dbg(sc, "no ACK on %d write\n", *sent); + return (IIC_ENOACK); + } + (*sent)++; } mtx_unlock(>mutex); - return (IIC_NOERR); } @@ -600,14 +626,8 @@ static device_method_t i2c_methods[] = { { 0, 0 } }; -static driver_t i2c_driver = { - "i2c", - i2c_methods, - sizeof(struct i2c_softc), -}; - static devclass_t i2c_devclass; - -DRIVER_MODULE(i2c, simplebus, i2c_driver, i2c_devclass, 0, 0); +static DEFINE_CLASS_0(i2c, i2c_driver, i2c_methods, sizeof(struct i2c_softc)); +DRIVER_MODULE(vybrid_i2c, simplebus, i2c_driver, i2c_devclass, 0, 0); DRIVER_MODULE(iicbus, i2c, iicbus_driver, iicbus_devclass, 0, 0); DRIVER_MODULE(ofw_iicbus, i2c, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0); Added: head/sys/arm64/qoriq/clk/lx2160a_clkgen.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/qoriq/clk/lx2160a_clkgen.c Sat Dec 5 12:08:37 2020 (r368369) @@ -0,0 +1,211 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright 2020 Michal Meloun + * + * 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, INCLUDIN
svn commit: r368367 - in head/sys: arm64/conf modules/dtb/freescale
Author: mmel Date: Sat Dec 5 11:17:54 2020 New Revision: 368367 URL: https://svnweb.freebsd.org/changeset/base/368367 Log: Connect DTB files based on LX2160A SoC to build. Mainly LX2K Honeycomb and ClearFog-CX boards. Added: head/sys/modules/dtb/freescale/ head/sys/modules/dtb/freescale/Makefile (contents, props changed) Modified: head/sys/arm64/conf/GENERIC Modified: head/sys/arm64/conf/GENERIC == --- head/sys/arm64/conf/GENERIC Sat Dec 5 10:57:15 2020(r368366) +++ head/sys/arm64/conf/GENERIC Sat Dec 5 11:17:54 2020(r368367) @@ -367,4 +367,4 @@ options FDT device acpi # DTBs -makeoptionsMODULES_EXTRA="dtb/allwinner dtb/imx8 dtb/mv dtb/rockchip dtb/rpi" +makeoptionsMODULES_EXTRA="dtb/allwinner dtb/freescale dtb/imx8 dtb/mv dtb/rockchip dtb/rpi" Added: head/sys/modules/dtb/freescale/Makefile == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/dtb/freescale/Makefile Sat Dec 5 11:17:54 2020 (r368367) @@ -0,0 +1,8 @@ +# $FreeBSD$ +# All the dts files for Freescale (now NXP) systems we support. +DTS= freescale/fsl-lx2160a-clearfog-cx.dts \ + freescale/fsl-lx2160a-honeycomb.dts \ + freescale/fsl-lx2160a-qds.dts \ + freescale/fsl-lx2160a-rdb.dts + +.include ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368364 - head/sys/dev/pci
Author: mmel Date: Sat Dec 5 10:55:09 2020 New Revision: 368364 URL: https://svnweb.freebsd.org/changeset/base/368364 Log: DesignWare PCIe driver: Don't call bus_generic_attach() twice. bus_generic_attach() should be called from the attach function of the real implementation, not from the common init function. MFC after:1 week Modified: head/sys/dev/pci/pci_dw.c Modified: head/sys/dev/pci/pci_dw.c == --- head/sys/dev/pci/pci_dw.c Sat Dec 5 10:10:25 2020(r368363) +++ head/sys/dev/pci/pci_dw.c Sat Dec 5 10:55:09 2020(r368364) @@ -640,7 +640,7 @@ pci_dw_init(device_t dev) device_add_child(dev, "pci", -1); - return (bus_generic_attach(dev)); + return (0); out: /* XXX Cleanup */ return (rv); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368363 - head/sys/arm/conf
Author: mmel Date: Sat Dec 5 10:10:25 2020 New Revision: 368363 URL: https://svnweb.freebsd.org/changeset/base/368363 Log: Connect RK3288 to GENERIC kernel. Modified: head/sys/arm/conf/GENERIC Modified: head/sys/arm/conf/GENERIC == --- head/sys/arm/conf/GENERIC Sat Dec 5 10:00:39 2020(r368362) +++ head/sys/arm/conf/GENERIC Sat Dec 5 10:10:25 2020(r368363) @@ -42,6 +42,7 @@ files "../freescale/imx/files.imx6" files "../mv/files.arm7" files "../nvidia/tegra124/files.tegra124" files "../qemu/files.qemu" +files "../rockchip/files.rk32xx" files "../ti/files.ti" files "../ti/am335x/files.am335x" files "../ti/omap4/files.omap4" @@ -91,6 +92,7 @@ devicegeneric_timer device mpcore_timer # MMC/SD/SDIO Card slot support +device dwmmc device sdhci # SD controller device mmc # mmc/sd bus device mmcsd # mmc/sd flash cards @@ -285,6 +287,7 @@ makeoptions MODULES_EXTRA+="dtb/am335x" makeoptionsMODULES_EXTRA+="dtb/imx6" makeoptionsMODULES_EXTRA+="dtb/nvidia" makeoptionsMODULES_EXTRA+="dtb/omap4" +makeoptionsMODULES_EXTRA+="dtb/rockchip" makeoptionsMODULES_EXTRA+="dtb/rpi" makeoptionsMODULES_EXTRA+="dtb/zynq" ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368362 - head/sys/modules/dtb/rockchip
Author: mmel Date: Sat Dec 5 10:00:39 2020 New Revision: 368362 URL: https://svnweb.freebsd.org/changeset/base/368362 Log: Also build DTB files for Asus Tinker board (RK3288 based). Modified: head/sys/modules/dtb/rockchip/Makefile Modified: head/sys/modules/dtb/rockchip/Makefile == --- head/sys/modules/dtb/rockchip/Makefile Sat Dec 5 09:08:26 2020 (r368361) +++ head/sys/modules/dtb/rockchip/Makefile Sat Dec 5 10:00:39 2020 (r368362) @@ -1,6 +1,12 @@ # $FreeBSD$ +# All the dts files for rockchip systems we support. +.if ${MACHINE_ARCH} == "armv7" DTS= \ + rk3288-tinker.dts \ + rk3288-tinker-s.dts +.elif ${MACHINE_ARCH} == "aarch64" +DTS= \ rockchip/rk3399-khadas-edge-captain.dts \ rockchip/rk3399-khadas-edge.dts \ rockchip/rk3399-khadas-edge-v.dts \ @@ -10,5 +16,6 @@ DTS= \ rockchip/rk3399-rockpro64.dts DTSO= rk3328-dwc3.dtso +.endif .include ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368340 - in head/sys: arm/rockchip arm64/rockchip arm64/rockchip/clk
Author: mmel Date: Fri Dec 4 16:24:44 2020 New Revision: 368340 URL: https://svnweb.freebsd.org/changeset/base/368340 Log: Add support for RK3288 SoC. Added: head/sys/arm/rockchip/files.rk32xx (contents, props changed) head/sys/arm/rockchip/rk32xx_machdep.c (contents, props changed) head/sys/arm/rockchip/rk32xx_mp.c (contents, props changed) head/sys/arm/rockchip/rk32xx_mp.h (contents, props changed) head/sys/arm/rockchip/std.rk32xx (contents, props changed) head/sys/arm64/rockchip/clk/rk3288_cru.c (contents, props changed) head/sys/arm64/rockchip/rk_pmu.c (contents, props changed) head/sys/arm64/rockchip/rk_usbphy.c (contents, props changed) Modified: head/sys/arm64/rockchip/clk/rk_clk_pll.c head/sys/arm64/rockchip/clk/rk_clk_pll.h head/sys/arm64/rockchip/clk/rk_cru.c head/sys/arm64/rockchip/clk/rk_cru.h head/sys/arm64/rockchip/rk_pwm.c head/sys/arm64/rockchip/rk_tsadc.c Added: head/sys/arm/rockchip/files.rk32xx == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/rockchip/files.rk32xx Fri Dec 4 16:24:44 2020 (r368340) @@ -0,0 +1,31 @@ +# $FreeBSD$ +kern/kern_clocksource.cstandard + +arm/rockchip/rk32xx_machdep.c standard +arm/rockchip/rk32xx_mp.c optionalsmp +arm64/rockchip/if_dwc_rk.c standard +arm64/rockchip/rk_i2c.cstandard +arm64/rockchip/rk_iodomain.c standard +arm64/rockchip/rk_gpio.c standard +arm64/rockchip/rk_grf.cstandard +arm64/rockchip/rk_pinctrl.cstandard +arm64/rockchip/rk_pmu.cstandard +arm64/rockchip/rk_pwm.cstandard +arm64/rockchip/rk_tsadc.c standard +arm64/rockchip/rk_tsadc_if.m standard +arm64/rockchip/rk_usbphy.c standard +arm64/rockchip/clk/rk_clk_armclk.c standard +arm64/rockchip/clk/rk_clk_composite.c standard +arm64/rockchip/clk/rk_clk_fract.c standard +arm64/rockchip/clk/rk_clk_gate.c standard +arm64/rockchip/clk/rk_clk_mux.cstandard +arm64/rockchip/clk/rk_clk_pll.cstandard +arm64/rockchip/clk/rk_cru.cstandard +arm64/rockchip/clk/rk3288_cru.cstandard + +dev/iicbus/pmic/act8846.c standard +dev/iicbus/pmic/act8846_regulator.cstandard +dev/iicbus/pmic/fan53555.c standard +dev/iicbus/rtc/hym8563.c standard +dev/mmc/host/dwmmc.c optionaldwmmc +dev/mmc/host/dwmmc_rockchip.c optionaldwmmc Added: head/sys/arm/rockchip/rk32xx_machdep.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/rockchip/rk32xx_machdep.c Fri Dec 4 16:24:44 2020 (r368340) @@ -0,0 +1,126 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Michal Meloun + * + * 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 "opt_platform.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include + +#include + +#include "platform_if.h" +#define CRU_PHYSBASE 0xFF76 +#define CRU_SIZE 0x0001 +#define CRU_GLB_SRST_FST_VALUE 0x1B0 + +static platform_def_t rk3288w_platform; + +static void +rk32xx_late_init(platform_t plat) +{ + +} + +/* + * Set up static device mappings. + */ +
svn commit: r368334 - head/sys/dev/iicbus/pmic
Author: mmel Date: Fri Dec 4 15:23:43 2020 New Revision: 368334 URL: https://svnweb.freebsd.org/changeset/base/368334 Log: Add a driver for FAN53555 based PMIC. Added: head/sys/dev/iicbus/pmic/fan53555.c (contents, props changed) Added: head/sys/dev/iicbus/pmic/fan53555.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iicbus/pmic/fan53555.c Fri Dec 4 15:23:43 2020 (r368334) @@ -0,0 +1,477 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2016 Jared McNeill + * Copyright (c) 2018 Emmanuel Vadot + * Copyright (c) 2019 Michal Meloun + * + * 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 +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include + +#include "regdev_if.h" + +/* Registers */ +#defineFAN53555_VSEL0 0x00 +#defineFAN53555_VSEL1 0x01 +#define FAN53555_VSEL_ENA (1 << 7) +#define FAN53555_VSEL_MODE (1 << 6) +#define FAN53555_VSEL_MASK 0x3f +#defineFAN53555_CTRL 0x02 +#defineFAN53555_ID10x03 +#define FAN53555_ID1_DIE_ID(x) (((x) >> 4) & 0x0F) +#defineFAN53555_ID20x04 +#define FAN53555_ID2_DIE_REV(x)(((x) >> 4) & 0x0F) +#defineFAN53555_MON0x05 + + +#if 0 +#definedprintf(sc, format, arg...) \ + device_printf(sc->base_dev, "%s: " format, __func__, arg) +#else +#definedprintf(sc, format, arg...) +#endif + +enum fan53555_pmic_type { + FAN53555 = 1, + SYR827, + SYR828, +}; + +static struct ofw_compat_data compat_data[] = { + {"fcs,fan53555",FAN53555}, + {"silergy,syr827", SYR827}, + {"silergy,syr828", SYR828}, + {NULL, 0} +}; + +struct fan53555_reg_sc { + struct regnode *regnode; + char*name; + device_tbase_dev; + uint8_t live_reg; + uint8_t sleep_reg; + struct regulator_range *range; + struct regnode_std_param *param; +}; + +struct fan53555_softc { + device_tdev; + uint8_t live_reg; + uint8_t sleep_reg; +}; + +static struct regulator_range syr_8_range = + REG_RANGE_INIT( 0, 0x3F, 712500, 12500); + +static struct regulator_range fan_0_0_range = + REG_RANGE_INIT( 0, 0x3F, 60, 1); +static struct regulator_range fan_0_13_range = + REG_RANGE_INIT( 0, 0x3F, 80, 1); +static struct regulator_range fan_1_range = + REG_RANGE_INIT( 0, 0x3F, 60, 1); +static struct regulator_range fan_4_range = + REG_RANGE_INIT( 0, 0x3F, 603000, 12826); + + +static int +fan53555_read(device_t dev, uint8_t reg, uint8_t *val) +{ + uint8_t addr; + int rv; + struct iic_msg msgs[2] = { + {0, IIC_M_WR | IIC_M_NOSTOP, 1, }, + {0, IIC_M_RD, 1, val}, + }; + + msgs[0].slave = iicbus_get_addr(dev); + msgs[1].slave = iicbus_get_addr(dev); + addr = reg; + + rv = iicbus_transfer_excl(dev, msgs, 2, IIC_INTRWAIT); + if (rv != 0) { + device_printf(dev, "Error when reading reg 0x%02X, rv: %d\n", + reg, rv); + return (EIO); + } + + retur
svn commit: r368332 - head/sys/dev/iicbus/rtc
Author: mmel Date: Fri Dec 4 15:09:42 2020 New Revision: 368332 URL: https://svnweb.freebsd.org/changeset/base/368332 Log: Add a driver for HYM8563 based RTC. Added: head/sys/dev/iicbus/rtc/hym8563.c (contents, props changed) Added: head/sys/dev/iicbus/rtc/hym8563.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iicbus/rtc/hym8563.c Fri Dec 4 15:09:42 2020 (r368332) @@ -0,0 +1,314 @@ +/*- + * Copyright (c) 2017 Hiroki Mori. All rights reserved. + * Copyright (c) 2017 Ian Lepore. 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. + * + * This code base on isl12xx.c + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Driver for realtime clock HAOYU HYM8563 + */ + +#include "opt_platform.h" + +#include +#include +#include +#include +#include +#include +#include + +#ifdef FDT +#include +#include +#endif + +#include +#include + +#include "clock_if.h" +#include "iicbus_if.h" + +/* Registers */ +#defineHYM8563_CTRL1 0x00 +#define HYM8563_CTRL1_TEST (1 << 7) +#define HYM8563_CTRL1_STOP (1 << 5) +#define HYM8563_CTRL1_TESTC(1 << 3) + +#defineHYM8563_CTRL2 0x01 +#define HYM8563_CTRL2_TI_TP(1 << 4) +#define HYM8563_CTRL2_AF (1 << 3) +#define HYM8563_CTRL2_TF (1 << 2) +#define HYM8563_CTRL2_AIE (1 << 1) +#define HYM8563_CTRL2_TIE (1 << 0) + +#defineHYM8563_SEC 0x02/* plus battery low bit */ +#define HYM8563_SEC_VL (1 << 7) + +#defineHYM8563_MIN 0x03 +#defineHYM8563_HOUR0x04 +#defineHYM8563_DAY 0x05 +#defineHYM8563_WEEKDAY 0x06 +#defineHYM8563_MONTH 0x07/* plus 1 bit for century */ +#define HYM8563_MONTH_CENTURY (1 << 7) +#define HYM8563_YEAR 0x08 + +struct hym8563_softc { + device_tdev; + struct intr_config_hook init_hook; +}; + +#ifdef FDT +static struct ofw_compat_data compat_data[] = { + {"haoyu,hym8563", 1}, + {NULL, 0}, +}; +#endif + + +static inline int +hym8563_read_buf(struct hym8563_softc *sc, uint8_t reg, uint8_t *buf, +uint16_t buflen) +{ + + return (iicdev_readfrom(sc->dev, reg, buf, buflen, IIC_WAIT)); +} + +static inline int +hym8563_write_buf(struct hym8563_softc *sc, uint8_t reg, uint8_t *buf, +uint16_t buflen) +{ + + return (iicdev_writeto(sc->dev, reg, buf, buflen, IIC_WAIT)); +} + +static inline int +hym8563_read_1(struct hym8563_softc *sc, uint8_t reg, uint8_t *data) +{ + + return (iicdev_readfrom(sc->dev, reg, data, 1, IIC_WAIT)); +} + +static inline int +hym8563_write_1(struct hym8563_softc *sc, uint8_t reg, uint8_t val) +{ + + return (iicdev_writeto(sc->dev, reg, , 1, IIC_WAIT)); +} + +static int +hym8563_gettime(device_t dev, struct timespec *ts) +{ + struct hym8563_softc*sc; + struct bcd_clocktime bct; + uint8_t buf[7]; + int rv; + + sc = device_get_softc(dev); + + /* Read all RTC data */ + rv = hym8563_read_buf(sc, HYM8563_SEC, buf, sizeof(buf)); + if (rv != 0) { + device_printf(sc->dev, "Cannot read time registers: %d\n", rv); + return (rv); + } + + /* Check for low voltage flag */ + if (buf[0] & HYM8563_SEC_VL) + { + device_printf(sc->dev, + "WARNING: RTC battery failed; time is
svn commit: r368331 - head/sys/dev/iicbus/pmic
Author: mmel Date: Fri Dec 4 14:57:12 2020 New Revision: 368331 URL: https://svnweb.freebsd.org/changeset/base/368331 Log: Add a driver for ACT8846 used as PMIC for RK3288 SoC. Added: head/sys/dev/iicbus/pmic/ head/sys/dev/iicbus/pmic/act8846.c (contents, props changed) head/sys/dev/iicbus/pmic/act8846.h (contents, props changed) head/sys/dev/iicbus/pmic/act8846_reg.h (contents, props changed) head/sys/dev/iicbus/pmic/act8846_regulator.c (contents, props changed) Added: head/sys/dev/iicbus/pmic/act8846.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iicbus/pmic/act8846.c Fri Dec 4 14:57:12 2020 (r368331) @@ -0,0 +1,258 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Michal Meloun + * + * 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 +__FBSDID("$FreeBSD$"); + +/* + * ACT8846 PMIC driver + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include "regdev_if.h" + +static struct ofw_compat_data compat_data[] = { + {"active-semi,act8846", 1}, + {NULL, 0} +}; + +#defineLOCK(_sc) sx_xlock(&(_sc)->lock) +#defineUNLOCK(_sc) sx_xunlock(&(_sc)->lock) +#defineLOCK_INIT(_sc) sx_init(&(_sc)->lock, "act8846") +#defineLOCK_DESTROY(_sc) sx_destroy(&(_sc)->lock); +#defineASSERT_LOCKED(_sc) sx_assert(&(_sc)->lock, SA_XLOCKED); +#defineASSERT_UNLOCKED(_sc)sx_assert(&(_sc)->lock, SA_UNLOCKED); + + +/* + * Raw register access function. + */ +int +act8846_read(struct act8846_softc *sc, uint8_t reg, uint8_t *val) +{ + uint8_t addr; + int rv; + struct iic_msg msgs[2] = { + {0, IIC_M_WR, 1, }, + {0, IIC_M_RD, 1, val}, + }; + + msgs[0].slave = sc->bus_addr; + msgs[1].slave = sc->bus_addr; + addr = reg; + + rv = iicbus_transfer_excl(sc->dev, msgs, 2, IIC_INTRWAIT); + if (rv != 0) { + device_printf(sc->dev, + "Error when reading reg 0x%02X, rv: %d\n", reg, rv); + return (EIO); + } + + return (0); +} + +int act8846_read_buf(struct act8846_softc *sc, uint8_t reg, uint8_t *buf, +size_t size) +{ + uint8_t addr; + int rv; + struct iic_msg msgs[2] = { + {0, IIC_M_WR, 1, }, + {0, IIC_M_RD, size, buf}, + }; + + msgs[0].slave = sc->bus_addr; + msgs[1].slave = sc->bus_addr; + addr = reg; + + rv = iicbus_transfer_excl(sc->dev, msgs, 2, IIC_INTRWAIT); + if (rv != 0) { + device_printf(sc->dev, + "Error when reading reg 0x%02X, rv: %d\n", reg, rv); + return (EIO); + } + + return (0); +} + +int +act8846_write(struct act8846_softc *sc, uint8_t reg, uint8_t val) +{ + uint8_t data[2]; + int rv; + + struct iic_msg msgs[1] = { + {0, IIC_M_WR, 2, data}, + }; + + msgs[0].slave = sc->bus_addr; + data[0] = reg; + data[1] = val; + + rv = iicbus_transfer_excl(sc->dev, msgs, 1, IIC_INTRWAIT); + if (rv != 0) { + device_printf(sc->dev, + "Error when writing reg 0x%02X, rv: %d\n", reg, rv); + return (EIO); + } + retur
svn commit: r368279 - head/sys/dev/nvme
Author: mmel Date: Wed Dec 2 16:54:24 2020 New Revision: 368279 URL: https://svnweb.freebsd.org/changeset/base/368279 Log: NVME: Multiple busdma related fixes. - in nvme_qpair_process_completions() do dma sync before completion buffer is used. - in nvme_qpair_submit_tracker(), don't do explicit wmb() also for arm and arm64. Bus_dmamap_sync() on these architectures is sufficient to ensure that all CPU stores are visible to external (including DMA) observers. - Allocate completion buffer as BUS_DMA_COHERENT. On not-DMA coherent systems, buffers continuously owned (and accessed) by DMA must be allocated with this flag. Note that BUS_DMA_COHERENT flag is no-op on DMA coherent systems (or coherent buses in mixed systems). MFC after:4 weeks Reviewed by: mav, imp Differential Revision: https://reviews.freebsd.org/D27446 Modified: head/sys/dev/nvme/nvme_qpair.c Modified: head/sys/dev/nvme/nvme_qpair.c == --- head/sys/dev/nvme/nvme_qpair.c Wed Dec 2 16:46:45 2020 (r368278) +++ head/sys/dev/nvme/nvme_qpair.c Wed Dec 2 16:54:24 2020 (r368279) @@ -547,6 +547,8 @@ nvme_qpair_process_completions(struct nvme_qpair *qpai if (!qpair->is_enabled) return (false); + bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); /* * A panic can stop the CPU this routine is running on at any point. If * we're called during a panic, complete the sq_head wrap protocol for @@ -580,8 +582,6 @@ nvme_qpair_process_completions(struct nvme_qpair *qpai } } - bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); while (1) { cpl = qpair->cpl[qpair->cq_head]; @@ -722,7 +722,7 @@ nvme_qpair_construct(struct nvme_qpair *qpair, bus_dma_tag_set_domain(qpair->dma_tag, qpair->domain); if (bus_dmamem_alloc(qpair->dma_tag, (void **), - BUS_DMA_NOWAIT, >queuemem_map)) { +BUS_DMA_COHERENT | BUS_DMA_NOWAIT, >queuemem_map)) { nvme_printf(ctrlr, "failed to alloc qpair memory\n"); goto out; } @@ -982,7 +982,7 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, st bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); -#ifndef __powerpc__ +#if !defined( __powerpc__) && !defined( __aarch64__) && !defined( __arm__) /* * powerpc's bus_dmamap_sync() already includes a heavyweight sync, but * no other archs do. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368273 - head/sys/arm/arm
Author: mmel Date: Wed Dec 2 08:14:56 2020 New Revision: 368273 URL: https://svnweb.freebsd.org/changeset/base/368273 Log: Fix r368153. Wrong branch of #ifdef __ARMEB__ was deleted. Modified: head/sys/arm/arm/support.S Modified: head/sys/arm/arm/support.S == --- head/sys/arm/arm/support.S Wed Dec 2 00:53:03 2020(r368272) +++ head/sys/arm/arm/support.S Wed Dec 2 08:14:56 2020(r368273) @@ -1213,10 +1213,10 @@ ENTRY(memcpy) */ ldrhr2, [r1]/* BE:r2 = ..01 LE:r2 = ..10 */ ldrhr3, [r1, #0x02] /* LE:r3 = ..23 LE:r3 = ..32 */ - mov r1, r2, lsr #8 /* r1 = ...0 */ - strbr1, [r0] - mov r2, r2, lsl #8 /* r2 = .01. */ - orr r2, r2, r3, lsr #8 /* r2 = .012 */ + strbr2, [r0] + mov r2, r2, lsr #8 /* r2 = ...1 */ + orr r2, r2, r3, lsl #8 /* r2 = .321 */ + mov r3, r3, lsr #8 /* r3 = ...3 */ strhr2, [r0, #0x01] strbr3, [r0, #0x03] RET ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368204 - head/sys/arm/arm
Author: mmel Date: Tue Dec 1 09:18:18 2020 New Revision: 368204 URL: https://svnweb.freebsd.org/changeset/base/368204 Log: Remove duplicated SV_ASLR from the elf flags. Reported by: lattera Modified: head/sys/arm/arm/elf_machdep.c Modified: head/sys/arm/arm/elf_machdep.c == --- head/sys/arm/arm/elf_machdep.c Tue Dec 1 08:52:13 2020 (r368203) +++ head/sys/arm/arm/elf_machdep.c Tue Dec 1 09:18:18 2020 (r368204) @@ -86,7 +86,7 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_maxssiz = NULL, .sv_flags = SV_ASLR | SV_SHP | SV_TIMEKEEP | SV_RNG_SEED_VER | - SV_ABI_FREEBSD | SV_ILP32 | SV_ASLR, + SV_ABI_FREEBSD | SV_ILP32, .sv_set_syscall_retval = cpu_set_syscall_retval, .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368203 - head/sys/dev/nvme
Author: mmel Date: Tue Dec 1 08:52:13 2020 New Revision: 368203 URL: https://svnweb.freebsd.org/changeset/base/368203 Log: Always use the __unused attribute even for potentially unused parameters. Requested by: ian, imp MFC with: r368167 Modified: head/sys/dev/nvme/nvme.h Modified: head/sys/dev/nvme/nvme.h == --- head/sys/dev/nvme/nvme.hTue Dec 1 03:07:26 2020(r368202) +++ head/sys/dev/nvme/nvme.hTue Dec 1 08:52:13 2020(r368203) @@ -1728,15 +1728,9 @@ extern int nvme_use_nvd; #endif /* _KERNEL */ -#if _BYTE_ORDER != _LITTLE_ENDIAN -#define MODIF -#else -#define MODIF __unused -#endif - /* Endianess conversion functions for NVMe structs */ static inline -void nvme_completion_swapbytes(struct nvme_completion *s MODIF) +void nvme_completion_swapbytes(struct nvme_completion *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1750,7 +1744,7 @@ void nvme_completion_swapbytes(struct nvme_completion } static inline -void nvme_power_state_swapbytes(struct nvme_power_state *s MODIF) +void nvme_power_state_swapbytes(struct nvme_power_state *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1763,7 +1757,7 @@ void nvme_power_state_swapbytes(struct nvme_power_stat } static inline -void nvme_controller_data_swapbytes(struct nvme_controller_data *s MODIF) +void nvme_controller_data_swapbytes(struct nvme_controller_data *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1815,7 +1809,7 @@ void nvme_controller_data_swapbytes(struct nvme_contro } static inline -void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s MODIF) +void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1845,7 +1839,7 @@ void nvme_namespace_data_swapbytes(struct nvme_namespa static inline void nvme_error_information_entry_swapbytes( -struct nvme_error_information_entry *s MODIF) +struct nvme_error_information_entry *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1862,7 +1856,7 @@ void nvme_error_information_entry_swapbytes( } static inline -void nvme_le128toh(void *p MODIF) +void nvme_le128toh(void *p __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN /* Swap 16 bytes in place */ @@ -1879,7 +1873,7 @@ void nvme_le128toh(void *p MODIF) static inline void nvme_health_information_page_swapbytes( -struct nvme_health_information_page *s MODIF) +struct nvme_health_information_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1907,7 +1901,7 @@ void nvme_health_information_page_swapbytes( } static inline -void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s MODIF) +void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1918,7 +1912,7 @@ void nvme_firmware_page_swapbytes(struct nvme_firmware } static inline -void nvme_ns_list_swapbytes(struct nvme_ns_list *s MODIF) +void nvme_ns_list_swapbytes(struct nvme_ns_list *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1930,7 +1924,7 @@ void nvme_ns_list_swapbytes(struct nvme_ns_list *s MOD static inline void nvme_command_effects_page_swapbytes( -struct nvme_command_effects_page *s MODIF) +struct nvme_command_effects_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1944,7 +1938,7 @@ void nvme_command_effects_page_swapbytes( static inline void nvme_res_notification_page_swapbytes( -struct nvme_res_notification_page *s MODIF) +struct nvme_res_notification_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN s->log_page_count = le64toh(s->log_page_count); @@ -1954,7 +1948,7 @@ void nvme_res_notification_page_swapbytes( static inline void nvme_sanitize_status_page_swapbytes( -struct nvme_sanitize_status_page *s MODIF) +struct nvme_sanitize_status_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN s->sprog = le16toh(s->sprog); @@ -1970,7 +1964,7 @@ void nvme_sanitize_status_page_swapbytes( } static inline -void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s MODIF) +void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1987,8 +1981,8 @@ void intel_log_temp_stats_swapbytes(struct intel_log_t } static inline -void nvme_resv_status_swapbytes(struct nvme_resv_status *s MODIF, -size_t size MODIF) +void nvme_resv_status_swapbytes(struct nvme_resv_status *s __unused, +size_t size __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN u_int i, n; @@ -2005,8 +1999,8 @@ void nvme_resv_status_swapbytes(struct nvme_resv_statu } static inline -void nvme_resv_status_ext_swapbytes(struct
Re: svn commit: r368187 - head/sys/dev/nvme
On 30.11.2020 17:02, Ian Lepore wrote: On Mon, 2020-11-30 at 14:51 +, Michal Meloun wrote: Author: mmel Date: Mon Nov 30 14:51:48 2020 New Revision: 368187 URL: https://svnweb.freebsd.org/changeset/base/368187 Log: Unbreak r368167 in userland. Decorate unused arguments. Reported by: kp, tuexen, jenkins, and many others MFC with:r368167 Modified: head/sys/dev/nvme/nvme.h Modified: head/sys/dev/nvme/nvme.h = = --- head/sys/dev/nvme/nvme.hMon Nov 30 14:49:13 2020(r368186) +++ head/sys/dev/nvme/nvme.hMon Nov 30 14:51:48 2020(r368187) @@ -1728,9 +1728,15 @@ extern int nvme_use_nvd; #endif /* _KERNEL */ +#if _BYTE_ORDER != _LITTLE_ENDIAN +#define MODIF +#else +#define MODIF __unused +#endif + /* Endianess conversion functions for NVMe structs */ static inline -void nvme_completion_swapbytes(struct nvme_completion *s) +void nvme_completion_swapbytes(struct nvme_completion *s MODIF) IMO, this is pretty ugly, it causes the brain to screech to a halt when you see it. Why not just add an unconditional __unused to the functions? The unused attribute is defined as marking the variable as "potentially unused" -- there is no penalty for having it there and then actually using the variable. I understand, (and I have significant tendency to agree) but I did not find more correct way how to do it. Are you sure that __unused is defined as *potentially* unused? I cannot find nothing about this and you known how are compiler guys creative with generating of new warnings... I known that C++17 have 'maybe_unused' attribute, but relationship to standard '__unused' looks unclear. In any case, I have not single problem to change this to the proposed style if we found that this is the optimal way. Michal ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r368167 - head/sys/dev/nvme
On 30.11.2020 11:35, Michael Tuexen wrote: On 30. Nov 2020, at 08:01, Michal Meloun wrote: Author: mmel Date: Mon Nov 30 07:01:12 2020 New Revision: 368167 URL: https://svnweb.freebsd.org/changeset/base/368167 Log: NVME: Don't try to swap data on little endian machines. These swapping functions violate BUSDMA contract - we cannot write to armed (by bus_dmamap_sync(PRE_..)) buffers. Remove them at least from little endian machines until a better solution will be developed. This breaks building libsysdecode on a little endian (amd64) system: Fixed in r368187. Sorry for troubles. Michal ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368187 - head/sys/dev/nvme
Author: mmel Date: Mon Nov 30 14:51:48 2020 New Revision: 368187 URL: https://svnweb.freebsd.org/changeset/base/368187 Log: Unbreak r368167 in userland. Decorate unused arguments. Reported by: kp, tuexen, jenkins, and many others MFC with: r368167 Modified: head/sys/dev/nvme/nvme.h Modified: head/sys/dev/nvme/nvme.h == --- head/sys/dev/nvme/nvme.hMon Nov 30 14:49:13 2020(r368186) +++ head/sys/dev/nvme/nvme.hMon Nov 30 14:51:48 2020(r368187) @@ -1728,9 +1728,15 @@ extern int nvme_use_nvd; #endif /* _KERNEL */ +#if _BYTE_ORDER != _LITTLE_ENDIAN +#define MODIF +#else +#define MODIF __unused +#endif + /* Endianess conversion functions for NVMe structs */ static inline -void nvme_completion_swapbytes(struct nvme_completion *s) +void nvme_completion_swapbytes(struct nvme_completion *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1744,7 +1750,7 @@ void nvme_completion_swapbytes(struct nvme_completion } static inline -void nvme_power_state_swapbytes(struct nvme_power_state *s) +void nvme_power_state_swapbytes(struct nvme_power_state *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1757,7 +1763,7 @@ void nvme_power_state_swapbytes(struct nvme_power_stat } static inline -void nvme_controller_data_swapbytes(struct nvme_controller_data *s) +void nvme_controller_data_swapbytes(struct nvme_controller_data *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1809,7 +1815,7 @@ void nvme_controller_data_swapbytes(struct nvme_contro } static inline -void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s) +void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1838,7 +1844,8 @@ void nvme_namespace_data_swapbytes(struct nvme_namespa } static inline -void nvme_error_information_entry_swapbytes(struct nvme_error_information_entry *s) +void nvme_error_information_entry_swapbytes( +struct nvme_error_information_entry *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1855,7 +1862,7 @@ void nvme_error_information_entry_swapbytes(struct nvm } static inline -void nvme_le128toh(void *p) +void nvme_le128toh(void *p MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN /* Swap 16 bytes in place */ @@ -1871,7 +1878,8 @@ void nvme_le128toh(void *p) } static inline -void nvme_health_information_page_swapbytes(struct nvme_health_information_page *s) +void nvme_health_information_page_swapbytes( +struct nvme_health_information_page *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1899,7 +1907,7 @@ void nvme_health_information_page_swapbytes(struct nvm } static inline -void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s) +void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1910,7 +1918,7 @@ void nvme_firmware_page_swapbytes(struct nvme_firmware } static inline -void nvme_ns_list_swapbytes(struct nvme_ns_list *s) +void nvme_ns_list_swapbytes(struct nvme_ns_list *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1921,7 +1929,8 @@ void nvme_ns_list_swapbytes(struct nvme_ns_list *s) } static inline -void nvme_command_effects_page_swapbytes(struct nvme_command_effects_page *s) +void nvme_command_effects_page_swapbytes( +struct nvme_command_effects_page *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1934,7 +1943,8 @@ void nvme_command_effects_page_swapbytes(struct nvme_c } static inline -void nvme_res_notification_page_swapbytes(struct nvme_res_notification_page *s) +void nvme_res_notification_page_swapbytes( +struct nvme_res_notification_page *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN s->log_page_count = le64toh(s->log_page_count); @@ -1943,7 +1953,8 @@ void nvme_res_notification_page_swapbytes(struct nvme_ } static inline -void nvme_sanitize_status_page_swapbytes(struct nvme_sanitize_status_page *s) +void nvme_sanitize_status_page_swapbytes( +struct nvme_sanitize_status_page *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN s->sprog = le16toh(s->sprog); @@ -1959,7 +1970,7 @@ void nvme_sanitize_status_page_swapbytes(struct nvme_s } static inline -void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s) +void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1976,7 +1987,8 @@ void intel_log_temp_stats_swapbytes(struct intel_log_t } static inline -void nvme_resv_status_swapbytes(struct nvme_resv_status *s, size_t size) +void nvme_resv_status_swapbytes(struct nvme_resv_status *s MODIF, +size_t size MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN u_int i, n; @@ -1993,7
svn commit: r368167 - head/sys/dev/nvme
Author: mmel Date: Mon Nov 30 07:01:12 2020 New Revision: 368167 URL: https://svnweb.freebsd.org/changeset/base/368167 Log: NVME: Don't try to swap data on little endian machines. These swapping functions violate BUSDMA contract - we cannot write to armed (by bus_dmamap_sync(PRE_..)) buffers. Remove them at least from little endian machines until a better solution will be developed. Reviewed by: imp MFC after:3 weeks Modified: head/sys/dev/nvme/nvme.h Modified: head/sys/dev/nvme/nvme.h == --- head/sys/dev/nvme/nvme.hSun Nov 29 23:37:18 2020(r368166) +++ head/sys/dev/nvme/nvme.hMon Nov 30 07:01:12 2020(r368167) @@ -1732,6 +1732,7 @@ extern int nvme_use_nvd; static inline void nvme_completion_swapbytes(struct nvme_completion *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN s->cdw0 = le32toh(s->cdw0); /* omit rsvd1 */ @@ -1739,22 +1740,26 @@ voidnvme_completion_swapbytes(struct nvme_completion s->sqid = le16toh(s->sqid); /* omit cid */ s->status = le16toh(s->status); +#endif } static inline void nvme_power_state_swapbytes(struct nvme_power_state *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN s->mp = le16toh(s->mp); s->enlat = le32toh(s->enlat); s->exlat = le32toh(s->exlat); s->idlp = le16toh(s->idlp); s->actp = le16toh(s->actp); +#endif } static inline void nvme_controller_data_swapbytes(struct nvme_controller_data *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN int i; s->vid = le16toh(s->vid); @@ -1800,11 +1805,13 @@ voidnvme_controller_data_swapbytes(struct nvme_contro s->mnan = le32toh(s->mnan); for (i = 0; i < 32; i++) nvme_power_state_swapbytes(>power_state[i]); +#endif } static inline void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN int i; s->nsze = le64toh(s->nsze); @@ -1827,11 +1834,13 @@ voidnvme_namespace_data_swapbytes(struct nvme_namespa s->endgid = le16toh(s->endgid); for (i = 0; i < 16; i++) s->lbaf[i] = le32toh(s->lbaf[i]); +#endif } static inline void nvme_error_information_entry_swapbytes(struct nvme_error_information_entry *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN s->error_count = le64toh(s->error_count); s->sqid = le16toh(s->sqid); @@ -1842,6 +1851,7 @@ void nvme_error_information_entry_swapbytes(struct nvm s->nsid = le32toh(s->nsid); s->csi = le64toh(s->csi); s->ttsi = le16toh(s->ttsi); +#endif } static inline @@ -1857,14 +1867,13 @@ voidnvme_le128toh(void *p) tmp[i] = tmp[15-i]; tmp[15-i] = b; } -#else - (void)p; #endif } static inline void nvme_health_information_page_swapbytes(struct nvme_health_information_page *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN int i; s->temperature = le16toh(s->temperature); @@ -1886,47 +1895,57 @@ voidnvme_health_information_page_swapbytes(struct nvm s->tmt2tc = le32toh(s->tmt2tc); s->ttftmt1 = le32toh(s->ttftmt1); s->ttftmt2 = le32toh(s->ttftmt2); +#endif } static inline void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN int i; for (i = 0; i < 7; i++) s->revision[i] = le64toh(s->revision[i]); +#endif } static inline void nvme_ns_list_swapbytes(struct nvme_ns_list *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN int i; for (i = 0; i < 1024; i++) s->ns[i] = le32toh(s->ns[i]); +#endif } static inline void nvme_command_effects_page_swapbytes(struct nvme_command_effects_page *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN int i; for (i = 0; i < 256; i++) s->acs[i] = le32toh(s->acs[i]); for (i = 0; i < 256; i++) s->iocs[i] = le32toh(s->iocs[i]); +#endif } static inline void nvme_res_notification_page_swapbytes(struct nvme_res_notification_page *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN s->log_page_count = le64toh(s->log_page_count); s->nsid = le32toh(s->nsid); +#endif } static inline void nvme_sanitize_status_page_swapbytes(struct nvme_sanitize_status_page *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN s->sprog = le16toh(s->sprog); s->sstat = le16toh(s->sstat); s->scdw10 = le32toh(s->scdw10); @@ -1936,11 +1955,13 @@ voidnvme_sanitize_status_page_swapbytes(struct nvme_s s->etfownd = le32toh(s->etfownd); s->etfbewnd = le32toh(s->etfbewnd); s->etfcewnd = le32toh(s->etfcewnd); +#endif } static inline void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN s->current = le64toh(s->current);
svn commit: r368161 - in head/sys/arm: arm include
Author: mmel Date: Sun Nov 29 18:59:01 2020 New Revision: 368161 URL: https://svnweb.freebsd.org/changeset/base/368161 Log: Store MPIDR register in pcpu. MPIDR represents physical locality of given core and it should be used as the only viable/robust connection between cpuid (which have zero relation to cores topology) and external description (for example in FDT). It can be used for determining which interrupt is associated to given per-CPU PMU or by scheduler for determining big/little core or cluster topology. MFC after: 3 weeks Modified: head/sys/arm/arm/machdep.c head/sys/arm/arm/mp_machdep.c head/sys/arm/include/pcpu.h Modified: head/sys/arm/arm/machdep.c == --- head/sys/arm/arm/machdep.c Sun Nov 29 18:22:14 2020(r368160) +++ head/sys/arm/arm/machdep.c Sun Nov 29 18:59:01 2020(r368161) @@ -302,6 +302,8 @@ DELAY(int usec) void cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size) { + + pcpu->pc_mpidr = 0x; } void @@ -684,6 +686,7 @@ pcpu0_init(void) { set_curthread(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); + pcpup->pc_mpidr = cp15_mpidr_get() & 0xFF; PCPU_SET(curthread, ); } Modified: head/sys/arm/arm/mp_machdep.c == --- head/sys/arm/arm/mp_machdep.c Sun Nov 29 18:22:14 2020 (r368160) +++ head/sys/arm/arm/mp_machdep.c Sun Nov 29 18:59:01 2020 (r368161) @@ -162,6 +162,7 @@ init_secondary(int cpu) ; pcpu_init(pc, cpu, sizeof(struct pcpu)); + pc->pc_mpidr = cp15_mpidr_get() & 0xFF; dpcpu_init(dpcpu[cpu - 1], cpu); #if defined(DDB) dbg_monitor_init_secondary(); Modified: head/sys/arm/include/pcpu.h == --- head/sys/arm/include/pcpu.h Sun Nov 29 18:22:14 2020(r368160) +++ head/sys/arm/include/pcpu.h Sun Nov 29 18:59:01 2020(r368161) @@ -65,7 +65,8 @@ struct vmspace; int pc_bp_harden_kind; \ uint32_t pc_original_actlr; \ uint64_t pc_clock; \ - char __pad[139] + uint32_t pc_mpidr; \ + char __pad[135] #ifdef _KERNEL ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r368124 - in head/sys: cam cam/ata cam/ctl cam/mmc cam/nvme cam/scsi compat/linprocfs compat/linux conf contrib/openzfs/module/os/freebsd/zfs dev/ahci dev/ata dev/firewire dev/flash de
On 29.11.2020 18:46, Ed Maste wrote: On Sun, 29 Nov 2020 at 12:36, Konstantin Belousov wrote: I think it is reasonable to return to 128KB for 32bit systems. ... +#ifndef MAXPHYS/* max raw I/O transfer size */ +#ifdef __ILP32__ +#define MAXPHYS(128 * 1024) +#else +#define MAXPHYS(1024 * 1024) +#endif This seems reasonable to me. Agree. Please commit it. Michal ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368159 - in head/sys: arm/conf conf
Author: mmel Date: Sun Nov 29 17:42:32 2020 New Revision: 368159 URL: https://svnweb.freebsd.org/changeset/base/368159 Log: Remove unused options. Marvell files and their related SOC_MV_ options should be cleaned up in another pass. Modified: head/sys/arm/conf/NOTES head/sys/arm/conf/std.armv6 head/sys/arm/conf/std.armv7 head/sys/conf/options.arm Modified: head/sys/arm/conf/NOTES == --- head/sys/arm/conf/NOTES Sun Nov 29 16:44:22 2020(r368158) +++ head/sys/arm/conf/NOTES Sun Nov 29 17:42:32 2020(r368159) @@ -9,7 +9,6 @@ makeoptions CONF_CFLAGS+="-march=armv7a" # Add options for armv7 that are not in sys/conf/NOTES... -optionsARM_L2_PIPT # Only L2 PIPT is supported optionsFDT # Flattened device tree support optionsFREEBSD_BOOT_LOADER # Process metadata passed from loader(8) optionsINTRNG # Include INTRNG framework Modified: head/sys/arm/conf/std.armv6 == --- head/sys/arm/conf/std.armv6 Sun Nov 29 16:44:22 2020(r368158) +++ head/sys/arm/conf/std.armv6 Sun Nov 29 17:42:32 2020(r368159) @@ -3,7 +3,6 @@ # $FreeBSD$ optionsHZ=1000 -optionsARM_L2_PIPT # Only L2 PIPT is supported optionsINTRNG # All arm systems use INTRNG these days optionsPREEMPTION # Enable kernel thread preemption optionsVIMAGE # Subsystem virtualization, e.g. VNET Modified: head/sys/arm/conf/std.armv7 == --- head/sys/arm/conf/std.armv7 Sun Nov 29 16:44:22 2020(r368158) +++ head/sys/arm/conf/std.armv7 Sun Nov 29 17:42:32 2020(r368159) @@ -3,7 +3,6 @@ # $FreeBSD$ optionsHZ=1000 -optionsARM_L2_PIPT # Only L2 PIPT is supported optionsINTRNG # All arm systems use INTRNG these days optionsPREEMPTION # Enable kernel thread preemption optionsVIMAGE # Subsystem virtualization, e.g. VNET Modified: head/sys/conf/options.arm == --- head/sys/conf/options.arm Sun Nov 29 16:44:22 2020(r368158) +++ head/sys/conf/options.arm Sun Nov 29 17:42:32 2020(r368159) @@ -1,13 +1,7 @@ #$FreeBSD$ ARMV6 opt_global.h ARMV7 opt_global.h -ARM_CACHE_LOCK_ENABLE opt_global.h -ARM_KERN_DIRECTMAP opt_vm.h -ARM_L2_PIPTopt_global.h -ARM_MANY_BOARD opt_global.h -ARM_WANT_TP_ADDRESSopt_global.h CPSW_ETHERSWITCH opt_cpsw.h -CPU_ARM9E opt_global.h CPU_ARM1176opt_global.h CPU_CORTEXAopt_global.h CPU_KRAIT opt_global.h @@ -23,7 +17,6 @@ FREEBSD_BOOT_LOADER opt_global.h KERNBASE opt_global.h KERNVIRTADDR opt_global.h LINUX_BOOT_ABI opt_global.h -LOADERRAMADDR opt_global.h LOCORE_MAP_MB opt_locore.h NKPT2PGopt_pmap.h PHYSADDR opt_global.h @@ -31,7 +24,6 @@ PLATFORM opt_global.h SOCDEV_PA opt_global.h SOCDEV_VA opt_global.h PV_STATS opt_pmap.h -QEMU_WORKAROUNDS opt_global.h SOC_ALLWINNER_A10 opt_global.h SOC_ALLWINNER_A13 opt_global.h SOC_ALLWINNER_A20 opt_global.h @@ -56,13 +48,6 @@ SOC_MV_KIRKWOOD opt_global.h SOC_MV_ORION opt_global.h SOC_OMAP3 opt_global.h SOC_OMAP4 opt_global.h -SOC_ROCKCHIP_RK3188opt_global.h SOC_TI_AM335X opt_global.h -SOC_TEGRA2 opt_global.h -XSCALE_CACHE_READ_WRITE_ALLOCATE opt_global.h -VERBOSE_INIT_ARM opt_global.h VM_MAXUSER_ADDRESS opt_global.h -GFB_DEBUG opt_gfb.h -GFB_NO_FONT_LOADINGopt_gfb.h -GFB_NO_MODE_CHANGE opt_gfb.h VFPopt_global.h ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368158 - head/sys/arm/arm
Author: mmel Date: Sun Nov 29 16:44:22 2020 New Revision: 368158 URL: https://svnweb.freebsd.org/changeset/base/368158 Log: _ARM_ARCH_5E is always defined, we not support older CPUs. Modified: head/sys/arm/arm/bcopy_page.S head/sys/arm/arm/bcopyinout.S head/sys/arm/arm/in_cksum_arm.S head/sys/arm/arm/machdep.c head/sys/arm/arm/support.S Modified: head/sys/arm/arm/bcopy_page.S == --- head/sys/arm/arm/bcopy_page.S Sun Nov 29 16:29:40 2020 (r368157) +++ head/sys/arm/arm/bcopy_page.S Sun Nov 29 16:44:22 2020 (r368158) @@ -44,147 +44,8 @@ __FBSDID("$FreeBSD$"); #include "assym.inc" -#ifndef _ARM_ARCH_5E -/* #define BIG_LOOPS */ - /* - * bcopy_page(src, dest) - * - * Optimised copy page routine. - * - * On entry: - * r0 - src address - * r1 - dest address - * - * Requires: - * number of bytes per page (PAGE_SIZE) is a multiple of 512 (BIG_LOOPS), 128 - * otherwise. - */ - -#defineCHUNK_SIZE 32 - -#definePREFETCH_FIRST_CHUNK/* nothing */ -#definePREFETCH_NEXT_CHUNK /* nothing */ - -#ifndef COPY_CHUNK -#defineCOPY_CHUNK \ - PREFETCH_NEXT_CHUNK ; \ - ldmia r0!, {r3-r8,ip,lr} ; \ - stmia r1!, {r3-r8,ip,lr} -#endif /* ! COPY_CHUNK */ - -#ifndef SAVE_REGS -#defineSAVE_REGS stmfd sp!, {r4-r8, lr}; _SAVE({r4-r8, lr}) -#defineRESTORE_REGSldmfd sp!, {r4-r8, pc} -#endif - -ENTRY(bcopy_page) - PREFETCH_FIRST_CHUNK - SAVE_REGS -#ifdef BIG_LOOPS - mov r2, #(PAGE_SIZE >> 9) -#else - mov r2, #(PAGE_SIZE >> 7) -#endif - -1: - COPY_CHUNK - COPY_CHUNK - COPY_CHUNK - COPY_CHUNK - -#ifdef BIG_LOOPS - /* There is little point making the loop any larger; unless we are - running with the cache off, the load/store overheads will - completely dominate this loop. */ - COPY_CHUNK - COPY_CHUNK - COPY_CHUNK - COPY_CHUNK - - COPY_CHUNK - COPY_CHUNK - COPY_CHUNK - COPY_CHUNK - - COPY_CHUNK - COPY_CHUNK - COPY_CHUNK - COPY_CHUNK -#endif - subsr2, r2, #1 - bne 1b - - RESTORE_REGS/* ...and return. */ -END(bcopy_page) - -/* - * bzero_page(dest) - * - * Optimised zero page routine. - * - * On entry: - * r0 - dest address - * - * Requires: - * number of bytes per page (PAGE_SIZE) is a multiple of 512 (BIG_LOOPS), 128 - * otherwise - */ - -ENTRY(bzero_page) - stmfd sp!, {r4-r8, lr} - _SAVE({r4-r8, lr}) -#ifdef BIG_LOOPS - mov r2, #(PAGE_SIZE >> 9) -#else - mov r2, #(PAGE_SIZE >> 7) -#endif - mov r3, #0 - mov r4, #0 - mov r5, #0 - mov r6, #0 - mov r7, #0 - mov r8, #0 - mov ip, #0 - mov lr, #0 - -1: - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - -#ifdef BIG_LOOPS - /* There is little point making the loop any larger; unless we are - running with the cache off, the load/store overheads will - completely dominate this loop. */ - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - -#endif - - subsr2, r2, #1 - bne 1b - - ldmfd sp!, {r4-r8, pc} -END(bzero_page) - -#else /* _ARM_ARCH_5E */ - -/* * armv5e version of bcopy_page */ ENTRY(bcopy_page) @@ -279,4 +140,3 @@ ENTRY(bzero_page) bne 1b RET END(bzero_page) -#endif /* _ARM_ARCH_5E */ Modified: head/sys/arm/arm/bcopyinout.S == --- head/sys/arm/arm/bcopyinout.S Sun Nov 29 16:29:40 2020 (r368157) +++ head/sys/arm/arm/bcopyinout.S Sun Nov 29 16:44:22 2020 (r368158) @@ -47,510 +47,7 @@ .word _C_LABEL(_min_memcpy_size) __FBSDID("$FreeBSD$"); -#ifdef _ARM_ARCH_5E #include -#else - - .text - .align 2 - -#define GET_PCB(tmp) \ - mrc p15, 0, tmp, c13, c0, 4; \ - add tmp, tmp, #(TD_PCB) - -#define SAVE_REGS stmfd sp!, {r4-r11}; _SAVE({r4-r11}) -#define RESTORE_REGS ldmfd sp!, {r4-r11} - -#if defined(_ARM_ARCH_5E) -#define HELLOCPP # -#define PREFETCH(rx,o) pld [ rx , HELLOCPP (o) ] -#else -#define PREFETCH(rx,o) -#endif - -/* - * r0 = user space address - * r1 = kernel space address - * r2 = length - * - * Copies bytes from user space to kernel space - * - * We save/restore r4-r11: - *
svn commit: r368155 - head/sys/arm/conf
Author: mmel Date: Sun Nov 29 15:39:54 2020 New Revision: 368155 URL: https://svnweb.freebsd.org/changeset/base/368155 Log: Remove orphaned configs. Deleted: head/sys/arm/conf/ARNDALE head/sys/arm/conf/ARNDALE-OCTA head/sys/arm/conf/EA3250.hints head/sys/arm/conf/SAM9G20EK.hints head/sys/arm/conf/VSATV102 head/sys/arm/conf/YYHD18 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368154 - in head/sys: arm/arm arm/include arm/mv conf
Author: mmel Date: Sun Nov 29 15:24:00 2020 New Revision: 368154 URL: https://svnweb.freebsd.org/changeset/base/368154 Log: Remove remaining fragments of code for older already ceased ARM versions. Deleted: head/sys/arm/arm/cpufunc_asm_arm9.S head/sys/arm/arm/cpufunc_asm_armv4.S head/sys/arm/arm/cpufunc_asm_armv5_ec.S head/sys/arm/arm/cpufunc_asm_sheeva.S head/sys/arm/mv/std.mv Modified: head/sys/arm/arm/cpufunc.c head/sys/arm/include/cpufunc.h head/sys/arm/include/md_var.h head/sys/conf/files.arm Modified: head/sys/arm/arm/cpufunc.c == --- head/sys/arm/arm/cpufunc.c Sun Nov 29 15:04:39 2020(r368153) +++ head/sys/arm/arm/cpufunc.c Sun Nov 29 15:24:00 2020(r368154) @@ -80,9 +80,6 @@ u_int arm_cache_level; u_int arm_cache_type[14]; u_int arm_cache_loc; -#if defined(CPU_ARM9E) -static void arm10_setup(void); -#endif #ifdef CPU_MV_PJ4B static void pj4bv7_setup(void); #endif @@ -93,107 +90,6 @@ static void arm11x6_setup(void); static void cortexa_setup(void); #endif -#if defined(CPU_ARM9E) -struct cpu_functions armv5_ec_cpufuncs = { - /* CPU functions */ - - cpufunc_nullop, /* cpwait */ - - /* MMU functions */ - - cpufunc_control,/* control */ - armv5_ec_setttb,/* Setttb */ - - /* TLB functions */ - - armv4_tlb_flushID, /* tlb_flushID */ - arm9_tlb_flushID_SE,/* tlb_flushID_SE */ - armv4_tlb_flushD, /* tlb_flushD */ - armv4_tlb_flushD_SE,/* tlb_flushD_SE*/ - - /* Cache operations */ - - armv5_ec_icache_sync_range, /* icache_sync_range*/ - - armv5_ec_dcache_wbinv_all, /* dcache_wbinv_all */ - armv5_ec_dcache_wbinv_range,/* dcache_wbinv_range */ - armv5_ec_dcache_inv_range, /* dcache_inv_range */ - armv5_ec_dcache_wb_range, /* dcache_wb_range */ - - armv4_idcache_inv_all, /* idcache_inv_all */ - armv5_ec_idcache_wbinv_all, /* idcache_wbinv_all*/ - armv5_ec_idcache_wbinv_range, /* idcache_wbinv_range */ - - cpufunc_nullop, /* l2cache_wbinv_all*/ - (void *)cpufunc_nullop, /* l2cache_wbinv_range */ - (void *)cpufunc_nullop, /* l2cache_inv_range*/ - (void *)cpufunc_nullop, /* l2cache_wb_range */ - (void *)cpufunc_nullop, /* l2cache_drain_writebuf */ - - /* Other functions */ - - armv4_drain_writebuf, /* drain_writebuf */ - - (void *)cpufunc_nullop, /* sleep*/ - - /* Soft functions */ - - arm9_context_switch,/* context_switch */ - - arm10_setup /* cpu setup*/ - -}; - -struct cpu_functions sheeva_cpufuncs = { - /* CPU functions */ - - cpufunc_nullop, /* cpwait */ - - /* MMU functions */ - - cpufunc_control,/* control */ - sheeva_setttb, /* Setttb */ - - /* TLB functions */ - - armv4_tlb_flushID, /* tlb_flushID */ - arm9_tlb_flushID_SE,/* tlb_flushID_SE */ - armv4_tlb_flushD, /* tlb_flushD */ - armv4_tlb_flushD_SE,/* tlb_flushD_SE*/ - - /* Cache operations */ - - armv5_ec_icache_sync_range, /* icache_sync_range*/ - - armv5_ec_dcache_wbinv_all, /* dcache_wbinv_all */ - sheeva_dcache_wbinv_range, /* dcache_wbinv_range */ - sheeva_dcache_inv_range,/* dcache_inv_range */ - sheeva_dcache_wb_range, /* dcache_wb_range */ - - armv4_idcache_inv_all, /* idcache_inv_all */ - armv5_ec_idcache_wbinv_all, /* idcache_wbinv_all*/ - sheeva_idcache_wbinv_range, /* idcache_wbinv_all*/ - - sheeva_l2cache_wbinv_all, /* l2cache_wbinv_all*/ - sheeva_l2cache_wbinv_range, /* l2cache_wbinv_range */ - sheeva_l2cache_inv_range, /* l2cache_inv_range*/ - sheeva_l2cache_wb_range,/* l2cache_wb_range */ - (void *)cpufunc_nullop, /* l2cache_drain_writebuf */ - - /* Other functions */ - - armv4_drain_writebuf, /* drain_writebuf */ - - sheeva_cpu_sleep, /* sleep*/ - - /* Soft functions */ - - arm9_context_switch,/* context_switch */ - - arm10_setup /* cpu setup*/ -}; -#endif /* CPU_ARM9E */ - #ifdef CPU_MV_PJ4B struct cpu_functions pj4bv7_cpufuncs = { /* Cache operations */ @@ -257,11 +153,6
svn commit: r368153 - head/sys/arm/arm
Author: mmel Date: Sun Nov 29 15:04:39 2020 New Revision: 368153 URL: https://svnweb.freebsd.org/changeset/base/368153 Log: Remove remaining support of big endian byte order. Big endian support was ceased by removing ARMv4 sub architecture. Modified: head/sys/arm/arm/bcopyinout_xscale.S head/sys/arm/arm/cpufunc.c head/sys/arm/arm/fusu.S head/sys/arm/arm/in_cksum_arm.S head/sys/arm/arm/support.S head/sys/arm/arm/vm_machdep.c Modified: head/sys/arm/arm/bcopyinout_xscale.S == --- head/sys/arm/arm/bcopyinout_xscale.SSun Nov 29 14:21:16 2020 (r368152) +++ head/sys/arm/arm/bcopyinout_xscale.SSun Nov 29 15:04:39 2020 (r368153) @@ -298,25 +298,12 @@ ENTRY(copyin) b .Lcopyin_bad1 .Lcopyin_bad1_loop16: -#ifdef __ARMEB__ - mov r4, ip, lsl #8 -#else mov r4, ip, lsr #8 -#endif ldrtr5, [r0], #0x04 pld [r0, #0x018] ldrtr6, [r0], #0x04 ldrtr7, [r0], #0x04 ldrtip, [r0], #0x04 -#ifdef __ARMEB__ - orr r4, r4, r5, lsr #24 - mov r5, r5, lsl #8 - orr r5, r5, r6, lsr #24 - mov r6, r6, lsl #8 - orr r6, r6, r7, lsr #24 - mov r7, r7, lsl #8 - orr r7, r7, ip, lsr #24 -#else orr r4, r4, r5, lsl #24 mov r5, r5, lsr #8 orr r5, r5, r6, lsl #24 @@ -324,7 +311,6 @@ ENTRY(copyin) orr r6, r6, r7, lsl #24 mov r7, r7, lsr #8 orr r7, r7, ip, lsl #24 -#endif str r4, [r1], #0x04 str r5, [r1], #0x04 str r6, [r1], #0x04 @@ -341,43 +327,22 @@ ENTRY(copyin) blt .Lcopyin_l4 .Lcopyin_bad1_loop4: -#ifdef __ARMEB__ - mov r4, ip, lsl #8 -#else mov r4, ip, lsr #8 -#endif ldrtip, [r0], #0x04 subsr2, r2, #0x04 -#ifdef __ARMEB__ - orr r4, r4, ip, lsr #24 -#else orr r4, r4, ip, lsl #24 -#endif str r4, [r1], #0x04 bge .Lcopyin_bad1_loop4 sub r0, r0, #0x03 b .Lcopyin_l4 .Lcopyin_bad2_loop16: -#ifdef __ARMEB__ - mov r4, ip, lsl #16 -#else mov r4, ip, lsr #16 -#endif ldrtr5, [r0], #0x04 pld [r0, #0x018] ldrtr6, [r0], #0x04 ldrtr7, [r0], #0x04 ldrtip, [r0], #0x04 -#ifdef __ARMEB__ - orr r4, r4, r5, lsr #16 - mov r5, r5, lsl #16 - orr r5, r5, r6, lsr #16 - mov r6, r6, lsl #16 - orr r6, r6, r7, lsr #16 - mov r7, r7, lsl #16 - orr r7, r7, ip, lsr #16 -#else orr r4, r4, r5, lsl #16 mov r5, r5, lsr #16 orr r5, r5, r6, lsl #16 @@ -385,7 +350,6 @@ ENTRY(copyin) orr r6, r6, r7, lsl #16 mov r7, r7, lsr #16 orr r7, r7, ip, lsl #16 -#endif str r4, [r1], #0x04 str r5, [r1], #0x04 str r6, [r1], #0x04 @@ -402,43 +366,22 @@ ENTRY(copyin) blt .Lcopyin_l4 .Lcopyin_bad2_loop4: -#ifdef __ARMEB__ - mov r4, ip, lsl #16 -#else mov r4, ip, lsr #16 -#endif ldrtip, [r0], #0x04 subsr2, r2, #0x04 -#ifdef __ARMEB__ - orr r4, r4, ip, lsr #16 -#else orr r4, r4, ip, lsl #16 -#endif str r4, [r1], #0x04 bge .Lcopyin_bad2_loop4 sub r0, r0, #0x02 b .Lcopyin_l4 .Lcopyin_bad3_loop16: -#ifdef __ARMEB__ - mov r4, ip, lsl #24 -#else mov r4, ip, lsr #24 -#endif ldrtr5, [r0], #0x04 pld [r0, #0x018] ldrtr6, [r0], #0x04 ldrtr7, [r0], #0x04 ldrtip, [r0], #0x04 -#ifdef __ARMEB__ - orr r4, r4, r5, lsr #8 - mov r5, r5, lsl #24 - orr r5, r5, r6, lsr #8 - mov r6, r6, lsl #24 - orr r6, r6, r7, lsr #8 - mov r7, r7, lsl #24 - orr r7, r7, ip, lsr #8 -#else orr r4, r4, r5, lsl #8 mov r5, r5, lsr #24 orr r5, r5, r6, lsl #8 @@ -446,7 +389,6 @@ ENTRY(copyin) orr r6, r6, r7, lsl #8 mov r7, r7, lsr #24 orr r7, r7, ip, lsl #8 -#endif str r4, [r1], #0x04 str r5, [r1], #0x04 str r6, [r1], #0x04 @@ -463,18 +405,10 @@ ENTRY(copyin) blt .Lcopyin_l4 .Lcopyin_bad3_loop4: -#ifdef __ARMEB__ - mov r4, ip, lsl #24 -#else mov r4, ip, lsr #24 -#endif ldrtip, [r0], #0x04 subsr2, r2, #0x04 -#ifdef __ARMEB__ - orr r4, r4, ip, lsr #8 -#else orr r4, r4, ip, lsl #8 -#endif str r4, [r1], #0x04 bge .Lcopyin_bad3_loop4 sub r0, r0, #0x01 @@ -750,25 +684,12 @@ ENTRY(copyout) b .Lcopyout_bad1 .Lcopyout_bad1_loop16: -#ifdef __ARMEB__ -
Re: svn commit: r368124 - in head/sys: cam cam/ata cam/ctl cam/mmc cam/nvme cam/scsi compat/linprocfs compat/linux conf contrib/openzfs/module/os/freebsd/zfs dev/ahci dev/ata dev/firewire dev/flash de
On 28.11.2020 13:12, Konstantin Belousov wrote: Author: kib Date: Sat Nov 28 12:12:51 2020 New Revision: 368124 URL: https://svnweb.freebsd.org/changeset/base/368124 Log: Make MAXPHYS tunable. Bump MAXPHYS to 1M. Unfortunately, bumping MAXPHYS broke arm kernel. The kernel runs out of KVA while running 'pbuf' keg init function. This causes that keg_alloc_slab() always returns NULL and for cycle in uma_prealloc() newer ends (whish should be considered as another bug). Do you think that MAXPHYS constant can depends on given arch? 128k (or 256k) sounds reasonable for arm32 systems... Michal Replace MAXPHYS by runtime variable maxphys. It is initialized from MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys. Make b_pages[] array in struct buf flexible. Size b_pages[] for buffer cache buffers exactly to atop(maxbcachebuf) (currently it is sized to atop(MAXPHYS)), and b_pages[] for pbufs is sized to atop(maxphys) + 1. The +1 for pbufs allow several pbuf consumers, among them vmapbuf(), to use unaligned buffers still sized to maxphys, esp. when such buffers come from userspace (*). Overall, we save significant amount of otherwise wasted memory in b_pages[] for buffer cache buffers, while bumping MAXPHYS to desired high value. Eliminate all direct uses of the MAXPHYS constant in kernel and driver sources, except a place which initialize maxphys. Some random (and arguably weird) uses of MAXPHYS, e.g. in linuxolator, are converted straight. Some drivers, which use MAXPHYS to size embeded structures, get private MAXPHYS-like constant; their convertion is out of scope for this work. Changes to cam/, dev/ahci, dev/ata, dev/mpr, dev/mpt, dev/mvs, dev/siis, where either submitted by, or based on changes by mav. Suggested by: mav (*) Reviewed by: imp, mav, imp, mckusick, scottl (intermediate versions) Tested by: pho Sponsored by:The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D27225 Modified: head/sys/cam/ata/ata_da.c head/sys/cam/cam_compat.c head/sys/cam/cam_periph.c head/sys/cam/cam_xpt.c head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/mmc/mmc_da.c head/sys/cam/nvme/nvme_da.c head/sys/cam/scsi/scsi_cd.c head/sys/cam/scsi/scsi_da.c head/sys/cam/scsi/scsi_pass.c head/sys/cam/scsi/scsi_sa.c head/sys/cam/scsi/scsi_sg.c head/sys/cam/scsi/scsi_target.c head/sys/compat/linprocfs/linprocfs.c head/sys/compat/linux/linux_ioctl.c head/sys/conf/options head/sys/contrib/openzfs/module/os/freebsd/zfs/vdev_geom.c head/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c head/sys/dev/ahci/ahci.c head/sys/dev/ahci/ahci.h head/sys/dev/ahci/ahciem.c head/sys/dev/ata/ata-all.c head/sys/dev/ata/ata-all.h head/sys/dev/ata/ata-dma.c head/sys/dev/firewire/sbp.c head/sys/dev/flash/cqspi.c head/sys/dev/isci/scil/sci_controller_constants.h head/sys/dev/iscsi/iscsi.c head/sys/dev/md/md.c head/sys/dev/mfi/mfi.c head/sys/dev/mpr/mpr.c head/sys/dev/mps/mps.c head/sys/dev/mpt/mpt.c head/sys/dev/mpt/mpt.h head/sys/dev/mrsas/mrsas.c head/sys/dev/mvs/mvs.c head/sys/dev/mvs/mvs.h head/sys/dev/nvme/nvme.h head/sys/dev/nvme/nvme_ctrlr.c head/sys/dev/pms/freebsd/driver/ini/src/agdef.h head/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c head/sys/dev/sdhci/sdhci.c head/sys/dev/siis/siis.c head/sys/dev/siis/siis.h head/sys/dev/sym/sym_conf.h head/sys/dev/usb/storage/umass.c head/sys/dev/virtio/block/virtio_blk.c head/sys/dev/virtio/scsi/virtio_scsi.c head/sys/dev/xen/blkback/blkback.c head/sys/dev/xen/blkfront/blkfront.c head/sys/fs/cd9660/cd9660_vfsops.c head/sys/fs/ext2fs/ext2_vfsops.c head/sys/fs/fuse/fuse_vfsops.c head/sys/fs/msdosfs/msdosfs_vfsops.c head/sys/fs/udf/udf_vfsops.c head/sys/geom/cache/g_cache.c head/sys/geom/eli/g_eli_integrity.c head/sys/geom/geom_dev.c head/sys/geom/geom_io.c head/sys/geom/journal/g_journal.c head/sys/geom/journal/g_journal.h head/sys/geom/mirror/g_mirror.c head/sys/geom/nop/g_nop.c head/sys/geom/part/g_part_apm.c head/sys/geom/part/g_part_gpt.c head/sys/geom/part/g_part_ldm.c head/sys/geom/raid/md_ddf.c head/sys/geom/raid/md_promise.c head/sys/geom/raid3/g_raid3.c head/sys/geom/shsec/g_shsec.c head/sys/geom/stripe/g_stripe.c head/sys/geom/uzip/g_uzip.c head/sys/geom/vinum/geom_vinum_var.h head/sys/geom/virstor/g_virstor.c head/sys/geom/virstor/g_virstor.h head/sys/kern/kern_mib.c head/sys/kern/kern_physio.c head/sys/kern/kern_sendfile.c head/sys/kern/subr_param.c head/sys/kern/vfs_aio.c head/sys/kern/vfs_bio.c head/sys/kern/vfs_cluster.c head/sys/kern/vfs_default.c head/sys/mips/ingenic/jz4780_mmc.c head/sys/net/if.c head/sys/powerpc/mambo/mambo_disk.c head/sys/powerpc/mpc85xx/fsl_sata.c
svn commit: r368141 - in head/sys/arm: allwinner annapurna/alpine arm freescale/imx include mv versatile
Author: mmel Date: Sun Nov 29 08:40:12 2020 New Revision: 368141 URL: https://svnweb.freebsd.org/changeset/base/368141 Log: Remove the pre-ARMv6 and pre-INTRNG code. ARM has required ARMV6+ and INTRNg for some time now, so remove always false #ifdefs and unconditionally do always true #ifdefs. Deleted: head/sys/arm/annapurna/alpine/alpine_common.c head/sys/arm/freescale/imx/imx_common.c head/sys/arm/versatile/versatile_common.c Modified: head/sys/arm/allwinner/aw_gpio.c head/sys/arm/allwinner/files.allwinner head/sys/arm/annapurna/alpine/files.alpine head/sys/arm/arm/bcopyinout.S head/sys/arm/arm/bcopyinout_xscale.S head/sys/arm/arm/bus_space_base.c head/sys/arm/arm/copystr.S head/sys/arm/arm/cpuinfo.c head/sys/arm/arm/db_interface.c head/sys/arm/arm/debug_monitor.c head/sys/arm/arm/disassem.c head/sys/arm/arm/elf_machdep.c head/sys/arm/arm/exception.S head/sys/arm/arm/fiq.c head/sys/arm/arm/fusu.S head/sys/arm/arm/genassym.c head/sys/arm/arm/machdep.c head/sys/arm/arm/machdep_intr.c head/sys/arm/arm/machdep_kdb.c head/sys/arm/arm/mem.c head/sys/arm/arm/minidump_machdep.c head/sys/arm/arm/mp_machdep.c head/sys/arm/arm/nexus.c head/sys/arm/arm/stdatomic.c head/sys/arm/arm/sys_machdep.c head/sys/arm/arm/vm_machdep.c head/sys/arm/freescale/imx/files.imx5 head/sys/arm/include/_align.h head/sys/arm/include/armreg.h head/sys/arm/include/asmacros.h head/sys/arm/include/atomic-v6.h head/sys/arm/include/bus.h head/sys/arm/include/bus_dma.h head/sys/arm/include/cpu-v6.h head/sys/arm/include/cpufunc.h head/sys/arm/include/cpuinfo.h head/sys/arm/include/db_machdep.h head/sys/arm/include/debug_monitor.h head/sys/arm/include/fdt.h head/sys/arm/include/frame.h head/sys/arm/include/intr.h head/sys/arm/include/kdb.h head/sys/arm/include/machdep.h head/sys/arm/include/pcpu.h head/sys/arm/include/proc.h head/sys/arm/include/sf_buf.h head/sys/arm/include/sysarch.h head/sys/arm/include/sysreg.h head/sys/arm/include/vm.h head/sys/arm/mv/gpio.c head/sys/arm/mv/mpic.c head/sys/arm/mv/mv_common.c head/sys/arm/mv/mv_pci.c head/sys/arm/versatile/files.versatile Modified: head/sys/arm/allwinner/aw_gpio.c == --- head/sys/arm/allwinner/aw_gpio.cSun Nov 29 01:43:04 2020 (r368140) +++ head/sys/arm/allwinner/aw_gpio.cSun Nov 29 08:40:12 2020 (r368141) @@ -62,10 +62,7 @@ __FBSDID("$FreeBSD$"); #include "opt_soc.h" #endif -#ifdef INTRNG #include "pic_if.h" -#endif - #include "gpio_if.h" #defineAW_GPIO_DEFAULT_CAPS(GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \ @@ -257,7 +254,6 @@ struct clk_list { clk_t clk; }; -#ifdef INTRNG struct gpio_irqsrc { struct intr_irqsrc isrc; u_int irq; @@ -269,7 +265,6 @@ struct gpio_irqsrc { uint32_toldfunc; boolenabled; }; -#endif #defineAW_GPIO_MEMRES 0 #defineAW_GPIO_IRQRES 1 @@ -286,10 +281,8 @@ struct aw_gpio_softc { struct aw_gpio_conf *conf; TAILQ_HEAD(, clk_list) clk_list; -#ifdef INTRNG struct gpio_irqsrc *gpio_pic_irqsrc; int nirqs; -#endif }; static struct resource_spec aw_gpio_res_spec[] = { @@ -1071,10 +1064,8 @@ aw_gpio_attach(device_t dev) goto fail; } -#ifdef INTRNG aw_gpio_register_isrcs(sc); intr_pic_register(dev, OF_xref_from_node(ofw_bus_get_node(dev))); -#endif sc->sc_busdev = gpiobus_attach_bus(dev); if (sc->sc_busdev == NULL) @@ -1451,7 +1442,6 @@ static device_method_t aw_gpio_methods[] = { DEVMETHOD(device_attach,aw_gpio_attach), DEVMETHOD(device_detach,aw_gpio_detach), -#ifdef INTRNG /* Interrupt controller interface */ DEVMETHOD(pic_disable_intr, aw_gpio_pic_disable_intr), DEVMETHOD(pic_enable_intr, aw_gpio_pic_enable_intr), @@ -1461,7 +1451,6 @@ static device_method_t aw_gpio_methods[] = { DEVMETHOD(pic_post_filter, aw_gpio_pic_post_filter), DEVMETHOD(pic_post_ithread, aw_gpio_pic_post_ithread), DEVMETHOD(pic_pre_ithread, aw_gpio_pic_pre_ithread), -#endif /* GPIO protocol */ DEVMETHOD(gpio_get_bus, aw_gpio_get_bus), Modified: head/sys/arm/allwinner/files.allwinner == --- head/sys/arm/allwinner/files.allwinner Sun Nov 29 01:43:04 2020 (r368140) +++ head/sys/arm/allwinner/files.allwinner Sun Nov 29 08:40:12 2020 (r368141) @@ -10,7 +10,7 @@ arm/allwinner/aw_if_dwc.c optionaldwc arm/allwinner/aw_machdep.c standard arm/allwinner/aw_mmc.c optionalmmc | mmccam
svn commit: r368126 - in head/sys: arm/arm arm/include conf
Author: mmel Date: Sat Nov 28 15:00:08 2020 New Revision: 368126 URL: https://svnweb.freebsd.org/changeset/base/368126 Log: Remove now unused armv4 and not-INTRNG files. Deleted: head/sys/arm/arm/identcpu-v4.c head/sys/arm/arm/intr.c head/sys/arm/arm/locore-v4.S head/sys/arm/arm/pmap-v4.c head/sys/arm/arm/swtch-v4.S head/sys/arm/arm/trap-v4.c head/sys/arm/include/atomic-v4.h head/sys/arm/include/cpu-v4.h head/sys/arm/include/pmap-v4.h head/sys/arm/include/pte-v4.h Modified: head/sys/arm/arm/cpufunc.c head/sys/arm/arm/locore.S head/sys/arm/include/atomic.h head/sys/arm/include/cpu.h head/sys/arm/include/pmap.h head/sys/conf/files.arm Modified: head/sys/arm/arm/cpufunc.c == --- head/sys/arm/arm/cpufunc.c Sat Nov 28 12:19:20 2020(r368125) +++ head/sys/arm/arm/cpufunc.c Sat Nov 28 15:00:08 2020(r368126) @@ -256,9 +256,6 @@ struct cpu_functions cortexa_cpufuncs = { struct cpu_functions cpufuncs; u_int cputype; -#if __ARM_ARCH <= 5 -u_int cpu_reset_needs_v4_MMU_disable; /* flag used in locore-v4.s */ -#endif #if defined (CPU_ARM9E) || \ defined(CPU_ARM1176) || \ Modified: head/sys/arm/arm/locore.S == --- head/sys/arm/arm/locore.S Sat Nov 28 12:19:20 2020(r368125) +++ head/sys/arm/arm/locore.S Sat Nov 28 15:00:08 2020(r368126) @@ -34,8 +34,4 @@ #include -#if __ARM_ARCH >= 6 #include "locore-v6.S" -#else -#include "locore-v4.S" -#endif Modified: head/sys/arm/include/atomic.h == --- head/sys/arm/include/atomic.h Sat Nov 28 12:19:20 2020 (r368125) +++ head/sys/arm/include/atomic.h Sat Nov 28 15:00:08 2020 (r368126) @@ -49,11 +49,7 @@ #include #endif -#if __ARM_ARCH >= 6 #include -#else /* < armv6 */ -#include -#endif /* Arch >= v6 */ static __inline u_long atomic_swap_long(volatile u_long *p, u_long v) Modified: head/sys/arm/include/cpu.h == --- head/sys/arm/include/cpu.h Sat Nov 28 12:19:20 2020(r368125) +++ head/sys/arm/include/cpu.h Sat Nov 28 15:00:08 2020(r368126) @@ -11,11 +11,7 @@ void cpu_halt(void); void swi_vm(void *); #ifdef _KERNEL -#if __ARM_ARCH >= 6 #include -#else -#include -#endif /* __ARM_ARCH >= 6 */ static __inline uint64_t get_cyclecount(void) Modified: head/sys/arm/include/pmap.h == --- head/sys/arm/include/pmap.h Sat Nov 28 12:19:20 2020(r368125) +++ head/sys/arm/include/pmap.h Sat Nov 28 15:00:08 2020(r368126) @@ -32,11 +32,7 @@ #ifndef _MACHINE_PMAP_H_ #define _MACHINE_PMAP_H_ -#if __ARM_ARCH >= 6 #include -#else -#include -#endif #ifdef _KERNEL #include Modified: head/sys/conf/files.arm == --- head/sys/conf/files.arm Sat Nov 28 12:19:20 2020(r368125) +++ head/sys/conf/files.arm Sat Nov 28 15:00:08 2020(r368126) @@ -19,7 +19,7 @@ arm/arm/cpufunc_asm_armv7.S optionalcpu_cortexa | cpu arm/arm/cpufunc_asm_pj4b.S optionalcpu_mv_pj4b arm/arm/cpufunc_asm_sheeva.S optionalcpu_arm9e arm/arm/cpuinfo.c standard -arm/arm/cpu_asm-v6.S optionalarmv7 | armv6 +arm/arm/cpu_asm-v6.S standard arm/arm/db_disasm.coptionalddb arm/arm/db_interface.c optionalddb arm/arm/db_trace.c optionalddb @@ -37,14 +37,12 @@ arm/arm/gdb_machdep.c optionalgdb arm/arm/generic_timer.coptionalgeneric_timer arm/arm/gic.c optionalgic arm/arm/gic_fdt.c optionalgic fdt -arm/arm/identcpu-v4.c optional!armv7 !armv6 -arm/arm/identcpu-v6.c optionalarmv7 | armv6 +arm/arm/identcpu-v6.c standard arm/arm/in_cksum.c optionalinet | inet6 arm/arm/in_cksum_arm.S optionalinet | inet6 -arm/arm/intr.c optional!intrng -kern/subr_intr.c optionalintrng +kern/subr_intr.c standard arm/arm/locore.S standardno-obj -arm/arm/hypervisor-stub.S optionalarmv7 | armv6 +arm/arm/hypervisor-stub.S standard arm/arm/machdep.c standard arm/arm/machdep_boot.c standard arm/arm/machdep_kdb.c standard @@ -61,8 +59,7 @@ arm/arm/pl310.c optionalpl310 arm/arm/platform.c optionalplatform arm/arm/platform_if.m optionalplatform arm/arm/platform_pl310_if.moptionalplatform pl310
svn commit: r367955 - head/sys/dev/nvme
Author: mmel Date: Mon Nov 23 14:30:22 2020 New Revision: 367955 URL: https://svnweb.freebsd.org/changeset/base/367955 Log: Ensure that the buffer is in nvme_single_map() mapped to single segment. Not a functional change. MFC after:1 week Modified: head/sys/dev/nvme/nvme_private.h Modified: head/sys/dev/nvme/nvme_private.h == --- head/sys/dev/nvme/nvme_private.hMon Nov 23 14:26:59 2020 (r367954) +++ head/sys/dev/nvme/nvme_private.hMon Nov 23 14:30:22 2020 (r367955) @@ -478,6 +478,7 @@ nvme_single_map(void *arg, bus_dma_segment_t *seg, int { uint64_t *bus_addr = (uint64_t *)arg; + KASSERT(nseg == 1, ("number of segments (%d) is not 1", nseg)); if (error != 0) printf("nvme_single_map err %d\n", error); *bus_addr = seg[0].ds_addr; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367865 - head/sys/kern
Author: mmel Date: Fri Nov 20 09:05:36 2020 New Revision: 367865 URL: https://svnweb.freebsd.org/changeset/base/367865 Log: Also pass interrupt binding request to non-root interrupt controllers. There are message based controllers that can bind interrupts even if they are not implemented as root controllers (such as the ITS subblock of GIC). MFC after:3 weeks Modified: head/sys/kern/subr_intr.c Modified: head/sys/kern/subr_intr.c == --- head/sys/kern/subr_intr.c Fri Nov 20 08:07:29 2020(r367864) +++ head/sys/kern/subr_intr.c Fri Nov 20 09:05:36 2020(r367865) @@ -588,9 +588,6 @@ intr_isrc_assign_cpu(void *arg, int cpu) struct intr_irqsrc *isrc = arg; int error; - if (isrc->isrc_dev != intr_irq_root_dev) - return (EINVAL); - mtx_lock(_table_lock); if (cpu == NOCPU) { CPU_ZERO(>isrc_cpu); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367447 - in head/sys: kern sys
Author: mmel Date: Sat Nov 7 14:58:01 2020 New Revision: 367447 URL: https://svnweb.freebsd.org/changeset/base/367447 Log: Add a method to determine whether given interrupt is per CPU or not. MFC after:2 weeks Modified: head/sys/kern/subr_intr.c head/sys/sys/intr.h Modified: head/sys/kern/subr_intr.c == --- head/sys/kern/subr_intr.c Sat Nov 7 13:16:11 2020(r367446) +++ head/sys/kern/subr_intr.c Sat Nov 7 14:58:01 2020(r367447) @@ -946,6 +946,21 @@ intr_resolve_irq(device_t dev, intptr_t xref, struct i } } +bool +intr_is_per_cpu(struct resource *res) +{ + u_int res_id; + struct intr_irqsrc *isrc; + + res_id = (u_int)rman_get_start(res); + isrc = intr_map_get_isrc(res_id); + + if (isrc == NULL) + panic("Attempt to get isrc for non-active resource id: %u\n", + res_id); + return ((isrc->isrc_flags & INTR_ISRCF_PPI) != 0); +} + int intr_activate_irq(device_t dev, struct resource *res) { Modified: head/sys/sys/intr.h == --- head/sys/sys/intr.h Sat Nov 7 13:16:11 2020(r367446) +++ head/sys/sys/intr.h Sat Nov 7 14:58:01 2020(r367447) @@ -115,6 +115,7 @@ int intr_pic_deregister(device_t, intptr_t); int intr_pic_claim_root(device_t, intptr_t, intr_irq_filter_t *, void *, u_int); struct intr_pic *intr_pic_add_handler(device_t, struct intr_pic *, intr_child_irq_filter_t *, void *, uintptr_t, uintptr_t); +bool intr_is_per_cpu(struct resource *); extern device_t intr_irq_root_dev; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367268 - head/sys/arm64/arm64
Author: mmel Date: Mon Nov 2 08:26:19 2020 New Revision: 367268 URL: https://svnweb.freebsd.org/changeset/base/367268 Log: Improve loading of multipage aligned buffers. The multipage alignment requirements is incompatible with many aspects of actual busdma code. Multi-page alignment requests are incompatible with many aspects of current busdma code. Mainly with partially bounced buffer segments and per-page loop in bus_dmamap_load_buffer(). Because proper implementation would be a major restructuring of the code, add the fix only for already known uses and do KASSERT for all other cases. For this reason, bus_dmamap_load_buffer () should take the memory allocated by bus_dmam_alloc () as one segment bypassing per page segmentation. We can do this because it is guaranteed that the memory is physically continuous. Reviewed by: bz Tested by:imp, mv, daniel.engberg.lists_pyret.net, kjopek_gmail.com Differential Revision: https://reviews.freebsd.org/D26735 Modified: head/sys/arm64/arm64/busdma_bounce.c Modified: head/sys/arm64/arm64/busdma_bounce.c == --- head/sys/arm64/arm64/busdma_bounce.cMon Nov 2 06:16:11 2020 (r367267) +++ head/sys/arm64/arm64/busdma_bounce.cMon Nov 2 08:26:19 2020 (r367268) @@ -501,13 +501,6 @@ static int bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, bus_dmamap_t *mapp) { - /* -* XXX ARM64TODO: -* This bus_dma implementation requires IO-Coherent architecutre. -* If IO-Coherency is not guaranteed, the BUS_DMA_COHERENT flag has -* to be implented using non-cacheable memory. -*/ - vm_memattr_t attr; int mflags; @@ -830,7 +823,19 @@ bounce_bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dm sgsize = MIN(buflen, dmat->common.maxsegsz); if (map->pagesneeded != 0 && must_bounce(dmat, map, curaddr, sgsize)) { - sgsize = MIN(sgsize, PAGE_SIZE - (curaddr & PAGE_MASK)); + /* +* The attempt to split a physically continuous buffer +* seems very controversial, it's unclear whether we +* can do this in all cases. Also, memory for bounced +* buffers is allocated as pages, so we cannot +* guarantee multipage alignment. +*/ + KASSERT(dmat->common.alignment <= PAGE_SIZE, + ("bounced buffer cannot have alignment bigger " + "than PAGE_SIZE: %lu", dmat->common.alignment)); + sgsize = PAGE_SIZE - (curaddr & PAGE_MASK); + sgsize = roundup2(sgsize, dmat->common.alignment); + sgsize = MIN(sgsize, dmat->common.maxsegsz); curaddr = add_bounce_page(dmat, map, 0, curaddr, sgsize); } else if ((map->flags & DMAMAP_COHERENT) == 0) { @@ -843,11 +848,11 @@ bounce_bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dm sl++; sl->vaddr = 0; sl->paddr = curaddr; - sl->datacount = sgsize; sl->pages = PHYS_TO_VM_PAGE(curaddr); KASSERT(sl->pages != NULL, ("%s: page at PA:0x%08lx is not in " "vm_page_array", __func__, curaddr)); + sl->datacount = sgsize; } else sl->datacount += sgsize; } @@ -880,6 +885,11 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_ vm_offset_t kvaddr, vaddr, sl_vend; int error; + KASSERT((map->flags & DMAMAP_FROM_DMAMEM) != 0 || + dmat->common.alignment <= PAGE_SIZE, + ("loading user buffer with alignment bigger than PAGE_SIZE is not " + "supported")); + if (segs == NULL) segs = dmat->segments; @@ -895,6 +905,11 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_ } } + /* +* XXX Optimally we should parse input buffer for physically +* continuous segments first and then pass these segment into +* load loop. +*/ sl = map->slist + map->sync_count - 1; vaddr = (vm_offset_t)buf; sl_pend = 0; @@ -916,15 +931,25 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_ * Compute the segment size, and adjust counts. */ max_sgsize = MIN(buflen, dmat->common.maxsegsz); - sgsize = PAGE_SIZE - (curaddr & PAGE_MASK); + if ((map->flags &
svn commit: r366700 - head/stand/efi/loader
Author: mmel Date: Wed Oct 14 13:13:14 2020 New Revision: 366700 URL: https://svnweb.freebsd.org/changeset/base/366700 Log: Add 'netserver' command to EFI loader. In some environments is difficult to access bootp/dhcp configuration as "standard user". Add a command that allows to set or display the URI of the network server used as "net:" device. Currently only tftp and nfs protocols are supported. Typical usage pattern is: netserver tftp://192.168.168.1/path_to_obj_dir/arm.armv7/sys/GENERIC/ boot net:kernel Reviewed by: imp, kevans MFC after:4 weeks Differential Revision: https://reviews.freebsd.org/D26736 Modified: head/stand/efi/loader/main.c Modified: head/stand/efi/loader/main.c == --- head/stand/efi/loader/main.cWed Oct 14 12:28:54 2020 (r366699) +++ head/stand/efi/loader/main.cWed Oct 14 13:13:14 2020 (r366700) @@ -40,10 +40,14 @@ __FBSDID("$FreeBSD$"); #include #endif #include +#include +#include #include #include #include #include +#include +#include #include #include @@ -1594,3 +1598,34 @@ command_chain(int argc, char *argv[]) } COMMAND_SET(chain, "chain", "chain load file", command_chain); + +extern struct in_addr servip; +static int +command_netserver(int argc, char *argv[]) +{ + char *proto; + n_long rootaddr; + + if (argc > 2) { + command_errmsg = "wrong number of arguments"; + return (CMD_ERROR); + } + if (argc < 2) { + proto = netproto == NET_TFTP ? "tftp://; : "nfs://"; + printf("Netserver URI: %s%s%s\n", proto, intoa(rootip.s_addr), + rootpath); + return (CMD_OK); + } + if (argc == 2) { + strncpy(rootpath, argv[1], sizeof(rootpath)); + rootpath[sizeof(rootpath) -1] = '\0'; + if ((rootaddr = net_parse_rootpath()) != INADDR_NONE) + servip.s_addr = rootip.s_addr = rootaddr; + return (CMD_OK); + } + return (CMD_ERROR); /* not reached */ + +} + +COMMAND_SET(netserver, "netserver", "change or display netserver URI", +command_netserver); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r366161 - head/sys/dev/extres/syscon
On 30.09.2020 18:33, Ed Maste wrote: > On Fri, 25 Sep 2020 at 12:44, Michal Meloun wrote: >> >> Author: mmel >> Date: Fri Sep 25 16:44:01 2020 >> New Revision: 366161 >> URL: https://svnweb.freebsd.org/changeset/base/366161 > > The pine64 in CI is currently broken, panicking at boot with: > panic: mutex aw_syscon0 owned at > /usr/src/sys/dev/extres/syscon/syscon_generic.c:98 > > Log: > https://ci.freebsd.org/hwlab/job/FreeBSD-device-head-pinea64-test/6480/artifact/device_tests/pinea64.boot.log > > It's possible there's an outdated dtb involved here, as there was with > the BBB. Hopefully manu's change to report/check the dtb version makes > it in and can be used to help track these issues down. > > Unfortunately the USB-serial interface connected to the pine64 was > broken until yesterday so I'm not sure for how long this has been > broken in this way. The last successful run was at r364130 almost 2 > months ago; the first failure after that was because of an apparent > hang at shutdown. Fixed in r66312. I never realized that the syscon_generic methods are not called on any of my boards even though their DTs have syscon_generic node. Michal ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366312 - head/sys/dev/extres/syscon
Author: mmel Date: Thu Oct 1 09:50:08 2020 New Revision: 366312 URL: https://svnweb.freebsd.org/changeset/base/366312 Log: Fix the inverted condition in mtx_asserts. Mutex should be owned in affected functions. Reborted by: emaste MFC after:4 weeks MFC with: r366161 Modified: head/sys/dev/extres/syscon/syscon_generic.c Modified: head/sys/dev/extres/syscon/syscon_generic.c == --- head/sys/dev/extres/syscon/syscon_generic.c Thu Oct 1 08:57:36 2020 (r366311) +++ head/sys/dev/extres/syscon/syscon_generic.c Thu Oct 1 09:50:08 2020 (r366312) @@ -95,7 +95,7 @@ syscon_generic_unlocked_read_4(struct syscon *syscon, uint32_t val; sc = device_get_softc(syscon->pdev); - SYSCON_ASSERT_UNLOCKED(sc); + SYSCON_ASSERT_LOCKED(sc); val = bus_read_4(sc->mem_res, offset); return (val); } @@ -106,7 +106,7 @@ syscon_generic_unlocked_write_4(struct syscon *syscon, struct syscon_generic_softc *sc; sc = device_get_softc(syscon->pdev); - SYSCON_ASSERT_UNLOCKED(sc); + SYSCON_ASSERT_LOCKED(sc); bus_write_4(sc->mem_res, offset, val); return (0); } @@ -119,7 +119,7 @@ syscon_generic_unlocked_modify_4(struct syscon *syscon uint32_t val; sc = device_get_softc(syscon->pdev); - SYSCON_ASSERT_UNLOCKED(sc); + SYSCON_ASSERT_LOCKED(sc); val = bus_read_4(sc->mem_res, offset); val &= ~clear_bits; val |= set_bits; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r366196 - head/sys/arm64/conf
On 27.09.2020 19:51, Bjoern A. Zeeb wrote: > On 27 Sep 2020, at 10:15, Michal Meloun wrote: > >> Author: mmel >> Date: Sun Sep 27 10:15:03 2020 >> New Revision: 366196 >> URL: https://svnweb.freebsd.org/changeset/base/366196 >> >> Log: >>  Add LINUX_BOOT_ABI back to arm64 GENERIC kernel. >> >>  It was removed in r355289 but forgot to return it back when new >> u-boot booti >>  support was committed. Although booti is not the preferred method of >>  booting the kernel, it is very useful for the initial phase of porting >>  FreeBSD to a new platform or booting the kernel on various embedded >> boards >>  in an industrial environment. > > Seem this prevents (at least my) kernels to boot from loader. > > Removing the option and rebuilding and the kernel booted. > It should be fixed in r366219. Sorry for troubles and thanks for report. Michal ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366219 - head/sys/arm64/arm64
Author: mmel Date: Mon Sep 28 09:16:27 2020 New Revision: 366219 URL: https://svnweb.freebsd.org/changeset/base/366219 Log: Fix booting arm64 EFI with LINUX_BOOT_ABI enabled. Use address of the pointer passed to kernel to determine whether the pointer is a FDT block (physical address) or a module pointer (virtual kernel address). This fragment was supposed to be committed before r366196, but I accidentally skipped it in a patch series. Reported by: bz Modified: head/sys/arm64/arm64/locore.S Modified: head/sys/arm64/arm64/locore.S == --- head/sys/arm64/arm64/locore.S Mon Sep 28 07:59:50 2020 (r366218) +++ head/sys/arm64/arm64/locore.S Mon Sep 28 09:16:27 2020 (r366219) @@ -46,8 +46,6 @@ /* U-Boot booti related constants. */ #if defined(LINUX_BOOT_ABI) -#define FDT_MAGIC 0xEDFE0DD0 /* FDT blob Magic */ - #ifndef UBOOT_IMAGE_OFFSET #defineUBOOT_IMAGE_OFFSET 0 /* Image offset from start of */ #endif /* 2 MiB page */ @@ -408,11 +406,12 @@ create_pagetables: /* No modules or FDT pointer ? */ cbz x0, booti_no_fdt - /* Test if modulep points to modules descriptor or to FDT */ - ldr w8, [x0] - ldr w7, =FDT_MAGIC - cmp w7, w8 - b.eqbooti_fdt + /* +* Test if x0 points to modules descriptor(virtual address) or +* to FDT (physical address) +*/ + cmp x0, x6 /* x6 is #(KERNBASE) */ + b.lobooti_fdt #endif /* Booted with modules pointer */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366200 - head/sys/arm64/qoriq/clk
Author: mmel Date: Sun Sep 27 16:15:03 2020 New Revision: 366200 URL: https://svnweb.freebsd.org/changeset/base/366200 Log: Check the result of the function, not the pointer to it. Modified: head/sys/arm64/qoriq/clk/qoriq_clkgen.c Modified: head/sys/arm64/qoriq/clk/qoriq_clkgen.c == --- head/sys/arm64/qoriq/clk/qoriq_clkgen.c Sun Sep 27 13:32:02 2020 (r366199) +++ head/sys/arm64/qoriq/clk/qoriq_clkgen.c Sun Sep 27 16:15:03 2020 (r366200) @@ -83,7 +83,7 @@ qoriq_clkgen_ofw_mapper(struct clkdom *clkdom, uint32_ *clk = clknode_find_by_id(clkdom, QORIQ_CLK_ID(cells[0], cells[1])); - if (clk == NULL) + if (*clk == NULL) return (EINVAL); return (0); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366197 - head/sys/arm/arm
Author: mmel Date: Sun Sep 27 11:37:17 2020 New Revision: 366197 URL: https://svnweb.freebsd.org/changeset/base/366197 Log: Don't send a signal with uninitialized 'sig' and 'code' fields. We have a few shortcuts in the arm trap code to speed up obvious "must fail" cases. In these situations, make sure that we fill in the "sig" and "code" fields of the generated signal. MFC after:3 weeks Modified: head/sys/arm/arm/trap-v6.c Modified: head/sys/arm/arm/trap-v6.c == --- head/sys/arm/arm/trap-v6.c Sun Sep 27 10:15:03 2020(r366196) +++ head/sys/arm/arm/trap-v6.c Sun Sep 27 11:37:17 2020(r366197) @@ -464,8 +464,11 @@ abort_handler(struct trapframe *tf, int prefetch) /* * Don't allow user-mode faults in kernel address space. */ - if (usermode) + if (usermode) { + ksig.sig = SIGSEGV; + ksig.code = SEGV_ACCERR; goto nogo; + } map = kernel_map; } else { @@ -474,8 +477,11 @@ abort_handler(struct trapframe *tf, int prefetch) * is NULL or curproc->p_vmspace is NULL the fault is fatal. */ vm = (p != NULL) ? p->p_vmspace : NULL; - if (vm == NULL) + if (vm == NULL) { + ksig.sig = SIGSEGV; + ksig.code = 0; goto nogo; + } map = >vm_map; if (!usermode && (td->td_intr_nesting_level != 0 || ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366196 - head/sys/arm64/conf
Author: mmel Date: Sun Sep 27 10:15:03 2020 New Revision: 366196 URL: https://svnweb.freebsd.org/changeset/base/366196 Log: Add LINUX_BOOT_ABI back to arm64 GENERIC kernel. It was removed in r355289 but forgot to return it back when new u-boot booti support was committed. Although booti is not the preferred method of booting the kernel, it is very useful for the initial phase of porting FreeBSD to a new platform or booting the kernel on various embedded boards in an industrial environment. Modified: head/sys/arm64/conf/GENERIC Modified: head/sys/arm64/conf/GENERIC == --- head/sys/arm64/conf/GENERIC Sun Sep 27 09:27:39 2020(r366195) +++ head/sys/arm64/conf/GENERIC Sun Sep 27 10:15:03 2020(r366196) @@ -79,6 +79,7 @@ options RACCT_DEFAULT_TO_DISABLED # Set kern.racct.en optionsRCTL# Resource limits optionsSMP optionsINTRNG +optionsLINUX_BOOT_ABI # Boot using booti command from U-Boot # Debugging support. Always need this: optionsKDB # Enable kernel debugger support. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366195 - head/sys/arm64/arm64
Author: mmel Date: Sun Sep 27 09:27:39 2020 New Revision: 366195 URL: https://svnweb.freebsd.org/changeset/base/366195 Log: Reapply r366193 with proper commit log. Don't map same physical memory multiple times with different cache attributes. This is explicitly stated as architectural undefined behavior, leading to coherency issues sooner or later. Modified: head/sys/arm64/arm64/locore.S Modified: head/sys/arm64/arm64/locore.S == --- head/sys/arm64/arm64/locore.S Sun Sep 27 09:24:31 2020 (r366194) +++ head/sys/arm64/arm64/locore.S Sun Sep 27 09:27:39 2020 (r366195) @@ -498,7 +498,7 @@ common: cbz x19, 1f /* Create the identity mapping for FDT data (2 MiB max) */ - mov x7, #(ATTR_S1_nG | ATTR_S1_IDX(VM_MEMATTR_UNCACHEABLE)) + mov x7, #(ATTR_S1_nG | ATTR_S1_IDX(VM_MEMATTR_WRITE_BACK)) mov x9, x0 mov x8, x0 /* VA start (== PA start) */ mov x10, #1 @@ -508,7 +508,7 @@ common: #endif /* Create the VA = PA map */ - mov x7, #(ATTR_S1_nG | ATTR_S1_IDX(VM_MEMATTR_UNCACHEABLE)) + mov x7, #(ATTR_S1_nG | ATTR_S1_IDX(VM_MEMATTR_WRITE_BACK)) mov x9, x27 mov x8, x9 /* VA start (== PA start) */ mov x10, #1 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366194 - head/sys/arm64/arm64
Author: mmel Date: Sun Sep 27 09:24:31 2020 New Revision: 366194 URL: https://svnweb.freebsd.org/changeset/base/366194 Log: Revert r366193, it was committed with unsaved commit log. Modified: head/sys/arm64/arm64/locore.S Modified: head/sys/arm64/arm64/locore.S == --- head/sys/arm64/arm64/locore.S Sun Sep 27 09:14:16 2020 (r366193) +++ head/sys/arm64/arm64/locore.S Sun Sep 27 09:24:31 2020 (r366194) @@ -498,7 +498,7 @@ common: cbz x19, 1f /* Create the identity mapping for FDT data (2 MiB max) */ - mov x7, #(ATTR_S1_nG | ATTR_S1_IDX(VM_MEMATTR_WRITE_BACK)) + mov x7, #(ATTR_S1_nG | ATTR_S1_IDX(VM_MEMATTR_UNCACHEABLE)) mov x9, x0 mov x8, x0 /* VA start (== PA start) */ mov x10, #1 @@ -508,7 +508,7 @@ common: #endif /* Create the VA = PA map */ - mov x7, #(ATTR_S1_nG | ATTR_S1_IDX(VM_MEMATTR_WRITE_BACK)) + mov x7, #(ATTR_S1_nG | ATTR_S1_IDX(VM_MEMATTR_UNCACHEABLE)) mov x9, x27 mov x8, x9 /* VA start (== PA start) */ mov x10, #1 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366193 - head/sys/arm64/arm64
Author: mmel Date: Sun Sep 27 09:14:16 2020 New Revision: 366193 URL: https://svnweb.freebsd.org/changeset/base/366193 Log: Don't map same physical memory multiple times with different cache attributes. This is explicitly stated as architectural undefined behavior, leadint to coherencz issues sonner or later. Modified: head/sys/arm64/arm64/locore.S Modified: head/sys/arm64/arm64/locore.S == --- head/sys/arm64/arm64/locore.S Sun Sep 27 09:12:36 2020 (r366192) +++ head/sys/arm64/arm64/locore.S Sun Sep 27 09:14:16 2020 (r366193) @@ -498,7 +498,7 @@ common: cbz x19, 1f /* Create the identity mapping for FDT data (2 MiB max) */ - mov x7, #(ATTR_S1_nG | ATTR_S1_IDX(VM_MEMATTR_UNCACHEABLE)) + mov x7, #(ATTR_S1_nG | ATTR_S1_IDX(VM_MEMATTR_WRITE_BACK)) mov x9, x0 mov x8, x0 /* VA start (== PA start) */ mov x10, #1 @@ -508,7 +508,7 @@ common: #endif /* Create the VA = PA map */ - mov x7, #(ATTR_S1_nG | ATTR_S1_IDX(VM_MEMATTR_UNCACHEABLE)) + mov x7, #(ATTR_S1_nG | ATTR_S1_IDX(VM_MEMATTR_WRITE_BACK)) mov x9, x27 mov x8, x9 /* VA start (== PA start) */ mov x10, #1 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366192 - head/sys/arm64/arm64
Author: mmel Date: Sun Sep 27 09:12:36 2020 New Revision: 366192 URL: https://svnweb.freebsd.org/changeset/base/366192 Log: Don't try to print EFI memeory map if it doesn't exist. MFC after: 1 week Modified: head/sys/arm64/arm64/machdep.c Modified: head/sys/arm64/arm64/machdep.c == --- head/sys/arm64/arm64/machdep.c Sun Sep 27 08:39:38 2020 (r366191) +++ head/sys/arm64/arm64/machdep.c Sun Sep 27 09:12:36 2020 (r366192) @@ -1258,7 +1258,8 @@ initarm(struct arm64_bootparams *abp) strlcpy(kernelname, env, sizeof(kernelname)); if (boothowto & RB_VERBOSE) { - print_efi_map_entries(efihdr); + if (efihdr != NULL) + print_efi_map_entries(efihdr); physmem_print_tables(); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366161 - head/sys/dev/extres/syscon
Author: mmel Date: Fri Sep 25 16:44:01 2020 New Revision: 366161 URL: https://svnweb.freebsd.org/changeset/base/366161 Log: Refine locking inside of syscon driver. In some cases, the syscon driver may be used by consumer requiring better control about locking (ie. it may be used as registe file provider for clock driver which needs locked access to multiple registers). Add fine locking protocol methods together with bunch of helper functions in syscon driver and implement this functionality in syscon_generic driver. MFC after:4 weeks Modified: head/sys/dev/extres/syscon/syscon.c head/sys/dev/extres/syscon/syscon_generic.c head/sys/dev/extres/syscon/syscon_if.m Modified: head/sys/dev/extres/syscon/syscon.c == --- head/sys/dev/extres/syscon/syscon.c Fri Sep 25 16:34:42 2020 (r366160) +++ head/sys/dev/extres/syscon/syscon.c Fri Sep 25 16:44:01 2020 (r366161) @@ -67,7 +67,13 @@ typedef TAILQ_HEAD(syscon_list, syscon) syscon_list_t; */ static int syscon_method_init(struct syscon *syscon); static int syscon_method_uninit(struct syscon *syscon); +static uint32_t syscon_method_read_4(struct syscon *syscon, bus_size_t offset); +static int syscon_method_write_4(struct syscon *syscon, bus_size_t offset, +uint32_t val); +static int syscon_method_modify_4(struct syscon *syscon, bus_size_t offset, +uint32_t clear_bits, uint32_t set_bits); + MALLOC_DEFINE(M_SYSCON, "syscon", "Syscon driver"); static syscon_list_t syscon_list = TAILQ_HEAD_INITIALIZER(syscon_list); @@ -80,6 +86,9 @@ SX_SYSINIT(syscon_topology, _topo_lock, "Syscon static syscon_method_t syscon_methods[] = { SYSCONMETHOD(syscon_init, syscon_method_init), SYSCONMETHOD(syscon_uninit, syscon_method_uninit), + SYSCONMETHOD(syscon_read_4, syscon_method_read_4), + SYSCONMETHOD(syscon_write_4,syscon_method_write_4), + SYSCONMETHOD(syscon_modify_4, syscon_method_modify_4), SYSCONMETHOD_END }; @@ -115,6 +124,39 @@ syscon_get_softc(struct syscon *syscon) return (syscon->softc); }; +static uint32_t +syscon_method_read_4(struct syscon *syscon, bus_size_t offset) +{ + uint32_t val; + + SYSCON_DEVICE_LOCK(syscon->pdev); + val = SYSCON_UNLOCKED_READ_4(syscon, offset); + SYSCON_DEVICE_UNLOCK(syscon->pdev); + return(val); +} + +static int +syscon_method_write_4(struct syscon *syscon, bus_size_t offset, uint32_t val) +{ + int rv; + + SYSCON_DEVICE_LOCK(syscon->pdev); + rv = SYSCON_UNLOCKED_WRITE_4(syscon, offset, val); + SYSCON_DEVICE_UNLOCK(syscon->pdev); + return(rv); +} + +static int +syscon_method_modify_4(struct syscon *syscon, bus_size_t offset, +uint32_t clear_bits, uint32_t set_bits) +{ + int rv; + + SYSCON_DEVICE_LOCK(syscon->pdev); + rv = SYSCON_UNLOCKED_MODIFY_4(syscon, offset, clear_bits, set_bits); + SYSCON_DEVICE_UNLOCK(syscon->pdev); + return(rv); +} /* * Create and initialize syscon object, but do not register it. */ @@ -254,14 +296,3 @@ syscon_get_by_ofw_property(device_t cdev, phandle_t cn return (0); } #endif - -int -syscon_get_handle_default(device_t dev, struct syscon **syscon) -{ - device_t parent; - - parent = device_get_parent(dev); - if (parent == NULL) - return (ENODEV); - return (SYSCON_GET_HANDLE(parent, syscon)); -} Modified: head/sys/dev/extres/syscon/syscon_generic.c == --- head/sys/dev/extres/syscon/syscon_generic.c Fri Sep 25 16:34:42 2020 (r366160) +++ head/sys/dev/extres/syscon/syscon_generic.c Fri Sep 25 16:44:01 2020 (r366161) @@ -55,11 +55,12 @@ __FBSDID("$FreeBSD$"); MALLOC_DECLARE(M_SYSCON); -static uint32_t syscon_generic_read_4(struct syscon *syscon, bus_size_t offset); -static int syscon_generic_write_4(struct syscon *syscon, bus_size_t offset, -uint32_t val); -static int syscon_generic_modify_4(struct syscon *syscon, bus_size_t offset, -uint32_t clear_bits, uint32_t set_bits); +static uint32_t syscon_generic_unlocked_read_4(struct syscon *syscon, +bus_size_t offset); +static int syscon_generic_unlocked_write_4(struct syscon *syscon, +bus_size_t offset, uint32_t val); +static int syscon_generic_unlocked_modify_4(struct syscon *syscon, +bus_size_t offset, uint32_t clear_bits, uint32_t set_bits); static int syscon_generic_detach(device_t dev); /* * Generic syscon driver (FDT) @@ -78,9 +79,9 @@ static struct ofw_compat_data compat_data[] = { #define SYSCON_ASSERT_UNLOCKED(_sc)mtx_assert(&(_sc)->mtx, MA_NOTOWNED); static syscon_method_t syscon_generic_methods[] = { - SYSCONMETHOD(syscon_read_4, syscon_generic_read_4), - SYSCONMETHOD(syscon_write_4,syscon_generic_write_4), - SYSCONMETHOD(syscon_modify_4,
svn commit: r366156 - in head/sys/dev: extres/syscon fdt
Author: mmel Date: Fri Sep 25 13:52:31 2020 New Revision: 366156 URL: https://svnweb.freebsd.org/changeset/base/366156 Log: Correctly handle nodes compatible with "syscon", "simple-bus". Syscon can also have child nodes that share a registration file with it. To do this correctly, follow these steps: - subclass syscon from simplebus and expose it if the node is also "simple-bus" compatible. - block simplebus probe for this compatible string, so it's priority (bus pass) doesn't colide with syscon driver. While I'm in, also block "syscon", "simple-mfd" for the same reason. MFC after:4 weeks Modified: head/sys/dev/extres/syscon/syscon_generic.c head/sys/dev/extres/syscon/syscon_generic.h head/sys/dev/fdt/simplebus.c Modified: head/sys/dev/extres/syscon/syscon_generic.c == --- head/sys/dev/extres/syscon/syscon_generic.c Fri Sep 25 13:28:57 2020 (r366155) +++ head/sys/dev/extres/syscon/syscon_generic.c Fri Sep 25 13:52:31 2020 (r366156) @@ -60,7 +60,7 @@ static int syscon_generic_write_4(struct syscon *sysco uint32_t val); static int syscon_generic_modify_4(struct syscon *syscon, bus_size_t offset, uint32_t clear_bits, uint32_t set_bits); - +static int syscon_generic_detach(device_t dev); /* * Generic syscon driver (FDT) */ @@ -152,7 +152,7 @@ static int syscon_generic_attach(device_t dev) { struct syscon_generic_softc *sc; - int rid; + int rid, rv; sc = device_get_softc(dev); sc->dev = dev; @@ -170,9 +170,20 @@ syscon_generic_attach(device_t dev) ofw_bus_get_node(dev)); if (sc->syscon == NULL) { device_printf(dev, "Failed to create/register syscon\n"); + syscon_generic_detach(dev); return (ENXIO); } - return (0); + if (ofw_bus_is_compatible(dev, "simple-bus")) { + rv = simplebus_attach_impl(sc->dev); + if (rv != 0) { + device_printf(dev, "Failed to create simplebus\n"); + syscon_generic_detach(dev); + return (ENXIO); + } + sc->simplebus_attached = true; + } + + return (bus_generic_attach(dev)); } static int @@ -185,7 +196,8 @@ syscon_generic_detach(device_t dev) syscon_unregister(sc->syscon); free(sc->syscon, M_SYSCON); } - + if (sc->simplebus_attached) + simplebus_detach(dev); SYSCON_LOCK_DESTROY(sc); if (sc->mem_res != NULL) @@ -202,8 +214,8 @@ static device_method_t syscon_generic_dmethods[] = { DEVMETHOD_END }; -DEFINE_CLASS_0(syscon_generic, syscon_generic_driver, syscon_generic_dmethods, -sizeof(struct syscon_generic_softc)); +DEFINE_CLASS_1(syscon_generic_dev, syscon_generic_driver, syscon_generic_dmethods, +sizeof(struct syscon_generic_softc), simplebus_driver); static devclass_t syscon_generic_devclass; EARLY_DRIVER_MODULE(syscon_generic, simplebus, syscon_generic_driver, Modified: head/sys/dev/extres/syscon/syscon_generic.h == --- head/sys/dev/extres/syscon/syscon_generic.h Fri Sep 25 13:28:57 2020 (r366155) +++ head/sys/dev/extres/syscon/syscon_generic.h Fri Sep 25 13:52:31 2020 (r366156) @@ -29,11 +29,15 @@ #ifndef DEV_SYSCON_GENERIC_H #define DEV_SYSCON_GENERIC_H +#include + struct syscon_generic_softc { + struct simplebus_softc simplebus; device_tdev; struct syscon *syscon; struct resource *mem_res; struct mtx mtx; + boolsimplebus_attached; }; DECLARE_CLASS(syscon_generic_driver); Modified: head/sys/dev/fdt/simplebus.c == --- head/sys/dev/fdt/simplebus.cFri Sep 25 13:28:57 2020 (r366155) +++ head/sys/dev/fdt/simplebus.cFri Sep 25 13:52:31 2020 (r366156) @@ -116,6 +116,16 @@ simplebus_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); + /* +* XXX We should attach only to pure' compatible = "simple-bus"', +* without any other compatible string. +* For now, filter only know cases: +* "syscon", "simple-bus"; is handled by fdt/syscon driver +* "simple-mfd", "simple-bus"; is handled by fdt/simple-mfd driver +*/ + if (ofw_bus_is_compatible(dev, "syscon") || + ofw_bus_is_compatible(dev, "simple-mfd")) + return (ENXIO); /* * FDT data puts a "simple-bus" compatible string on many things that ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To
svn commit: r366146 - head/sys/dev/fdt
Author: mmel Date: Fri Sep 25 09:56:50 2020 New Revision: 366146 URL: https://svnweb.freebsd.org/changeset/base/366146 Log: Make simplebus friendlier for subclassing. MFC after:1 week Modified: head/sys/dev/fdt/simplebus.c head/sys/dev/fdt/simplebus.h Modified: head/sys/dev/fdt/simplebus.c == --- head/sys/dev/fdt/simplebus.cFri Sep 25 09:34:00 2020 (r366145) +++ head/sys/dev/fdt/simplebus.cFri Sep 25 09:56:50 2020 (r366146) @@ -67,7 +67,7 @@ static device_method_tsimplebus_methods[] = { /* Device interface */ DEVMETHOD(device_probe, simplebus_probe), DEVMETHOD(device_attach,simplebus_attach), - DEVMETHOD(device_detach,bus_generic_detach), + DEVMETHOD(device_detach,simplebus_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD(device_suspend, bus_generic_suspend), DEVMETHOD(device_resume,bus_generic_resume), @@ -134,7 +134,7 @@ simplebus_probe(device_t dev) } int -simplebus_attach(device_t dev) +simplebus_attach_impl(device_t dev) { struct simplebus_softc *sc; phandle_t node; @@ -154,7 +154,32 @@ simplebus_attach(device_t dev) for (node = OF_child(sc->node); node > 0; node = OF_peer(node)) simplebus_add_device(dev, node, 0, NULL, -1, NULL); + + return (0); +} + +int +simplebus_attach(device_t dev) +{ + int rv; + + rv = simplebus_attach_impl(dev); + if (rv != 0) + return (rv); + return (bus_generic_attach(dev)); +} + +int +simplebus_detach(device_t dev) +{ + struct simplebus_softc *sc; + + sc = device_get_softc(dev); + if (sc->ranges != NULL) + free(sc->ranges, M_DEVBUF); + + return (bus_generic_detach(dev)); } void Modified: head/sys/dev/fdt/simplebus.h == --- head/sys/dev/fdt/simplebus.hFri Sep 25 09:34:00 2020 (r366145) +++ head/sys/dev/fdt/simplebus.hFri Sep 25 09:56:50 2020 (r366146) @@ -67,5 +67,7 @@ int simplebus_fill_ranges(phandle_t node, struct simplebus_softc *sc); int simplebus_attach(device_t dev); +int simplebus_attach_impl(device_t dev); +int simplebus_detach(device_t dev); #endif /* _FDT_SIMPLEBUS_H */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r365899 - in head: share/man/man9 sys/arm/include sys/arm64/arm64 sys/arm64/include sys/kern sys/mips/include sys/powerpc/include sys/riscv/include sys/sys sys/tools sys/x86/include
On 22.09.2020 7:18, Ravi Pokala wrote: > This breaks amd64.GENERIC-KCSAN: I’m sorry, seems that I forgotten to run GENERIC-KCSAN build additionally to universe build also for the final version of this change. Thanks for report and sorry for troubles. Fixed in r366107. Michal > > ${SRCTOP}/sys/kern/subr_csan.c:895:1: error: implicit declaration of function > 'bus_space_peek_8' is invalid in C99 [-Werror,-Wimplicit-function-declaration] > CSAN_BUS_PEEK_FUNC(8, uint64_t) > ^ > ${SRCTOP}/sys/kern/subr_csan.c:888:11: note: expanded from macro > 'CSAN_BUS_PEEK_FUNC' > return (bus_space_peek_##width(tag, hnd, offset, value)); \ > ^ > :56:1: note: expanded from here > bus_space_peek_8 > ^ > ${SRCTOP}/sys/kern/subr_csan.c:909:1: error: implicit declaration of function > 'bus_space_poke_8' is invalid in C99 [-Werror,-Wimplicit-function-declaration] > CSAN_BUS_POKE_FUNC(8, uint64_t) > ^ > ${SRCTOP}/sys/kern/subr_csan.c:902:11: note: expanded from macro > 'CSAN_BUS_POKE_FUNC' > return (bus_space_poke_##width(tag, hnd, offset, value)); \ > ^ > :64:1: note: expanded from here > bus_space_poke_8 > ^ > 2 errors generated. > --- subr_csan.o --- > *** [subr_csan.o] Error code 1 > > > Thanks, > > Ravi (rpokala@) > > -Original Message- > From: on behalf of Michal Meloun > > Date: 2020-09-19, Saturday at 04:06 > To: , , > > Subject: svn commit: r365899 - in head: share/man/man9 sys/arm/include > sys/arm64/arm64 sys/arm64/include sys/kern sys/mips/include > sys/powerpc/include sys/riscv/include sys/sys sys/tools sys/x86/include > > Author: mmel > Date: Sat Sep 19 11:06:41 2020 > New Revision: 365899 > URL: https://svnweb.freebsd.org/changeset/base/365899 > > Log: > Add NetBSD compatible bus_space_peek_N() and bus_space_poke_N() > functions. > One problem with the bus_space_read_N() and bus_space_write_N() family > of > functions is that they provide no protection against exceptions which > can > occur when no physical hardware or device responds to the read or write > cycles. In such a situation, the system typically would panic due to a > kernel-mode bus error. The bus_space_peek_N() and bus_space_poke_N() > family > of functions provide a mechanism to handle these exceptions gracefully > without the risk of crashing the system. > > Typical example is access to PCI(e) configuration space in bus > enumeration > function on badly implemented PCI(e) root complexes (RK3399 or Neoverse > N1 N1SDP and/or access to PCI(e) register when device is in deep sleep > state. > > This commit adds a real implementation for arm64 only. The remaining > architectures have bus_space_peek()/bus_space_poke() emulated by using > bus_space_read()/bus_space_write() (without exception handling). > > MFC after: 1 month > Reviewed by:kib > Differential Revision: https://reviews.freebsd.org/D25371 > > Modified: > head/share/man/man9/bus_space.9 > head/sys/arm/include/bus.h > head/sys/arm64/arm64/bus_machdep.c > head/sys/arm64/arm64/bus_space_asm.S > head/sys/arm64/arm64/trap.c > head/sys/arm64/include/bus.h > head/sys/arm64/include/md_var.h > head/sys/kern/subr_csan.c > head/sys/mips/include/bus.h > head/sys/powerpc/include/bus.h > head/sys/riscv/include/bus.h > head/sys/sys/_cscan_bus.h > head/sys/sys/bus.h > head/sys/tools/bus_macro.sh > head/sys/x86/include/bus.h > > Modified: head/share/man/man9/bus_space.9 > > == > --- head/share/man/man9/bus_space.9 Sat Sep 19 02:15:56 2020 > (r365898) > +++ head/share/man/man9/bus_space.9 Sat Sep 19 11:06:41 2020 > (r365899) > @@ -52,7 +52,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd January 15, 2017 > +.Dd July 7, 2020 > .Dt BUS_SPACE 9 > .Os > .Sh NAME > @@ -68,6 +68,14 @@ > .Nm bus_space_copy_region_stream_8 , > .Nm bus_space_free , > .Nm bus_space_map , > +.Nm bus_space_peek_1 , > +.Nm bus_space_peek_2 , > +.Nm bus_space_peek_4 , > +.Nm bus_space_peek_8 , > +.Nm bus_space_poke_1 , > +.Nm bus_space_poke_2 , > +.Nm bus_space_poke_4 , > +.Nm bus_space_poke_8 , >
svn commit: r366107 - head/sys/x86/include
Author: mmel Date: Thu Sep 24 08:40:32 2020 New Revision: 366107 URL: https://svnweb.freebsd.org/changeset/base/366107 Log: Add missing declarations of 64-bit variants of bus_peek/bus_poke on amd64. It fixes GENERIC-KCSAN build. Reported by: rpokala MFC after:1 month MFC with: r365899 Modified: head/sys/x86/include/bus.h Modified: head/sys/x86/include/bus.h == --- head/sys/x86/include/bus.h Thu Sep 24 07:17:05 2020(r366106) +++ head/sys/x86/include/bus.h Thu Sep 24 08:40:32 2020(r366107) @@ -1102,6 +1102,9 @@ bus_space_barrier(bus_space_tag_t tag __unused, bus_sp BUS_PEEK_FUNC(1, uint8_t) BUS_PEEK_FUNC(2, uint16_t) BUS_PEEK_FUNC(4, uint32_t) +#ifdef __amd64__ +BUS_PEEK_FUNC(8, uint64_t) +#endif #define BUS_POKE_FUNC(width, type) \ static inline int \ @@ -1114,6 +1117,9 @@ BUS_PEEK_FUNC(4, uint32_t) BUS_POKE_FUNC(1, uint8_t) BUS_POKE_FUNC(2, uint16_t) BUS_POKE_FUNC(4, uint32_t) +#ifdef __amd64__ +BUS_POKE_FUNC(8, uint64_t) +#endif #endif /* KCSAN && !KCSAN_RUNTIME */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r365929 - head/sys/arm64/conf
Author: mmel Date: Sun Sep 20 17:28:24 2020 New Revision: 365929 URL: https://svnweb.freebsd.org/changeset/base/365929 Log: Adjust DMA alignment for USB stack. It should be at least as large as the maximum value of caheline size for currently known CPUs. MFC after:2 weeks Modified: head/sys/arm64/conf/GENERIC Modified: head/sys/arm64/conf/GENERIC == --- head/sys/arm64/conf/GENERIC Sun Sep 20 16:49:48 2020(r365928) +++ head/sys/arm64/conf/GENERIC Sun Sep 20 17:28:24 2020(r365929) @@ -218,6 +218,7 @@ device uart_snps device pl011 # USB support +optionsUSB_HOST_ALIGN=64 # Align usb buffers to cache line size. device aw_usbphy # Allwinner USB PHY device rk_usb2phy # Rockchip USB2PHY device rk_typec_phy# Rockchip TypeC PHY ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r365926 - in head/sys: arm/include mips/include powerpc/include riscv/include x86/include
Author: mmel Date: Sun Sep 20 15:11:52 2020 New Revision: 365926 URL: https://svnweb.freebsd.org/changeset/base/365926 Log: Add missing assignment forgotten in r365899 Noticed by: mav MFC after:1 month MFC with: r365899 Modified: head/sys/arm/include/bus.h head/sys/mips/include/bus.h head/sys/powerpc/include/bus.h head/sys/riscv/include/bus.h head/sys/x86/include/bus.h Modified: head/sys/arm/include/bus.h == --- head/sys/arm/include/bus.h Sun Sep 20 12:31:48 2020(r365925) +++ head/sys/arm/include/bus.h Sun Sep 20 15:11:52 2020(r365926) @@ -754,6 +754,7 @@ void generic_bs_unimplemented(void); { \ type tmp; \ tmp = bus_space_read_##width(tag, hnd, offset); \ + *value = (type)tmp; \ return (0); \ } BUS_PEEK_FUNC(1, uint8_t) Modified: head/sys/mips/include/bus.h == --- head/sys/mips/include/bus.h Sun Sep 20 12:31:48 2020(r365925) +++ head/sys/mips/include/bus.h Sun Sep 20 15:11:52 2020(r365926) @@ -696,6 +696,7 @@ void__bs_c(f,_bs_c_8) (void *t, bus_space_handle_t bs { \ type tmp; \ tmp = bus_space_read_##width(tag, hnd, offset); \ + *value = (type)tmp; \ return (0); \ } BUS_PEEK_FUNC(1, uint8_t) Modified: head/sys/powerpc/include/bus.h == --- head/sys/powerpc/include/bus.h Sun Sep 20 12:31:48 2020 (r365925) +++ head/sys/powerpc/include/bus.h Sun Sep 20 15:11:52 2020 (r365926) @@ -469,6 +469,7 @@ extern struct bus_space bs_le_tag; { \ type tmp; \ tmp = bus_space_read_##width(tag, hnd, offset); \ + *value = (type)tmp; \ return (0); \ } BUS_PEEK_FUNC(1, uint8_t) Modified: head/sys/riscv/include/bus.h == --- head/sys/riscv/include/bus.hSun Sep 20 12:31:48 2020 (r365925) +++ head/sys/riscv/include/bus.hSun Sep 20 15:11:52 2020 (r365926) @@ -458,6 +458,7 @@ struct bus_space { { \ type tmp; \ tmp = bus_space_read_##width(tag, hnd, offset); \ + *value = (type)tmp; \ return (0); \ } BUS_PEEK_FUNC(1, uint8_t) Modified: head/sys/x86/include/bus.h == --- head/sys/x86/include/bus.h Sun Sep 20 12:31:48 2020(r365925) +++ head/sys/x86/include/bus.h Sun Sep 20 15:11:52 2020(r365926) @@ -1096,6 +1096,7 @@ bus_space_barrier(bus_space_tag_t tag __unused, bus_sp { \ type tmp; \ tmp = bus_space_read_##width(tag, hnd, offset); \ + *value = (type)tmp; \ return (0); \ } BUS_PEEK_FUNC(1, uint8_t) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r365900 - head/sys/arm64/rockchip
Author: mmel Date: Sat Sep 19 11:27:16 2020 New Revision: 365900 URL: https://svnweb.freebsd.org/changeset/base/365900 Log: Implement workaround for broken access to configuration space. Due to a HW bug in the RockChip PCIe implementation, attempting to access a non-existent register in the configuration space will throw an exception. Use new bus functions bus_peek() and bus_poke() to overcomme this limitation. Modified: head/sys/arm64/rockchip/rk_pcie.c Modified: head/sys/arm64/rockchip/rk_pcie.c == --- head/sys/arm64/rockchip/rk_pcie.c Sat Sep 19 11:06:41 2020 (r365899) +++ head/sys/arm64/rockchip/rk_pcie.c Sat Sep 19 11:27:16 2020 (r365900) @@ -310,7 +310,7 @@ rk_pcie_check_dev(struct rk_pcie_softc *sc, u_int bus, uint32_t val; if (bus < sc->bus_start || bus > sc->bus_end || slot > PCI_SLOTMAX || - func > PCI_FUNCMAX || reg > PCI_REGMAX) + func > PCI_FUNCMAX || reg > PCIE_REGMAX) return (false); if (bus == sc->root_bus) { @@ -325,8 +325,8 @@ rk_pcie_check_dev(struct rk_pcie_softc *sc, u_int bus, if (STATUS1_LINK_ST_GET(val) != STATUS1_LINK_ST_UP) return (false); - /* only one device is on first subordinate bus */ - if (bus == sc->sub_bus && slot) + /* only one device can be on first subordinate bus */ + if (bus == sc->sub_bus && slot != 0 ) return (false); return (true); } @@ -452,45 +452,41 @@ rk_pcie_read_config(device_t dev, u_int bus, u_int slo u_int func, u_int reg, int bytes) { struct rk_pcie_softc *sc; - uint32_t data; + uint32_t d32, data; + uint16_t d16; + uint8_t d8; uint64_t addr; - int type; + int type, ret; sc = device_get_softc(dev); if (!rk_pcie_check_dev(sc, bus, slot, func, reg)) return (0xU); - if (bus == sc->root_bus) return (rk_pcie_local_cfg_read(sc, false, reg, bytes)); addr = ATU_CFG_BUS(bus) | ATU_CFG_SLOT(slot) | ATU_CFG_FUNC(func) | ATU_CFG_REG(reg); - if (bus == sc->sub_bus) { - type = ATU_TYPE_CFG0; - } else { - type = ATU_TYPE_CFG1; - /* - * XXX FIXME: any attempt to generate type1 configuration - * access causes external data abort - */ - return (0xU); - } + type = bus == sc->sub_bus ? ATU_TYPE_CFG0: ATU_TYPE_CFG1; rk_pcie_map_cfg_atu(sc, 0, type); + ret = -1; switch (bytes) { case 1: - data = bus_read_1(sc->axi_mem_res, addr); + ret = bus_peek_1(sc->axi_mem_res, addr, ); + data = d8; break; case 2: - data = bus_read_2(sc->axi_mem_res, addr); + ret = bus_peek_2(sc->axi_mem_res, addr, ); + data = d16; break; case 4: - data = bus_read_4(sc->axi_mem_res, addr); + ret = bus_peek_4(sc->axi_mem_res, addr, ); + data = d32; break; - default: - data = 0xU; } + if (ret != 0) + data = 0x; return (data); } @@ -512,27 +508,18 @@ rk_pcie_write_config(device_t dev, u_int bus, u_int sl addr = ATU_CFG_BUS(bus) | ATU_CFG_SLOT(slot) | ATU_CFG_FUNC(func) | ATU_CFG_REG(reg); - if (bus == sc->sub_bus){ - type = ATU_TYPE_CFG0; - } else { - type = ATU_TYPE_CFG1; - /* - * XXX FIXME: any attempt to generate type1 configuration - * access causes external data abort - */ - return; - } + type = bus == sc->sub_bus ? ATU_TYPE_CFG0: ATU_TYPE_CFG1; rk_pcie_map_cfg_atu(sc, 0, type); switch (bytes) { case 1: - bus_write_1(sc->axi_mem_res, addr, val); + bus_poke_1(sc->axi_mem_res, addr, (uint8_t)val); break; case 2: - bus_write_2(sc->axi_mem_res, addr, val); + bus_poke_2(sc->axi_mem_res, addr, (uint16_t)val); break; case 4: - bus_write_4(sc->axi_mem_res, addr, val); + bus_poke_4(sc->axi_mem_res, addr, val); break; default: break; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r365899 - in head: share/man/man9 sys/arm/include sys/arm64/arm64 sys/arm64/include sys/kern sys/mips/include sys/powerpc/include sys/riscv/include sys/sys sys/tools sys/x86/include
Author: mmel Date: Sat Sep 19 11:06:41 2020 New Revision: 365899 URL: https://svnweb.freebsd.org/changeset/base/365899 Log: Add NetBSD compatible bus_space_peek_N() and bus_space_poke_N() functions. One problem with the bus_space_read_N() and bus_space_write_N() family of functions is that they provide no protection against exceptions which can occur when no physical hardware or device responds to the read or write cycles. In such a situation, the system typically would panic due to a kernel-mode bus error. The bus_space_peek_N() and bus_space_poke_N() family of functions provide a mechanism to handle these exceptions gracefully without the risk of crashing the system. Typical example is access to PCI(e) configuration space in bus enumeration function on badly implemented PCI(e) root complexes (RK3399 or Neoverse N1 N1SDP and/or access to PCI(e) register when device is in deep sleep state. This commit adds a real implementation for arm64 only. The remaining architectures have bus_space_peek()/bus_space_poke() emulated by using bus_space_read()/bus_space_write() (without exception handling). MFC after:1 month Reviewed by: kib Differential Revision:https://reviews.freebsd.org/D25371 Modified: head/share/man/man9/bus_space.9 head/sys/arm/include/bus.h head/sys/arm64/arm64/bus_machdep.c head/sys/arm64/arm64/bus_space_asm.S head/sys/arm64/arm64/trap.c head/sys/arm64/include/bus.h head/sys/arm64/include/md_var.h head/sys/kern/subr_csan.c head/sys/mips/include/bus.h head/sys/powerpc/include/bus.h head/sys/riscv/include/bus.h head/sys/sys/_cscan_bus.h head/sys/sys/bus.h head/sys/tools/bus_macro.sh head/sys/x86/include/bus.h Modified: head/share/man/man9/bus_space.9 == --- head/share/man/man9/bus_space.9 Sat Sep 19 02:15:56 2020 (r365898) +++ head/share/man/man9/bus_space.9 Sat Sep 19 11:06:41 2020 (r365899) @@ -52,7 +52,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 15, 2017 +.Dd July 7, 2020 .Dt BUS_SPACE 9 .Os .Sh NAME @@ -68,6 +68,14 @@ .Nm bus_space_copy_region_stream_8 , .Nm bus_space_free , .Nm bus_space_map , +.Nm bus_space_peek_1 , +.Nm bus_space_peek_2 , +.Nm bus_space_peek_4 , +.Nm bus_space_peek_8 , +.Nm bus_space_poke_1 , +.Nm bus_space_poke_2 , +.Nm bus_space_poke_4 , +.Nm bus_space_poke_8 , .Nm bus_space_read_1 , .Nm bus_space_read_2 , .Nm bus_space_read_4 , @@ -161,6 +169,46 @@ .Fo bus_space_free .Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t size" .Fc +.Ft int +.Fo bus_space_peek_1 +.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset" +.Fa "uint8_t *datap" +.Fc +.Ft int +.Fo bus_space_peek_2 +.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset" +.Fa "uint8_t *datap" +.Fc +.Ft int +.Fo bus_space_peek_4 +.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset" +.Fa "uint8_t *datap" +.Fc +.Ft int +.Fo bus_space_peek_8 +.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset" +.Fa "uint8_t *datap" +.Fc +.Ft int +.Fo bus_space_poke_1 +.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset" +.Fa "uint8_t *datap" +.Fc +.Ft int +.Fo bus_space_poke_2 +.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset" +.Fa "uint8_t *datap" +.Fc +.Ft int +.Fo bus_space_poke_4 +.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset" +.Fa "uint8_t *datap" +.Fc +.Ft int +.Fo bus_space_poke_8 +.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset" +.Fa "uint8_t *datap" +.Fc .Ft uint8_t .Fo bus_space_read_1 .Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset" @@ -1124,6 +1172,105 @@ If they would fail (e.g.\& because of an argument error), that indicates a software bug which should cause a panic. In that case, they will never return. +.Sh PROBING BUS SPACE FOR HARDWARE WHICH MAY NOT RESPOND +One problem with the +.Fn bus_space_read_N +and +.Fn bus_space_write_N +family of functions is that they provide no protection against +exceptions which can occur when no physical hardware or +device responds to the read or write cycles. +In such a situation, the system typically would panic due to a kernel-mode +bus error. +The +.Fn bus_space_peek_N +and +.Fn bus_space_poke_N +family of functions provide a mechanism to handle these exceptions +gracefully without the risk of crashing the system. +.Pp +As with +.Fn bus_space_read_N +and +.Fn bus_space_write_N , +the peek and poke functions provide the ability to read and +write 1, 2, 4, and 8 byte data items on busses which support those +access sizes. +All of the constraints specified in the descriptions of the +.Fn bus_space_read_N +and +.Fn bus_space_write_N +functions also apply to +.Fn bus_space_peek_N +and +.Fn bus_space_poke_N . +.Pp +In addition, explicit calls to the +.Fn
Re: svn commit: r365445 - head/sys/cam/mmc
On 08.09.2020 9:10, Andriy Gapon wrote: > On 08/09/2020 08:46, Andriy Gapon wrote: >> Author: avg >> Date: Tue Sep 8 05:46:10 2020 >> New Revision: 365445 >> URL: https://svnweb.freebsd.org/changeset/base/365445 >> >> Log: >> mmc_da: make sure that part_index is not used uninitialized in sddastart > [snip] >> Modified: head/sys/cam/mmc/mmc_da.c >> == >> --- head/sys/cam/mmc/mmc_da.cTue Sep 8 04:44:37 2020 >> (r365444) >> +++ head/sys/cam/mmc/mmc_da.cTue Sep 8 05:46:10 2020 >> (r365445) >> @@ -1808,6 +1808,7 @@ sddastart(struct cam_periph *periph, union ccb *start_ >> } >> >> /* Find partition that has outstanding commands. Prefer current >> partition. */ >> +part_index = softc->part_curr; >> part = softc->part[softc->part_curr]; >> bp = bioq_first(>bio_queue); >> if (bp == NULL) { >> > > One thing that concerns me is that it was obvious (to a human) that part_index > could be used uninitialized if bp was not NULL. > Yet, there was no warning or error from the compiler when I built that code > for > armv7. > > I wonder if we disable some relevant warnings for that architecture. > Or if the compiler (clang 11) could not figure that out. > Hmm, for this in kernel code : int foo(void); int foo(void) { int rv; return (rv); } warning is reported for both armv7 and arm64 for native or cross compile. It seems that clang11 doesn't emit warnings only for more complicated cases... I writing this because i just found another usage of uninitialized variable, in this case in much more complicated abort_handler() function in arm/trap-v6.c again without warning emitted. Michal ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r364737 - head/sys/dev/drm2
On 01.09.2020 15:32, Niclas Zeising wrote: > On 2020-09-01 15:16, Emmanuel Vadot wrote: >> On Tue, 1 Sep 2020 15:13:53 +0200 >> Michal Meloun wrote: >> >>> >>> >>> On 25.08.2020 0:53, Niclas Zeising wrote: >>>> Author: zeising (doc,ports committer) >>>> Date: Mon Aug 24 22:53:23 2020 >>>> New Revision: 364737 >>>> URL: https://svnweb.freebsd.org/changeset/base/364737 >>>> >>>> Log: >>>>   drm2: Update deprecation message >>>>     Update the deprecation message in the drm2 (aka legacy drm) >>>> drivers to point >>>>   towards the graphics/drm-kmod ports for all architectures, not >>>> just amd64. >>> Only known user of drm2 is arm/tegra124 based boards. How >>> graphics/drm-kmod can help for these? >>> Or be more specific - drm2 allows me to hot-plug monitor to tegra based >>> board an use 2 scaled overlay planes (which is exactly whats I want for >>>  my application). Which alternative can you offer me? >>> Btw, as you can see, the maintenance cost of drm2 is close to zero and >>> the dev/drm2 code does not inherit with any of the major architectures. >>> >>> Michal >> >>  I think that the goal was only to mfc this to warn users before 12.2 >> is branched, maybe a direct commit to 12 would have been better. >> > > No, the change is correct. > drm-legacy-kmod (the port) is going away, especially on FreeBSD 13, > since it is preventing updates to the FreeBSD VM subsystem. I sent > an-email about this to a variety of lists about a week ago. > I do know that there are a few special users of drm2 in FreeBSD current, > I do not know how those are affected. Since, on FreeBSD current, most > architectures can use drm-kmod, I believe it is good to point everyone > towards that ports, instead of pointing everyone except amd64 users to > drm-legacy-kmod. No, this change is not correct. You *newly* point ARM drm2 users to use a port marked with "ONLY_FOR_ARCHS= amd64 i386 powerpc64" Do you think that this is correct behavior? So again. I have not a single problem with drm-legacy-kmod removal, I have not a problem with pointing users of supported architectures (by kmod-*) to right port. But I have problem with marking drm2 driver as obsolete for ARM architecture (without single rational reason) and/or by pointing ARM users of drm2 driver to not-existent port. Michal ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r364737 - head/sys/dev/drm2
On 01.09.2020 15:16, Emmanuel Vadot wrote: > On Tue, 1 Sep 2020 15:13:53 +0200 > Michal Meloun wrote: > >> >> >> On 25.08.2020 0:53, Niclas Zeising wrote: >>> Author: zeising (doc,ports committer) >>> Date: Mon Aug 24 22:53:23 2020 >>> New Revision: 364737 >>> URL: https://svnweb.freebsd.org/changeset/base/364737 >>> >>> Log: >>> drm2: Update deprecation message >>> >>> Update the deprecation message in the drm2 (aka legacy drm) drivers to >>> point >>> towards the graphics/drm-kmod ports for all architectures, not just amd64. >> Only known user of drm2 is arm/tegra124 based boards. How >> graphics/drm-kmod can help for these? >> Or be more specific - drm2 allows me to hot-plug monitor to tegra based >> board an use 2 scaled overlay planes (which is exactly whats I want for >> my application). Which alternative can you offer me? >> Btw, as you can see, the maintenance cost of drm2 is close to zero and >> the dev/drm2 code does not inherit with any of the major architectures. >> >> Michal > > I think that the goal was only to mfc this to warn users before 12.2 > is branched, maybe a direct commit to 12 would have been better. > My main concern is #ifdef removal (thus expanding the removal message also on QARM). I understand that drm2 code is very old, but it works, is used, and have very minimal impact on other architectures or rest of kernel. Within these conditions, I don't see single reason to remove (on ARM) drm2 code in 13. >> >>> drm-kmod has support for more architectures these days, and the >>> graphics/drm-legacy-kmod port is being deprecated. >> >>> >>> Approved by: imp >>> MFC after:1 week >>> Differential Revision:https://reviews.freebsd.org/D26174 >>> >>> Modified: >>> head/sys/dev/drm2/drm_os_freebsd.h >>> >>> Modified: head/sys/dev/drm2/drm_os_freebsd.h >>> == >>> --- head/sys/dev/drm2/drm_os_freebsd.h Mon Aug 24 22:48:19 2020 >>> (r364736) >>> +++ head/sys/dev/drm2/drm_os_freebsd.h Mon Aug 24 22:53:23 2020 >>> (r364737) >>> @@ -154,16 +154,12 @@ typedef void irqreturn_t; >>> *(volatile u_int64_t *)(((vm_offset_t)(map)->handle) + \ >>> (vm_offset_t)(offset)) = htole64(val) >>> >>> -#ifdef amd64 >>> #define DRM_PORT "graphics/drm-kmod" >>> -#else >>> -#define DRM_PORT "graphics/drm-legacy-kmod" >>> -#endif >>> >>> #define DRM_OBSOLETE(dev) >>> \ >>> do { >>> \ >>> device_printf(dev, >>> "===\n"); \ >>> - device_printf(dev, "This code is obsolete abandonware. Install the " >>> DRM_PORT " pkg\n"); \ >>> + device_printf(dev, "This code is deprecated. Install the " DRM_PORT " >>> pkg\n"); \ >>> device_printf(dev, >>> "===\n"); \ >>> gone_in_dev(dev, 13, "drm2 drivers"); >>> \ >>> } while (0) >>> > > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r364737 - head/sys/dev/drm2
On 25.08.2020 0:53, Niclas Zeising wrote: > Author: zeising (doc,ports committer) > Date: Mon Aug 24 22:53:23 2020 > New Revision: 364737 > URL: https://svnweb.freebsd.org/changeset/base/364737 > > Log: > drm2: Update deprecation message > > Update the deprecation message in the drm2 (aka legacy drm) drivers to point > towards the graphics/drm-kmod ports for all architectures, not just amd64. Only known user of drm2 is arm/tegra124 based boards. How graphics/drm-kmod can help for these? Or be more specific - drm2 allows me to hot-plug monitor to tegra based board an use 2 scaled overlay planes (which is exactly whats I want for my application). Which alternative can you offer me? Btw, as you can see, the maintenance cost of drm2 is close to zero and the dev/drm2 code does not inherit with any of the major architectures. Michal > drm-kmod has support for more architectures these days, and the > graphics/drm-legacy-kmod port is being deprecated. > > Approved by:imp > MFC after: 1 week > Differential Revision: https://reviews.freebsd.org/D26174 > > Modified: > head/sys/dev/drm2/drm_os_freebsd.h > > Modified: head/sys/dev/drm2/drm_os_freebsd.h > == > --- head/sys/dev/drm2/drm_os_freebsd.hMon Aug 24 22:48:19 2020 > (r364736) > +++ head/sys/dev/drm2/drm_os_freebsd.hMon Aug 24 22:53:23 2020 > (r364737) > @@ -154,16 +154,12 @@ typedef voidirqreturn_t; > *(volatile u_int64_t *)(((vm_offset_t)(map)->handle) + \ > (vm_offset_t)(offset)) = htole64(val) > > -#ifdef amd64 > #define DRM_PORT "graphics/drm-kmod" > -#else > -#define DRM_PORT "graphics/drm-legacy-kmod" > -#endif > > #define DRM_OBSOLETE(dev) > \ > do { > \ > device_printf(dev, > "===\n"); \ > - device_printf(dev, "This code is obsolete abandonware. Install the " > DRM_PORT " pkg\n"); \ > + device_printf(dev, "This code is deprecated. Install the " DRM_PORT " > pkg\n"); \ > device_printf(dev, > "===\n"); \ > gone_in_dev(dev, 13, "drm2 drivers"); > \ > } while (0) > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r364946 - head/sys/kern
On 29.08.2020 13:02, Warner Losh wrote: > On Sat, Aug 29, 2020 at 4:38 AM Michal Meloun > wrote: > >> >> >> On 29.08.2020 12:04, Warner Losh wrote: >>> On Sat, Aug 29, 2020 at 1:09 AM Mateusz Guzik wrote: >>> >>>> This crashes on boot for me: >>>> >>> >>> I wasn't able to get it to crash on boot for me, but I was able to >> recreate >>> it. >> It crashed on ofw based systems where some enumerated devices have not a >> suitable driver, see: >> --- >> sysctl_devices: nameunit: root0, descs: System root bus, driver: root >> sysctl_devices: nameunit: nexus0, descs: (null), driver: nexus >> sysctl_devices: nameunit: ofwbus0, descs: Open Firmware Device Tree, >> driver: ofwbus >> sysctl_devices: nameunit: pcib0, descs: Nvidia Integrated PCI/PCI-E >> Controller, driver: pcib >> sysctl_devices: nameunit: simplebus0, descs: Flattened device tree >> simple bus, driver: simplebus >> sysctl_devices: nameunit: gic0, descs: ARM Generic Interrupt Controller, >> driver: gic >> sysctl_devices: nameunit: (null), descs: (null), driver: >> sysctl_devices: nameunit: lic0, descs: (null), driver: lic >> sysctl_devices: nameunit: (null), descs: (null), driver: >> sysctl_devices: nameunit: car0, descs: Tegra Clock Driver, driver: car >> >> -- >>> Fixed in r364949.Confirmed. >> I think it didn't crash on boot for me because >>> kldxref failed due to the segment thing so devmatch didn't run which >> would >>> have triggered this bug. devinfo did trigger a very similar crash, and >>> r364949 fixes that crash. Even a new kldxref failed due to the too many >>> segments thing, so I can't confirm that's what you hit, but I'm pretty >> sure >>> it is... >>> >> But there is another issue in device_sysctl_handler() (not analyzed yet): >> root@tegra210:~ # sysctl dev.cpu. >> dev.cpu.3.temperature: 50.5C >> dev.cpu.3panic: sbuf_clear makes no sense on sbuf 0x6f21a528 >> with drain >> cpuid = 2 >> time = 1598696937 >> KDB: stack backtrace: >> db_trace_self() at db_fetch_ksymtab+0x164 >> pc = 0x006787f4 lr = 0x00153400 >> sp = 0x6f21a1b0 fp = 0x6f21a3b0 >> >> db_fetch_ksymtab() at vpanic+0x198 >> pc = 0x00153400 lr = 0x0036b274 >> sp = 0x6f21a3c0 fp = 0x6f21a420 >> >> vpanic() at panic+0x44 >> pc = 0x0036b274 lr = 0x0036b018 >> sp = 0x6f21a430 fp = 0x6f21a4e0 >> >> panic() at sbuf_clear+0xa0 >> pc = 0x0036b018 lr = 0x003c17c8 >> sp = 0x6f21a4f0 fp = 0x6f21a4f0 >> >> sbuf_clear() at sbuf_cpy+0x58 >> pc = 0x003c17c8 lr = 0x003c1ff0 >> sp = 0x6f21a500 fp = 0x6f21a500 >> >> sbuf_cpy() at _gone_in_dev+0x560 >> pc = 0x003c1ff0 lr = 0x003a9078 >> sp = 0x6f21a510 fp = 0x6f21a570 >> >> _gone_in_dev() at sbuf_new_for_sysctl+0x170 >> pc = 0x003a9078 lr = 0x0037c1a8 >> sp = 0x6f21a580 fp = 0x6f21a5a0 >> >> sbuf_new_for_sysctl() at kernel_sysctl+0x36c >> pc = 0x0037c1a8 lr = 0x0037b63c >> sp = 0x6f21a5b0 fp = 0x6f21a630 >> > > This traceback is all kinds of crazy. sbuf_new_for_sysctl doesn't call > _gone_in_dev(), which doesn't do sbuf stuff at all. And neither does it > call sbuf_cpy(). Though I get a crash that looks like: > Tracing pid 66442 tid 101464 td 0xfe02f47b7c00 > kdb_enter() at kdb_enter+0x37/frame 0xfe02f4ae3740 > vpanic() at vpanic+0x19e/frame 0xfe02f4ae3790 > panic() at panic+0x43/frame 0xfe02f4ae37f0 > sbuf_clear() at sbuf_clear+0xac/frame 0xfe02f4ae3800 > sbuf_cpy() at sbuf_cpy+0x5a/frame 0xfe02f4ae3820 > device_sysctl_handler() at device_sysctl_handler+0x133/frame > 0xfe02f4ae38a0 > sysctl_root_handler_locked() at sysctl_root_handler_locked+0x9c/frame > 0xfe02f4ae38f0 > sysctl_root() at sysctl_root+0x20a/frame 0xfe02f4ae3970 > userland_sysctl() at userland_sysctl+0x17d/frame 0xfe02f4ae3a20 > sys___sysctl() at sys___sysctl+0x5f/frame 0xfe02f4ae3ad0 > amd64_syscall() at amd64_syscall+0x140/frame 0xfe02f4ae3bf0 > fast_syscall_common() at fast_syscall_common+0xf8
Re: svn commit: r364946 - head/sys/kern
On 29.08.2020 12:04, Warner Losh wrote: > On Sat, Aug 29, 2020 at 1:09 AM Mateusz Guzik wrote: > >> This crashes on boot for me: >> > > I wasn't able to get it to crash on boot for me, but I was able to recreate > it. It crashed on ofw based systems where some enumerated devices have not a suitable driver, see: --- sysctl_devices: nameunit: root0, descs: System root bus, driver: root sysctl_devices: nameunit: nexus0, descs: (null), driver: nexus sysctl_devices: nameunit: ofwbus0, descs: Open Firmware Device Tree, driver: ofwbus sysctl_devices: nameunit: pcib0, descs: Nvidia Integrated PCI/PCI-E Controller, driver: pcib sysctl_devices: nameunit: simplebus0, descs: Flattened device tree simple bus, driver: simplebus sysctl_devices: nameunit: gic0, descs: ARM Generic Interrupt Controller, driver: gic sysctl_devices: nameunit: (null), descs: (null), driver: sysctl_devices: nameunit: lic0, descs: (null), driver: lic sysctl_devices: nameunit: (null), descs: (null), driver: sysctl_devices: nameunit: car0, descs: Tegra Clock Driver, driver: car -- > Fixed in r364949.Confirmed. I think it didn't crash on boot for me because > kldxref failed due to the segment thing so devmatch didn't run which would > have triggered this bug. devinfo did trigger a very similar crash, and > r364949 fixes that crash. Even a new kldxref failed due to the too many > segments thing, so I can't confirm that's what you hit, but I'm pretty sure > it is... > But there is another issue in device_sysctl_handler() (not analyzed yet): root@tegra210:~ # sysctl dev.cpu. dev.cpu.3.temperature: 50.5C dev.cpu.3panic: sbuf_clear makes no sense on sbuf 0x6f21a528 with drain cpuid = 2 time = 1598696937 KDB: stack backtrace: db_trace_self() at db_fetch_ksymtab+0x164 pc = 0x006787f4 lr = 0x00153400 sp = 0x6f21a1b0 fp = 0x6f21a3b0 db_fetch_ksymtab() at vpanic+0x198 pc = 0x00153400 lr = 0x0036b274 sp = 0x6f21a3c0 fp = 0x6f21a420 vpanic() at panic+0x44 pc = 0x0036b274 lr = 0x0036b018 sp = 0x6f21a430 fp = 0x6f21a4e0 panic() at sbuf_clear+0xa0 pc = 0x0036b018 lr = 0x003c17c8 sp = 0x6f21a4f0 fp = 0x6f21a4f0 sbuf_clear() at sbuf_cpy+0x58 pc = 0x003c17c8 lr = 0x003c1ff0 sp = 0x6f21a500 fp = 0x6f21a500 sbuf_cpy() at _gone_in_dev+0x560 pc = 0x003c1ff0 lr = 0x003a9078 sp = 0x6f21a510 fp = 0x6f21a570 _gone_in_dev() at sbuf_new_for_sysctl+0x170 pc = 0x003a9078 lr = 0x0037c1a8 sp = 0x6f21a580 fp = 0x6f21a5a0 sbuf_new_for_sysctl() at kernel_sysctl+0x36c pc = 0x0037c1a8 lr = 0x0037b63c sp = 0x6f21a5b0 fp = 0x6f21a630 kernel_sysctl() at userland_sysctl+0xf4 pc = 0x0037b63c lr = 0x0037bc5c sp = 0x6f21a640 fp = 0x6f21a6d0 userland_sysctl() at sys___sysctl+0x68 pc = 0x0037bc5c lr = 0x0037bb28 sp = 0x6f21a6e0 fp = 0x6f21a790 sys___sysctl() at do_el0_sync+0x4e0 pc = 0x0037bb28 lr = 0x00697918 sp = 0x6f21a7a0 fp = 0x6f21a830 do_el0_sync() at handle_el0_sync+0x90 pc = 0x00697918 lr = 0x0067aa24 sp = 0x6f21a840 fp = 0x6f21a980 handle_el0_sync() at 0x4047764c pc = 0x0067aa24 lr = 0x4047764c sp = 0x6f21a990 fp = 0xc250 KDB: enter: panic [ thread pid 1263 tid 100092 ] Stopped at 0x40477fb4: undefined 5442 > Warner > > >> atal trap 12: page fault while in kernel mode >> cpuid = 0; apic id = 00 >> fault virtual address = 0x0 >> fault code = supervisor read data, page not present >> instruction pointer = 0x20:0x805b0a7f >> stack pointer = 0x28:0xfe002366a7f0 >> frame pointer = 0x28:0xfe002366a7f0 >> code segment= base 0x0, limit 0xf, type 0x1b >> = DPL 0, pres 1, long 1, def32 0, gran 1 >> processor eflags= interrupt enabled, resume, IOPL = 0 >> current process = 89 (devmatch) >> trap number = 12 >> panic: page fault >> cpuid = 0 >> time = 1598692135 >> KDB: stack backtrace: >> db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame >> 0xfe002366a4a0 >> vpanic() at vpanic+0x182/frame 0xfe002366a4f0 >> panic() at panic+0x43/frame 0xfe002366a550 >> trap_fatal() at trap_fatal+0x387/frame 0xfe002366a5b0 >> trap_pfault() at trap_pfault+0x4f/frame 0xfe002366a610 >> trap() at trap+0x27d/frame 0xfe002366a720 >>
Re: svn commit: r363700 - in head/sys: arm/ti arm/ti/am335x arm/ti/clk arm/ti/cpsw arm/ti/omap4 arm/ti/usb dev/uart modules
Oups, next module dependency on autogenerated header... Fixed in r363758. Thanks for report Michal On 01.08.2020 6:39, Mateusz Guzik wrote: > This breaks tinderbox for several arm kernels. > > On 7/30/20, Michal Meloun wrote: >> Author: mmel >> Date: Thu Jul 30 14:45:05 2020 >> New Revision: 363700 >> URL: https://svnweb.freebsd.org/changeset/base/363700 >> >> Log: >> Move Ti AM335x to dev/extres/clk framework. >> >> Re-implement clocks for these SoC by using now standard extres/clk >> framework. >> This is necessary for future expansion of these. The new implementation >> is (due to the size of the patch) only the initial (minimum) version. >> It will be updated/expanded with a subsequent set of particular patches. >> >> This patch is also not tested on OMAP4 based boards (BeagleBone), >> so all possible issues should be (and will be) fixed by ASAP once >> identified. >> >> Submited by: Oskar Holmlund (oskar.holml...@ohdata.se) >> Differential Revision: https://reviews.freebsd.org/D25118 >> >> Added: >> head/sys/arm/ti/am335x/am3359_cppi41.c (contents, props changed) >> head/sys/arm/ti/am335x/am335x_usb_phy.c (contents, props changed) >> head/sys/arm/ti/clk/ >> head/sys/arm/ti/clk/clock_common.c (contents, props changed) >> head/sys/arm/ti/clk/clock_common.h (contents, props changed) >> head/sys/arm/ti/clk/ti_clk_clkctrl.c (contents, props changed) >> head/sys/arm/ti/clk/ti_clk_clkctrl.h (contents, props changed) >> head/sys/arm/ti/clk/ti_clk_dpll.c (contents, props changed) >> head/sys/arm/ti/clk/ti_clk_dpll.h (contents, props changed) >> head/sys/arm/ti/clk/ti_clkctrl.c (contents, props changed) >> head/sys/arm/ti/clk/ti_divider_clock.c (contents, props changed) >> head/sys/arm/ti/clk/ti_dpll_clock.c (contents, props changed) >> head/sys/arm/ti/clk/ti_gate_clock.c (contents, props changed) >> head/sys/arm/ti/clk/ti_mux_clock.c (contents, props changed) >> head/sys/arm/ti/ti_omap4_cm.c (contents, props changed) >> head/sys/arm/ti/ti_omap4_cm.h (contents, props changed) >> head/sys/arm/ti/ti_prm.c (contents, props changed) >> head/sys/arm/ti/ti_prm.h (contents, props changed) >> head/sys/arm/ti/ti_scm_syscon.c (contents, props changed) >> head/sys/arm/ti/ti_sysc.h (contents, props changed) >> Deleted: >> head/sys/arm/ti/am335x/am335x_prcm.c >> head/sys/arm/ti/am335x/am335x_usbss.c >> head/sys/arm/ti/ti_hwmods.c >> head/sys/arm/ti/ti_hwmods.h >> Modified: >> head/sys/arm/ti/am335x/am335x_dmtimer.c >> head/sys/arm/ti/am335x/am335x_dmtpps.c >> head/sys/arm/ti/am335x/am335x_dmtreg.h >> head/sys/arm/ti/am335x/am335x_gpio.c >> head/sys/arm/ti/am335x/am335x_lcd.c >> head/sys/arm/ti/am335x/am335x_musb.c >> head/sys/arm/ti/am335x/am335x_pwmss.c >> head/sys/arm/ti/am335x/am335x_rtc.c >> head/sys/arm/ti/am335x/am335x_scm.c >> head/sys/arm/ti/am335x/files.am335x >> head/sys/arm/ti/cpsw/if_cpsw.c >> head/sys/arm/ti/files.ti >> head/sys/arm/ti/omap4/files.omap4 >> head/sys/arm/ti/ti_adc.c >> head/sys/arm/ti/ti_edma3.c >> head/sys/arm/ti/ti_gpio.c >> head/sys/arm/ti/ti_i2c.c >> head/sys/arm/ti/ti_mbox.c >> head/sys/arm/ti/ti_pinmux.c >> head/sys/arm/ti/ti_prcm.c >> head/sys/arm/ti/ti_prcm.h >> head/sys/arm/ti/ti_pruss.c >> head/sys/arm/ti/ti_scm.c >> head/sys/arm/ti/ti_sdhci.c >> head/sys/arm/ti/ti_sdma.c >> head/sys/arm/ti/ti_spi.c >> head/sys/arm/ti/ti_sysc.c >> head/sys/arm/ti/ti_wdt.c >> head/sys/arm/ti/usb/omap_ehci.c >> head/sys/arm/ti/usb/omap_host.c >> head/sys/arm/ti/usb/omap_tll.c >> head/sys/dev/uart/uart_dev_ti8250.c >> head/sys/modules/Makefile >> >> Added: head/sys/arm/ti/am335x/am3359_cppi41.c >> == >> --- /dev/null00:00:00 1970 (empty, because file is newly added) >> +++ head/sys/arm/ti/am335x/am3359_cppi41.c Thu Jul 30 14:45:05 >> 2020 (r363700) >> @@ -0,0 +1,192 @@ >> +/*- >> + * Copyright (c) 2019 Emmanuel Vadot >> + * >> + * Copyright (c) 2020 Oskar Holmlund >> + * >> + * 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 l
svn commit: r363758 - head/sys/modules/cpsw
Author: mmel Date: Sat Aug 1 09:06:16 2020 New Revision: 363758 URL: https://svnweb.freebsd.org/changeset/base/363758 Log: Add missing dependency for cpsw module. Reported by: mjg MFC with: r363700 Modified: head/sys/modules/cpsw/Makefile Modified: head/sys/modules/cpsw/Makefile == --- head/sys/modules/cpsw/Makefile Sat Aug 1 06:37:26 2020 (r363757) +++ head/sys/modules/cpsw/Makefile Sat Aug 1 09:06:16 2020 (r363758) @@ -3,6 +3,6 @@ .PATH: ${SRCTOP}/sys/arm/ti/cpsw KMOD= if_cpsw -SRCS= if_cpsw.c device_if.h bus_if.h ofw_bus_if.h miibus_if.h +SRCS= if_cpsw.c device_if.h bus_if.h ofw_bus_if.h miibus_if.h syscon_if.h .include ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363700 - in head/sys: arm/ti arm/ti/am335x arm/ti/clk arm/ti/cpsw arm/ti/omap4 arm/ti/usb dev/uart modules
Author: mmel Date: Thu Jul 30 14:45:05 2020 New Revision: 363700 URL: https://svnweb.freebsd.org/changeset/base/363700 Log: Move Ti AM335x to dev/extres/clk framework. Re-implement clocks for these SoC by using now standard extres/clk framework. This is necessary for future expansion of these. The new implementation is (due to the size of the patch) only the initial (minimum) version. It will be updated/expanded with a subsequent set of particular patches. This patch is also not tested on OMAP4 based boards (BeagleBone), so all possible issues should be (and will be) fixed by ASAP once identified. Submited by: Oskar Holmlund (oskar.holml...@ohdata.se) Differential Revision: https://reviews.freebsd.org/D25118 Added: head/sys/arm/ti/am335x/am3359_cppi41.c (contents, props changed) head/sys/arm/ti/am335x/am335x_usb_phy.c (contents, props changed) head/sys/arm/ti/clk/ head/sys/arm/ti/clk/clock_common.c (contents, props changed) head/sys/arm/ti/clk/clock_common.h (contents, props changed) head/sys/arm/ti/clk/ti_clk_clkctrl.c (contents, props changed) head/sys/arm/ti/clk/ti_clk_clkctrl.h (contents, props changed) head/sys/arm/ti/clk/ti_clk_dpll.c (contents, props changed) head/sys/arm/ti/clk/ti_clk_dpll.h (contents, props changed) head/sys/arm/ti/clk/ti_clkctrl.c (contents, props changed) head/sys/arm/ti/clk/ti_divider_clock.c (contents, props changed) head/sys/arm/ti/clk/ti_dpll_clock.c (contents, props changed) head/sys/arm/ti/clk/ti_gate_clock.c (contents, props changed) head/sys/arm/ti/clk/ti_mux_clock.c (contents, props changed) head/sys/arm/ti/ti_omap4_cm.c (contents, props changed) head/sys/arm/ti/ti_omap4_cm.h (contents, props changed) head/sys/arm/ti/ti_prm.c (contents, props changed) head/sys/arm/ti/ti_prm.h (contents, props changed) head/sys/arm/ti/ti_scm_syscon.c (contents, props changed) head/sys/arm/ti/ti_sysc.h (contents, props changed) Deleted: head/sys/arm/ti/am335x/am335x_prcm.c head/sys/arm/ti/am335x/am335x_usbss.c head/sys/arm/ti/ti_hwmods.c head/sys/arm/ti/ti_hwmods.h Modified: head/sys/arm/ti/am335x/am335x_dmtimer.c head/sys/arm/ti/am335x/am335x_dmtpps.c head/sys/arm/ti/am335x/am335x_dmtreg.h head/sys/arm/ti/am335x/am335x_gpio.c head/sys/arm/ti/am335x/am335x_lcd.c head/sys/arm/ti/am335x/am335x_musb.c head/sys/arm/ti/am335x/am335x_pwmss.c head/sys/arm/ti/am335x/am335x_rtc.c head/sys/arm/ti/am335x/am335x_scm.c head/sys/arm/ti/am335x/files.am335x head/sys/arm/ti/cpsw/if_cpsw.c head/sys/arm/ti/files.ti head/sys/arm/ti/omap4/files.omap4 head/sys/arm/ti/ti_adc.c head/sys/arm/ti/ti_edma3.c head/sys/arm/ti/ti_gpio.c head/sys/arm/ti/ti_i2c.c head/sys/arm/ti/ti_mbox.c head/sys/arm/ti/ti_pinmux.c head/sys/arm/ti/ti_prcm.c head/sys/arm/ti/ti_prcm.h head/sys/arm/ti/ti_pruss.c head/sys/arm/ti/ti_scm.c head/sys/arm/ti/ti_sdhci.c head/sys/arm/ti/ti_sdma.c head/sys/arm/ti/ti_spi.c head/sys/arm/ti/ti_sysc.c head/sys/arm/ti/ti_wdt.c head/sys/arm/ti/usb/omap_ehci.c head/sys/arm/ti/usb/omap_host.c head/sys/arm/ti/usb/omap_tll.c head/sys/dev/uart/uart_dev_ti8250.c head/sys/modules/Makefile Added: head/sys/arm/ti/am335x/am3359_cppi41.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/ti/am335x/am3359_cppi41.c Thu Jul 30 14:45:05 2020 (r363700) @@ -0,0 +1,192 @@ +/*- + * Copyright (c) 2019 Emmanuel Vadot + * + * Copyright (c) 2020 Oskar Holmlund + * + * 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$ + */ +/* Based on sys/arm/ti/ti_sysc.c */ + +#include +__FBSDID("$FreeBSD$"); +
svn commit: r363510 - head/sys/dev/extres/clk
Author: mmel Date: Sat Jul 25 06:32:23 2020 New Revision: 363510 URL: https://svnweb.freebsd.org/changeset/base/363510 Log: Revert r363123. As Emanuel poited me the Linux processes these clock assignments in forward order, not in reversed. I misread the original code. Tha problem with wrong order for assigned clocks found in tegra (and some imx) DT should be reanalyzed and solved by different way. MFC with: r363123 Reported by; manu Modified: head/sys/dev/extres/clk/clk.c Modified: head/sys/dev/extres/clk/clk.c == --- head/sys/dev/extres/clk/clk.c Sat Jul 25 04:13:38 2020 (r363509) +++ head/sys/dev/extres/clk/clk.c Sat Jul 25 06:32:23 2020 (r363510) @@ -1407,7 +1407,7 @@ clk_set_assigned(device_t dev, phandle_t node) if (ofw_bus_parse_xref_list_get_length(node, "assigned-clock-parents", "#clock-cells", ) != 0) nparents = -1; - for (i = nclocks - 1; i >= 0; i--) { + for (i = 0; i < nclocks; i++) { /* First get the clock we are supposed to modify */ rv = clk_get_by_ofw_index_prop(dev, 0, "assigned-clocks", i, ); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363123 - head/sys/dev/extres/clk
Author: mmel Date: Sun Jul 12 07:59:15 2020 New Revision: 363123 URL: https://svnweb.freebsd.org/changeset/base/363123 Log: Reverse the processing order of assigned clocks property. Linux processes these clocks in reverse order and some DT relies on this fact. For example, the frequency setting for a given PLL is the last in the list, preceded by the frequency setting of its following divider or so... MFC after:1 week Modified: head/sys/dev/extres/clk/clk.c Modified: head/sys/dev/extres/clk/clk.c == --- head/sys/dev/extres/clk/clk.c Sun Jul 12 07:42:21 2020 (r363122) +++ head/sys/dev/extres/clk/clk.c Sun Jul 12 07:59:15 2020 (r363123) @@ -1407,7 +1407,7 @@ clk_set_assigned(device_t dev, phandle_t node) if (ofw_bus_parse_xref_list_get_length(node, "assigned-clock-parents", "#clock-cells", ) != 0) nparents = -1; - for (i = 0; i < nclocks; i++) { + for (i = nclocks - 1; i >= 0; i--) { /* First get the clock we are supposed to modify */ rv = clk_get_by_ofw_index_prop(dev, 0, "assigned-clocks", i, ); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363122 - head/sys/dev/extres/clk
Author: mmel Date: Sun Jul 12 07:42:21 2020 New Revision: 363122 URL: https://svnweb.freebsd.org/changeset/base/363122 Log: Assigned clocks: fix off-by-one bug, don't leak allocated memory. MFC after: 1 week Modified: head/sys/dev/extres/clk/clk.c Modified: head/sys/dev/extres/clk/clk.c == --- head/sys/dev/extres/clk/clk.c Sun Jul 12 07:27:21 2020 (r363121) +++ head/sys/dev/extres/clk/clk.c Sun Jul 12 07:42:21 2020 (r363122) @@ -1420,15 +1420,17 @@ clk_set_assigned(device_t dev, phandle_t node) } /* First set it's parent if needed */ - if (i <= nparents) + if (i < nparents) clk_set_assigned_parent(dev, clk, i); /* Then set a new frequency */ - if (i <= nrates && rates[i] != 0) + if (i < nrates && rates[i] != 0) clk_set_assigned_rates(dev, clk, rates[i]); clk_release(clk); } + if (rates != NULL) + OF_prop_free(rates); return (0); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363121 - in head/sys/arm: broadcom/bcm2835 mv
Author: mmel Date: Sun Jul 12 07:27:21 2020 New Revision: 363121 URL: https://svnweb.freebsd.org/changeset/base/363121 Log: Fix the module name for some arm drivers. Module name (unlike of the of driver name) must be system wide unique. Reported by: Mark Millard(bcm_pci), andrew(mvebu_gpio) MFC with: r362954, r362385 Modified: head/sys/arm/broadcom/bcm2835/bcm2838_pci.c head/sys/arm/mv/mvebu_gpio.c Modified: head/sys/arm/broadcom/bcm2835/bcm2838_pci.c == --- head/sys/arm/broadcom/bcm2835/bcm2838_pci.c Sun Jul 12 07:25:02 2020 (r363120) +++ head/sys/arm/broadcom/bcm2835/bcm2838_pci.c Sun Jul 12 07:27:21 2020 (r363121) @@ -739,5 +739,5 @@ DEFINE_CLASS_1(pcib, bcm_pcib_driver, bcm_pcib_methods sizeof(struct bcm_pcib_softc), generic_pcie_fdt_driver); static devclass_t bcm_pcib_devclass; -DRIVER_MODULE(pcib, simplebus, bcm_pcib_driver, bcm_pcib_devclass, 0, 0); +DRIVER_MODULE(bcm_pcib, simplebus, bcm_pcib_driver, bcm_pcib_devclass, 0, 0); Modified: head/sys/arm/mv/mvebu_gpio.c == --- head/sys/arm/mv/mvebu_gpio.cSun Jul 12 07:25:02 2020 (r363120) +++ head/sys/arm/mv/mvebu_gpio.cSun Jul 12 07:27:21 2020 (r363121) @@ -864,6 +864,6 @@ static device_method_t mvebu_gpio_methods[] = { static devclass_t mvebu_gpio_devclass; static DEFINE_CLASS_0(gpio, mvebu_gpio_driver, mvebu_gpio_methods, sizeof(struct mvebu_gpio_softc)); -EARLY_DRIVER_MODULE(gpio, simplebus, mvebu_gpio_driver, +EARLY_DRIVER_MODULE(mvebu_gpio, simplebus, mvebu_gpio_driver, mvebu_gpio_devclass, NULL, NULL, BUS_PASS_TIMER + BUS_PASS_ORDER_LAST); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362415 - head/sys/dev/dwc
Author: mmel Date: Fri Jun 19 19:26:55 2020 New Revision: 362415 URL: https://svnweb.freebsd.org/changeset/base/362415 Log: Improve if_dwc: - refactorize packet receive path. Make sure that we don't leak mbufs and/or that we don't create holes in RX descriptor ring - slightly simplify handling with TX descriptors MFC after:4 weeks Modified: head/sys/dev/dwc/if_dwc.c head/sys/dev/dwc/if_dwcvar.h Modified: head/sys/dev/dwc/if_dwc.c == --- head/sys/dev/dwc/if_dwc.c Fri Jun 19 19:25:47 2020(r362414) +++ head/sys/dev/dwc/if_dwc.c Fri Jun 19 19:26:55 2020(r362415) @@ -235,45 +235,39 @@ dwc_get1paddr(void *arg, bus_dma_segment_t *segs, int *(bus_addr_t *)arg = segs[0].ds_addr; } -inline static uint32_t +inline static void dwc_setup_txdesc(struct dwc_softc *sc, int idx, bus_addr_t paddr, uint32_t len) { - uint32_t flags; - uint32_t nidx; + uint32_t desc0, desc1; - nidx = next_txidx(sc, idx); - /* Addr/len 0 means we're clearing the descriptor after xmit done. */ if (paddr == 0 || len == 0) { - flags = 0; + desc0 = 0; + desc1 = 0; --sc->txcount; } else { - if (sc->mactype != DWC_GMAC_EXT_DESC) - flags = NTDESC1_TCH | NTDESC1_FS - | NTDESC1_LS | NTDESC1_IC; - else - flags = ETDESC0_TCH | ETDESC0_FS | ETDESC0_LS | - ETDESC0_IC; + if (sc->mactype != DWC_GMAC_EXT_DESC) { + desc0 = 0; + desc1 = NTDESC1_TCH | NTDESC1_FS | NTDESC1_LS | + NTDESC1_IC | len; + } else { + desc0 = ETDESC0_TCH | ETDESC0_FS | ETDESC0_LS | + ETDESC0_IC; + desc1 = len; + } ++sc->txcount; } sc->txdesc_ring[idx].addr1 = (uint32_t)(paddr); - if (sc->mactype != DWC_GMAC_EXT_DESC) { - sc->txdesc_ring[idx].desc0 = 0; - sc->txdesc_ring[idx].desc1 = flags | len; - } else { - sc->txdesc_ring[idx].desc0 = flags; - sc->txdesc_ring[idx].desc1 = len; - } + sc->txdesc_ring[idx].desc0 = desc0; + sc->txdesc_ring[idx].desc1 = desc1; if (paddr && len) { wmb(); sc->txdesc_ring[idx].desc0 |= TDESC0_OWN; wmb(); } - - return (nidx); } static int @@ -528,6 +522,7 @@ dwc_init(void *if_softc) DWC_UNLOCK(sc); } + inline static uint32_t dwc_setup_rxdesc(struct dwc_softc *sc, int idx, bus_addr_t paddr) { @@ -538,14 +533,15 @@ dwc_setup_rxdesc(struct dwc_softc *sc, int idx, bus_ad sc->rxdesc_ring[idx].addr2 = sc->rxdesc_ring_paddr + (nidx * sizeof(struct dwc_hwdesc)); if (sc->mactype != DWC_GMAC_EXT_DESC) - sc->rxdesc_ring[idx].desc1 = NRDESC1_RCH | RX_MAX_PACKET; + sc->rxdesc_ring[idx].desc1 = NRDESC1_RCH | + MIN(MCLBYTES, NRDESC1_RBS1_MASK); else - sc->rxdesc_ring[idx].desc1 = ERDESC1_RCH | MCLBYTES; + sc->rxdesc_ring[idx].desc1 = ERDESC1_RCH | + MIN(MCLBYTES, ERDESC1_RBS1_MASK); wmb(); sc->rxdesc_ring[idx].desc0 = RDESC0_OWN; wmb(); - return (nidx); } @@ -585,6 +581,74 @@ dwc_alloc_mbufcl(struct dwc_softc *sc) return (m); } +static struct mbuf * +dwc_rxfinish_one(struct dwc_softc *sc, struct dwc_hwdesc *desc, +struct dwc_bufmap *map) +{ + struct ifnet *ifp; + struct mbuf *m, *m0; + int len; + uint32_t rdesc0; + + m = map->mbuf; + ifp = sc->ifp; + rdesc0 = desc ->desc0; + /* Validate descriptor. */ + if (rdesc0 & RDESC0_ES) { + /* +* Errored packet. Statistic counters are updated +* globally, so do nothing +*/ + return (NULL); + } + + if ((rdesc0 & (RDESC0_FS | RDESC0_LS)) != + (RDESC0_FS | RDESC0_LS)) { + /* +* Something very wrong happens. The whole packet should be +* recevied in one descriptr. Report problem. +*/ + device_printf(sc->dev, + "%s: RX descriptor without FIRST and LAST bit set: 0x%08X", + __func__, rdesc0); + return (NULL); + } + + len = (rdesc0 >> RDESC0_FL_SHIFT) & RDESC0_FL_MASK; + if (len < 64) { + /* +* Lenght is invalid, recycle old mbuf +* Probably impossible case +*/ + return (NULL); + } + + /* Allocate new buffer */ + m0
svn commit: r362405 - in head/sys: arm/allwinner arm/amlogic/aml8726 arm64/rockchip dev/altera/dwc dev/dwc
Author: mmel Date: Fri Jun 19 18:34:27 2020 New Revision: 362405 URL: https://svnweb.freebsd.org/changeset/base/362405 Log: Finish renaming in if_dwc. By using DWC TRM terminology, normal descriptor format should be named extended and alternate descriptor format should be named normal. Should not been functional change. MFC after:4 weeks Modified: head/sys/arm/allwinner/aw_if_dwc.c head/sys/arm/amlogic/aml8726/aml8726_if_dwc.c head/sys/arm64/rockchip/if_dwc_rk.c head/sys/dev/altera/dwc/if_dwc_socfpga.c head/sys/dev/dwc/if_dwc.c head/sys/dev/dwc/if_dwc.h head/sys/dev/dwc/if_dwc_if.m Modified: head/sys/arm/allwinner/aw_if_dwc.c == --- head/sys/arm/allwinner/aw_if_dwc.c Fri Jun 19 18:27:22 2020 (r362404) +++ head/sys/arm/allwinner/aw_if_dwc.c Fri Jun 19 18:34:27 2020 (r362405) @@ -114,7 +114,7 @@ static int a20_if_dwc_mac_type(device_t dev) { - return (DWC_GMAC_ALT_DESC); + return (DWC_GMAC_NORMAL_DESC); } static int Modified: head/sys/arm/amlogic/aml8726/aml8726_if_dwc.c == --- head/sys/arm/amlogic/aml8726/aml8726_if_dwc.c Fri Jun 19 18:27:22 2020(r362404) +++ head/sys/arm/amlogic/aml8726/aml8726_if_dwc.c Fri Jun 19 18:34:27 2020(r362405) @@ -66,7 +66,7 @@ static int aml8726_if_dwc_mac_type(device_t dev) { - return (DWC_GMAC_ALT_DESC); + return (DWC_GMAC_NORMAL_DESC); } static int Modified: head/sys/arm64/rockchip/if_dwc_rk.c == --- head/sys/arm64/rockchip/if_dwc_rk.c Fri Jun 19 18:27:22 2020 (r362404) +++ head/sys/arm64/rockchip/if_dwc_rk.c Fri Jun 19 18:34:27 2020 (r362405) @@ -160,7 +160,7 @@ static int if_dwc_rk_mac_type(device_t dev) { - return (DWC_GMAC_ALT_DESC); + return (DWC_GMAC_NORMAL_DESC); } static int Modified: head/sys/dev/altera/dwc/if_dwc_socfpga.c == --- head/sys/dev/altera/dwc/if_dwc_socfpga.cFri Jun 19 18:27:22 2020 (r362404) +++ head/sys/dev/altera/dwc/if_dwc_socfpga.cFri Jun 19 18:34:27 2020 (r362405) @@ -74,7 +74,7 @@ static int if_dwc_socfpga_mac_type(device_t dev) { - return (DWC_GMAC); + return (DWC_GMAC_EXT_DESC); } static int Modified: head/sys/dev/dwc/if_dwc.c == --- head/sys/dev/dwc/if_dwc.c Fri Jun 19 18:27:22 2020(r362404) +++ head/sys/dev/dwc/if_dwc.c Fri Jun 19 18:34:27 2020(r362405) @@ -249,7 +249,7 @@ dwc_setup_txdesc(struct dwc_softc *sc, int idx, bus_ad flags = 0; --sc->txcount; } else { - if (sc->mactype == DWC_GMAC_ALT_DESC) + if (sc->mactype != DWC_GMAC_EXT_DESC) flags = NTDESC1_TCH | NTDESC1_FS | NTDESC1_LS | NTDESC1_IC; else @@ -259,7 +259,7 @@ dwc_setup_txdesc(struct dwc_softc *sc, int idx, bus_ad } sc->txdesc_ring[idx].addr1 = (uint32_t)(paddr); - if (sc->mactype == DWC_GMAC_ALT_DESC) { + if (sc->mactype != DWC_GMAC_EXT_DESC) { sc->txdesc_ring[idx].desc0 = 0; sc->txdesc_ring[idx].desc1 = flags | len; } else { @@ -537,7 +537,7 @@ dwc_setup_rxdesc(struct dwc_softc *sc, int idx, bus_ad nidx = next_rxidx(sc, idx); sc->rxdesc_ring[idx].addr2 = sc->rxdesc_ring_paddr + (nidx * sizeof(struct dwc_hwdesc)); - if (sc->mactype == DWC_GMAC_ALT_DESC) + if (sc->mactype != DWC_GMAC_EXT_DESC) sc->rxdesc_ring[idx].desc1 = NRDESC1_RCH | RX_MAX_PACKET; else sc->rxdesc_ring[idx].desc1 = ERDESC1_RCH | MCLBYTES; @@ -661,7 +661,7 @@ dwc_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_i crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN); /* Take lower 8 bits and reverse it */ val = bitreverse(~crc & 0xff); - if (ctx->sc->mactype == DWC_GMAC_ALT_DESC) + if (ctx->sc->mactype != DWC_GMAC_EXT_DESC) val >>= 2; /* Only need lower 6 bits */ hashreg = (val >> 5); hashbit = (val & 31); @@ -682,7 +682,7 @@ dwc_setup_rxfilter(struct dwc_softc *sc) DWC_ASSERT_LOCKED(sc); ifp = sc->ifp; - nhash = sc->mactype == DWC_GMAC_ALT_DESC ? 2 : 8; + nhash = sc->mactype != DWC_GMAC_EXT_DESC ? 2 : 8; /* * Set the multicast (group) filter hash. @@ -715,7 +715,7 @@ dwc_setup_rxfilter(struct dwc_softc *sc) WRITE4(sc, MAC_ADDRESS_LOW(0), lo); WRITE4(sc, MAC_ADDRESS_HIGH(0), hi); WRITE4(sc, MAC_FRAME_FILTER, ffval); - if (sc->mactype == DWC_GMAC_ALT_DESC) { + if (sc->mactype !=
svn commit: r362399 - head/sys/dev/dwc
Author: mmel Date: Fri Jun 19 18:04:41 2020 New Revision: 362399 URL: https://svnweb.freebsd.org/changeset/base/362399 Log: Use naming nomenclature used in DesignWare TRM. Use naming nomenclature used in DesignWare TRM. This driver was written by using Altera (now Intel) documentation for Arria FPGA manual. Unfortunately this manual used very different (and in some cases opposite naming) for registers and descriptor fields. Unfortunately, this makes future expansion extremely hard. Should not been functional change. MFC after:4 weeks Modified: head/sys/dev/dwc/if_dwc.c Modified: head/sys/dev/dwc/if_dwc.c == --- head/sys/dev/dwc/if_dwc.c Fri Jun 19 18:02:29 2020(r362398) +++ head/sys/dev/dwc/if_dwc.c Fri Jun 19 18:04:41 2020(r362399) @@ -93,46 +93,113 @@ __FBSDID("$FreeBSD$"); #defineDWC_ASSERT_LOCKED(sc) mtx_assert(&(sc)->mtx, MA_OWNED) #defineDWC_ASSERT_UNLOCKED(sc) mtx_assert(&(sc)->mtx, MA_NOTOWNED) -#defineDDESC_TDES0_OWN (1U << 31) -#defineDDESC_TDES0_TXINT (1U << 30) -#defineDDESC_TDES0_TXLAST (1U << 29) -#defineDDESC_TDES0_TXFIRST (1U << 28) -#defineDDESC_TDES0_TXCRCDIS(1U << 27) -#defineDDESC_TDES0_TXRINGEND (1U << 21) -#defineDDESC_TDES0_TXCHAIN (1U << 20) +/* TX descriptors - TDESC0 is almost unified */ +#defineTDESC0_OWN (1U << 31) +#defineTDESC0_IHE (1U << 16) /* IP Header Error */ +#defineTDESC0_ES (1U << 15) /* Error Summary */ +#defineTDESC0_JT (1U << 14) /* Jabber Timeout */ +#defineTDESC0_FF (1U << 13) /* Frame Flushed */ +#defineTDESC0_PCE (1U << 12) /* Payload Checksum Error */ +#defineTDESC0_LOC (1U << 11) /* Loss of Carrier */ +#defineTDESC0_NC (1U << 10) /* No Carrier */ +#defineTDESC0_LC (1U << 9) /* Late Collision */ +#defineTDESC0_EC (1U << 8) /* Excessive Collision */ +#defineTDESC0_VF (1U << 7) /* VLAN Frame */ +#defineTDESC0_CC_MASK 0xf +#defineTDESC0_CC_SHIFT 3 /* Collision Count */ +#defineTDESC0_ED (1U << 2) /* Excessive Deferral */ +#defineTDESC0_UF (1U << 1) /* Underflow Error */ +#defineTDESC0_DB (1U << 0) /* Deferred Bit */ +/* TX descriptors - TDESC0 extended format only */ +#defineETDESC0_IC (1U << 30) /* Interrupt on Completion */ +#defineETDESC0_LS (1U << 29) /* Last Segment */ +#defineETDESC0_FS (1U << 28) /* First Segment */ +#defineETDESC0_DC (1U << 27) /* Disable CRC */ +#defineETDESC0_DP (1U << 26) /* Disable Padding */ +#defineETDESC0_CIC_NONE(0U << 22) /* Checksum Insertion Control */ +#defineETDESC0_CIC_HDR (1U << 22) +#defineETDESC0_CIC_SEG (2U << 22) +#defineETDESC0_CIC_FULL(3U << 22) +#defineETDESC0_TER (1U << 21) /* Transmit End of Ring */ +#defineETDESC0_TCH (1U << 20) /* Second Address Chained */ -#defineDDESC_RDES0_OWN (1U << 31) -#defineDDESC_RDES0_FL_MASK 0x3fff -#defineDDESC_RDES0_FL_SHIFT16 /* Frame Length */ -#defineDDESC_RDES1_CHAINED (1U << 14) +/* TX descriptors - TDESC1 normal format */ +#defineNTDESC1_IC (1U << 31) /* Interrupt on Completion */ +#defineNTDESC1_LS (1U << 30) /* Last Segment */ +#defineNTDESC1_FS (1U << 29) /* First Segment */ +#defineNTDESC1_CIC_NONE(0U << 27) /* Checksum Insertion Control */ +#defineNTDESC1_CIC_HDR (1U << 27) +#defineNTDESC1_CIC_SEG (2U << 27) +#defineNTDESC1_CIC_FULL(3U << 27) +#defineNTDESC1_DC (1U << 26) /* Disable CRC */ +#defineNTDESC1_TER (1U << 25) /* Transmit End of Ring */ +#defineNTDESC1_TCH (1U << 24) /* Second Address Chained */ +/* TX descriptors - TDESC1 extended format */ +#defineETDESC1_DP (1U << 23) /* Disable Padding */ +#defineETDESC1_TBS2_MASK 0x7ff +#defineETDESC1_TBS2_SHIFT 11 /* Receive Buffer 2 Size */ +#defineETDESC1_TBS1_MASK 0x7ff +#defineETDESC1_TBS1_SHIFT 0 /* Receive Buffer 1 Size */ -/*
svn commit: r362392 - head/sys/dev/pci
Author: mmel Date: Fri Jun 19 17:33:54 2020 New Revision: 362392 URL: https://svnweb.freebsd.org/changeset/base/362392 Log: Adapt ARMADA8k PCIe driver to newly imported 5.7 DT. - temporarily disable handling with phy, we don't have driver for it yet - always clear cause for administartive interrupt. While I'm in, fix style(9) (mainly whitespace). MFC after:4 weeks Modified: head/sys/dev/pci/pci_dw_mv.c Modified: head/sys/dev/pci/pci_dw_mv.c == --- head/sys/dev/pci/pci_dw_mv.cFri Jun 19 17:32:50 2020 (r362391) +++ head/sys/dev/pci/pci_dw_mv.cFri Jun 19 17:33:54 2020 (r362392) @@ -64,15 +64,11 @@ __FBSDID("$FreeBSD$"); #define MV_GLOBAL_CONTROL_REG 0x8000 #define PCIE_APP_LTSSM_EN (1 << 2) -//#define PCIE_DEVICE_TYPE_SHIFT 4 -//#define PCIE_DEVICE_TYPE_MASK0xF -//#define PCIE_DEVICE_TYPE_RC 0x4/ #define MV_GLOBAL_STATUS_REG 0x8008 #define MV_STATUS_RDLH_LINK_UP (1 << 1) #define MV_STATUS_PHY_LINK_UP (1 << 9) - #define MV_INT_CAUSE1 0x801C #define MV_INT_MASK1 0x8020 #define INT_A_ASSERT_MASK (1 << 9) @@ -90,11 +86,7 @@ __FBSDID("$FreeBSD$"); #define MV_ARUSER_REG 0x805C #define MV_AWUSER_REG 0x8060 - - #defineMV_MAX_LANES8 - - struct pci_mv_softc { struct pci_dw_softc dw_sc; device_tdev; @@ -112,7 +104,6 @@ static struct ofw_compat_data compat_data[] = { {NULL,0}, }; - static int pci_mv_phy_init(struct pci_mv_softc *sc) { @@ -121,18 +112,23 @@ pci_mv_phy_init(struct pci_mv_softc *sc) for (i = 0; i < MV_MAX_LANES; i++) { rv = phy_get_by_ofw_idx(sc->dev, sc->node, i, &(sc->phy[i])); if (rv != 0 && rv != ENOENT) { - device_printf(sc->dev, "Cannot get phy[%d]\n", i); - goto fail; - } - if (sc->phy[i] == NULL) - continue; - rv = phy_enable(sc->phy[i]); - if (rv != 0) { - device_printf(sc->dev, "Cannot enable phy[%d]\n", i); - goto fail; - } - } - return (0); + device_printf(sc->dev, "Cannot get phy[%d]\n", i); +/* XXX revert when phy driver will be implemented */ +#if 0 + goto fail; +#else + continue; +#endif + } + if (sc->phy[i] == NULL) + continue; + rv = phy_enable(sc->phy[i]); + if (rv != 0) { + device_printf(sc->dev, "Cannot enable phy[%d]\n", i); + goto fail; + } + } + return (0); fail: for (i = 0; i < MV_MAX_LANES; i++) { @@ -173,13 +169,14 @@ pci_mv_init(struct pci_mv_softc *sc) /* Enable local interrupts */ pci_dw_dbi_wr4(sc->dev, DW_MSI_INTR0_MASK, 0x); pci_dw_dbi_wr4(sc->dev, MV_INT_MASK1, 0x); - pci_dw_dbi_wr4(sc->dev, MV_INT_MASK2, 0x); + pci_dw_dbi_wr4(sc->dev, MV_INT_MASK2, 0xFFFD); pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE1, 0x); pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE2, 0x); /* Errors have own interrupt, not yet populated in DTt */ pci_dw_dbi_wr4(sc->dev, MV_ERR_INT_MASK, 0); } + static int pci_mv_intr(void *arg) { struct pci_mv_softc *sc = arg; @@ -188,8 +185,6 @@ static int pci_mv_intr(void *arg) /* Ack all interrups */ cause1 = pci_dw_dbi_rd4(sc->dev, MV_INT_CAUSE1); cause2 = pci_dw_dbi_rd4(sc->dev, MV_INT_CAUSE2); - if (cause1 == 0 || cause2 == 0) - return(FILTER_STRAY); pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE1, cause1); pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE2, cause2); @@ -325,4 +320,4 @@ DEFINE_CLASS_1(pcib, pci_mv_driver, pci_mv_methods, sizeof(struct pci_mv_softc), pci_dw_driver); static devclass_t pci_mv_devclass; DRIVER_MODULE( pci_mv, simplebus, pci_mv_driver, pci_mv_devclass, -NULL, NULL); \ No newline at end of file +NULL, NULL); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362391 - head/sys/dev/pci
Author: mmel Date: Fri Jun 19 17:32:50 2020 New Revision: 362391 URL: https://svnweb.freebsd.org/changeset/base/362391 Log: Revert r362389, it was committed with .diff instead of .txt as commit log. Modified: head/sys/dev/pci/pci_dw_mv.c Modified: head/sys/dev/pci/pci_dw_mv.c == --- head/sys/dev/pci/pci_dw_mv.cFri Jun 19 17:32:30 2020 (r362390) +++ head/sys/dev/pci/pci_dw_mv.cFri Jun 19 17:32:50 2020 (r362391) @@ -64,11 +64,15 @@ __FBSDID("$FreeBSD$"); #define MV_GLOBAL_CONTROL_REG 0x8000 #define PCIE_APP_LTSSM_EN (1 << 2) +//#define PCIE_DEVICE_TYPE_SHIFT 4 +//#define PCIE_DEVICE_TYPE_MASK0xF +//#define PCIE_DEVICE_TYPE_RC 0x4/ #define MV_GLOBAL_STATUS_REG 0x8008 #define MV_STATUS_RDLH_LINK_UP (1 << 1) #define MV_STATUS_PHY_LINK_UP (1 << 9) + #define MV_INT_CAUSE1 0x801C #define MV_INT_MASK1 0x8020 #define INT_A_ASSERT_MASK (1 << 9) @@ -86,7 +90,11 @@ __FBSDID("$FreeBSD$"); #define MV_ARUSER_REG 0x805C #define MV_AWUSER_REG 0x8060 + + #defineMV_MAX_LANES8 + + struct pci_mv_softc { struct pci_dw_softc dw_sc; device_tdev; @@ -104,6 +112,7 @@ static struct ofw_compat_data compat_data[] = { {NULL,0}, }; + static int pci_mv_phy_init(struct pci_mv_softc *sc) { @@ -112,23 +121,18 @@ pci_mv_phy_init(struct pci_mv_softc *sc) for (i = 0; i < MV_MAX_LANES; i++) { rv = phy_get_by_ofw_idx(sc->dev, sc->node, i, &(sc->phy[i])); if (rv != 0 && rv != ENOENT) { - device_printf(sc->dev, "Cannot get phy[%d]\n", i); -/* XXX revert when phy driver will be implemented */ -#if 0 - goto fail; -#else - continue; -#endif - } - if (sc->phy[i] == NULL) - continue; - rv = phy_enable(sc->phy[i]); - if (rv != 0) { - device_printf(sc->dev, "Cannot enable phy[%d]\n", i); - goto fail; - } - } - return (0); + device_printf(sc->dev, "Cannot get phy[%d]\n", i); + goto fail; + } + if (sc->phy[i] == NULL) + continue; + rv = phy_enable(sc->phy[i]); + if (rv != 0) { + device_printf(sc->dev, "Cannot enable phy[%d]\n", i); + goto fail; + } + } + return (0); fail: for (i = 0; i < MV_MAX_LANES; i++) { @@ -169,14 +173,13 @@ pci_mv_init(struct pci_mv_softc *sc) /* Enable local interrupts */ pci_dw_dbi_wr4(sc->dev, DW_MSI_INTR0_MASK, 0x); pci_dw_dbi_wr4(sc->dev, MV_INT_MASK1, 0x); - pci_dw_dbi_wr4(sc->dev, MV_INT_MASK2, 0xFFFD); + pci_dw_dbi_wr4(sc->dev, MV_INT_MASK2, 0x); pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE1, 0x); pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE2, 0x); /* Errors have own interrupt, not yet populated in DTt */ pci_dw_dbi_wr4(sc->dev, MV_ERR_INT_MASK, 0); } - static int pci_mv_intr(void *arg) { struct pci_mv_softc *sc = arg; @@ -185,6 +188,8 @@ static int pci_mv_intr(void *arg) /* Ack all interrups */ cause1 = pci_dw_dbi_rd4(sc->dev, MV_INT_CAUSE1); cause2 = pci_dw_dbi_rd4(sc->dev, MV_INT_CAUSE2); + if (cause1 == 0 || cause2 == 0) + return(FILTER_STRAY); pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE1, cause1); pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE2, cause2); @@ -320,4 +325,4 @@ DEFINE_CLASS_1(pcib, pci_mv_driver, pci_mv_methods, sizeof(struct pci_mv_softc), pci_dw_driver); static devclass_t pci_mv_devclass; DRIVER_MODULE( pci_mv, simplebus, pci_mv_driver, pci_mv_devclass, -NULL, NULL); +NULL, NULL); \ No newline at end of file ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362389 - head/sys/dev/pci
Author: mmel Date: Fri Jun 19 17:25:54 2020 New Revision: 362389 URL: https://svnweb.freebsd.org/changeset/base/362389 Log: diff --git a/sys/dev/pci/pci_dw_mv.c b/sys/dev/pci/pci_dw_mv.c index 06a29fefbdd..571fc00f6c1 100644 --- a/sys/dev/pci/pci_dw_mv.c +++ b/sys/dev/pci/pci_dw_mv.c @@ -64,15 +64,11 @@ __FBSDID("$FreeBSD$"); #define MV_GLOBAL_CONTROL_REG0x8000 #define PCIE_APP_LTSSM_EN(1 << 2) -//#define PCIE_DEVICE_TYPE_SHIFT 4 -//#define PCIE_DEVICE_TYPE_MASK 0xF -//#define PCIE_DEVICE_TYPE_RC0x4/ #define MV_GLOBAL_STATUS_REG 0x8008 #define MV_STATUS_RDLH_LINK_UP (1 << 1) #define MV_STATUS_PHY_LINK_UP (1 << 9) - #define MV_INT_CAUSE10x801C #define MV_INT_MASK1 0x8020 #define INT_A_ASSERT_MASK (1 << 9) @@ -90,11 +86,7 @@ __FBSDID("$FreeBSD$"); #define MV_ARUSER_REG0x805C #define MV_AWUSER_REG0x8060 - - #define MV_MAX_LANES8 - - struct pci_mv_softc { struct pci_dw_softc dw_sc; device_tdev; @@ -112,7 +104,6 @@ static struct ofw_compat_data compat_data[] = { {NULL,0}, }; - static int pci_mv_phy_init(struct pci_mv_softc *sc) { @@ -121,18 +112,23 @@ pci_mv_phy_init(struct pci_mv_softc *sc) for (i = 0; i < MV_MAX_LANES; i++) { rv = phy_get_by_ofw_idx(sc->dev, sc->node, i, &(sc->phy[i])); if (rv != 0 && rv != ENOENT) { - device_printf(sc->dev, "Cannot get phy[%d]\n", i); - goto fail; - } - if (sc->phy[i] == NULL) - continue; - rv = phy_enable(sc->phy[i]); - if (rv != 0) { - device_printf(sc->dev, "Cannot enable phy[%d]\n", i); - goto fail; - } - } - return (0); + device_printf(sc->dev, "Cannot get phy[%d]\n", i); +/* XXX revert when phy driver will be implemented */ +#if 0 + goto fail; +#else + continue; +#endif + } + if (sc->phy[i] == NULL) + continue; + rv = phy_enable(sc->phy[i]); + if (rv != 0) { + device_printf(sc->dev, "Cannot enable phy[%d]\n", i); + goto fail; + } + } + return (0); fail: for (i = 0; i < MV_MAX_LANES; i++) { @@ -173,13 +169,14 @@ pci_mv_init(struct pci_mv_softc *sc) /* Enable local interrupts */ pci_dw_dbi_wr4(sc->dev, DW_MSI_INTR0_MASK, 0x); pci_dw_dbi_wr4(sc->dev, MV_INT_MASK1, 0x); - pci_dw_dbi_wr4(sc->dev, MV_INT_MASK2, 0x); + pci_dw_dbi_wr4(sc->dev, MV_INT_MASK2, 0xFFFD); pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE1, 0x); pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE2, 0x); /* Errors have own interrupt, not yet populated in DTt */ pci_dw_dbi_wr4(sc->dev, MV_ERR_INT_MASK, 0); } + static int pci_mv_intr(void *arg) { struct pci_mv_softc *sc = arg; @@ -188,8 +185,6 @@ static int pci_mv_intr(void *arg) /* Ack all interrups */ cause1 = pci_dw_dbi_rd4(sc->dev, MV_INT_CAUSE1); cause2 = pci_dw_dbi_rd4(sc->dev, MV_INT_CAUSE2); - if (cause1 == 0 || cause2 == 0) - return(FILTER_STRAY); pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE1, cause1); pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE2, cause2); Modified: head/sys/dev/pci/pci_dw_mv.c Modified: head/sys/dev/pci/pci_dw_mv.c == --- head/sys/dev/pci/pci_dw_mv.cFri Jun 19 16:26:42 2020 (r362388) +++ head/sys/dev/pci/pci_dw_mv.cFri Jun 19 17:25:54 2020 (r362389) @@ -64,15 +64,11 @@ __FBSDID("$FreeBSD$"); #define MV_GLOBAL_CONTROL_REG 0x8000 #define PCIE_APP_LTSSM_EN (1 << 2) -//#define PCIE_DEVICE_TYPE_SHIFT 4 -//#define PCIE_DEVICE_TYPE_MASK0xF -//#define PCIE_DEVICE_TYPE_RC 0x4/ #define MV_GLOBAL_STATUS_REG 0x8008 #define MV_STATUS_RDLH_LINK_UP (1 << 1) #define MV_STATUS_PHY_LINK_UP (1 << 9) - #define MV_INT_CAUSE1 0x801C #define MV_INT_MASK1 0x8020 #define INT_A_ASSERT_MASK (1 << 9) @@ -90,11 +86,7 @@ __FBSDID("$FreeBSD$"); #define MV_ARUSER_REG 0x805C #define MV_AWUSER_REG 0x8060 - - #defineMV_MAX_LANES8 - - struct pci_mv_softc { struct pci_dw_softc dw_sc; device_t
svn commit: r362388 - head/sys/arm64/arm64
Author: mmel Date: Fri Jun 19 16:26:42 2020 New Revision: 362388 URL: https://svnweb.freebsd.org/changeset/base/362388 Log: Use native-sized accesses when accessing memory from kdb. Not all MMIO mapped devices supports byte access. MFC after:4 weeks Modified: head/sys/arm64/arm64/db_interface.c Modified: head/sys/arm64/arm64/db_interface.c == --- head/sys/arm64/arm64/db_interface.c Fri Jun 19 16:15:06 2020 (r362387) +++ head/sys/arm64/arm64/db_interface.c Fri Jun 19 16:26:42 2020 (r362388) @@ -118,12 +118,25 @@ db_read_bytes(vm_offset_t addr, size_t size, char *dat void *prev_jb; const char *src; int ret; + uint64_t tmp64; + uint32_t tmp32; + uint16_t tmp16; prev_jb = kdb_jmpbuf(jb); ret = setjmp(jb); if (ret == 0) { src = (const char *)addr; + if (size == 8 && (addr & 7) == 0) { + tmp64 = *((const int *)src); + src = (const char *) + } else if (size == 4 && (addr & 3) == 0) { + tmp32 = *((const int *)src); + src = (const char *) + } else if (size == 2 && (addr & 1) == 0) { + tmp16 = *((const short *)src); + src = (const char *) + } while (size-- > 0) *data++ = *src++; } @@ -142,14 +155,33 @@ db_write_bytes(vm_offset_t addr, size_t size, char *da void *prev_jb; char *dst; int ret; + uint64_t tmp64; + uint32_t tmp32; + uint16_t tmp16; prev_jb = kdb_jmpbuf(jb); ret = setjmp(jb); if (ret == 0) { - dst = (char *)addr; - while (size-- > 0) - *dst++ = *data++; - + if (size == 8 && (addr & 7) == 0) { + dst = (char *) + while (size-- > 0) + *dst++ = *data++; + *((uint64_t *)addr) = tmp64; + } else if (size == 4 && (addr & 3) == 0) { + dst = (char *) + while (size-- > 0) + *dst++ = *data++; + *((uint32_t *)addr) = tmp32; + } else if (size == 2 && (addr & 1) == 0) { + dst = (char *) + while (size-- > 0) + *dst++ = *data++; + *((uint32_t *)addr) = tmp16; + } else { + dst = (char *)addr; + while (size-- > 0) + *dst++ = *data++; + } dsb(ish); /* Clean D-cache and invalidate I-cache */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362387 - head/sys/dev/pci
Author: mmel Date: Fri Jun 19 16:15:06 2020 New Revision: 362387 URL: https://svnweb.freebsd.org/changeset/base/362387 Log: Improve DesignWare PCIe driver: - only normal memory window is mandatory, prefetchable memory and I/O windows should be optional - full PCIe configuration space is supported - remove duplicated check from function for accessing configuration space. It is already contained in pci_dw_check_dev() MFC after:2 weeks Modified: head/sys/dev/pci/pci_dw.c Modified: head/sys/dev/pci/pci_dw.c == --- head/sys/dev/pci/pci_dw.c Fri Jun 19 15:32:55 2020(r362386) +++ head/sys/dev/pci/pci_dw.c Fri Jun 19 16:15:06 2020(r362387) @@ -156,7 +156,7 @@ pci_dw_check_dev(struct pci_dw_softc *sc, u_int bus, u int rv; if (bus < sc->bus_start || bus > sc->bus_end || slot > PCI_SLOTMAX || - func > PCI_FUNCMAX || reg > PCI_REGMAX) + func > PCI_FUNCMAX || reg > PCIE_REGMAX) return (false); /* link is needed for access to all non-root busses */ @@ -234,7 +234,7 @@ pci_dw_setup_hw(struct pci_dw_softc *sc) return (rv); /* If we have enouht viewports ..*/ - if (sc->num_viewport >= 3) { + if (sc->num_viewport >= 3 && sc->io_range.size != 0) { /* Setup outbound I/O window */ rv = pci_dw_map_out_atu(sc, 0, IATU_CTRL1_TYPE_MEM, sc->io_range.host, sc->io_range.pci, sc->io_range.size); @@ -345,7 +345,7 @@ pci_dw_decode_ranges(struct pci_dw_softc *sc, struct o } } } - if ((sc->io_range.size == 0) || (sc->mem_range.size == 0)) { + if (sc->mem_range.size == 0) { device_printf(sc->dev, " Not all required ranges are found in DT\n"); return (ENXIO); @@ -375,10 +375,6 @@ pci_dw_read_config(device_t dev, u_int bus, u_int slot if (!pci_dw_check_dev(sc, bus, slot, func, reg)) return (0xU); - if ((slot > PCI_SLOTMAX) || (func > PCI_FUNCMAX) || - (reg > PCI_REGMAX)) - return (0xU); - if (bus == sc->root_bus) { res = (sc->dbi_res); } else { @@ -424,10 +420,6 @@ pci_dw_write_config(device_t dev, u_int bus, u_int slo sc = device_get_softc(dev); if (!pci_dw_check_dev(sc, bus, slot, func, reg)) - return; - - if ((slot > PCI_SLOTMAX) || (func > PCI_FUNCMAX) || - (reg > PCI_REGMAX)) return; if (bus == sc->root_bus) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362386 - head/sys/arm/mv/armada38x
Author: mmel Date: Fri Jun 19 15:32:55 2020 New Revision: 362386 URL: https://svnweb.freebsd.org/changeset/base/362386 Log: Add specific stub for ARMADA 8k SoC to Marvell RTC driver. The AXI bridge is different between ARMADA 38x and 8K, and both platforms needs specific setup to mitigate HW issues with accessing RTC registers. MFC after:2 weeks Modified: head/sys/arm/mv/armada38x/armada38x_rtc.c Modified: head/sys/arm/mv/armada38x/armada38x_rtc.c == --- head/sys/arm/mv/armada38x/armada38x_rtc.c Fri Jun 19 15:21:33 2020 (r362385) +++ head/sys/arm/mv/armada38x/armada38x_rtc.c Fri Jun 19 15:32:55 2020 (r362386) @@ -72,14 +72,27 @@ __FBSDID("$FreeBSD$"); #defineMV_RTC_LOCK(sc) mtx_lock_spin(&(sc)->mutex) #defineMV_RTC_UNLOCK(sc) mtx_unlock_spin(&(sc)->mutex) -#defineRTC_BRIDGE_TIMING_CTRL 0x0 -#defineRTC_WRCLK_PERIOD_SHIFT 0 -#defineRTC_WRCLK_PERIOD_MASK 0x0003FF -#defineRTC_WRCLK_PERIOD_MAX0x3FF -#defineRTC_READ_OUTPUT_DELAY_SHIFT 26 -#defineRTC_READ_OUTPUT_DELAY_MASK 0x007C00 -#defineRTC_READ_OUTPUT_DELAY_MAX 0x1F +#defineA38X_RTC_BRIDGE_TIMING_CTRL 0x0 +#defineA38X_RTC_WRCLK_PERIOD_SHIFT 0 +#defineA38X_RTC_WRCLK_PERIOD_MASK 0x0003FF +#defineA38X_RTC_WRCLK_PERIOD_MAX 0x3FF +#defineA38X_RTC_READ_OUTPUT_DELAY_SHIFT26 +#defineA38X_RTC_READ_OUTPUT_DELAY_MASK 0x007C00 +#defineA38X_RTC_READ_OUTPUT_DELAY_MAX 0x1F +#defineA8K_RTC_BRIDGE_TIMING_CTRL0 0x0 +#defineA8K_RTC_WRCLK_PERIOD_SHIFT 0 +#defineA8K_RTC_WRCLK_PERIOD_MASK 0x00 +#defineA8K_RTC_WRCLK_PERIOD_VAL0x3FF +#defineA8K_RTC_WRCLK_SETUP_SHIFT 16 +#defineA8K_RTC_WRCLK_SETUP_MASK0x00 +#defineA8K_RTC_WRCLK_SETUP_VAL 29 +#defineA8K_RTC_BRIDGE_TIMING_CTRL1 0x4 +#defineA8K_RTC_READ_OUTPUT_DELAY_SHIFT 0 +#defineA8K_RTC_READ_OUTPUT_DELAY_MASK 0x00 +#defineA8K_RTC_READ_OUTPUT_DELAY_VAL 0x3F + + #defineRTC_RES 0 #defineRTC_SOC_RES 1 @@ -94,6 +107,7 @@ struct mv_rtc_softc { device_tdev; struct resource *res[2]; struct mtx mutex; + int rtc_type; }; static int mv_rtc_probe(device_t dev); @@ -107,7 +121,8 @@ static inline uint32_t mv_rtc_reg_read(struct mv_rtc_s bus_size_t off); static inline int mv_rtc_reg_write(struct mv_rtc_softc *sc, bus_size_t off, uint32_t val); -static inline void mv_rtc_configure_bus(struct mv_rtc_softc *sc); +static inline void mv_rtc_configure_bus_a38x(struct mv_rtc_softc *sc); +static inline void mv_rtc_configure_bus_a8k(struct mv_rtc_softc *sc); static device_method_t mv_rtc_methods[] = { DEVMETHOD(device_probe, mv_rtc_probe), @@ -126,10 +141,13 @@ static driver_t mv_rtc_driver = { sizeof(struct mv_rtc_softc), }; +#define RTC_A38X 1 +#define RTC_A8K 2 + static struct ofw_compat_data mv_rtc_compat[] = { - {"marvell,armada-380-rtc", true}, - {"marvell,armada-8k-rtc", true}, - {NULL, false}, + {"marvell,armada-380-rtc", RTC_A38X}, + {"marvell,armada-8k-rtc", RTC_A8K}, + {NULL, 0}, }; static devclass_t mv_rtc_devclass; @@ -198,20 +216,29 @@ mv_rtc_attach(device_t dev) sc = device_get_softc(dev); sc->dev = dev; + sc->rtc_type = ofw_bus_search_compatible(dev, mv_rtc_compat)->ocd_data; - clock_register(dev, RTC_RES_US); - mtx_init(>mutex, device_get_nameunit(dev), NULL, MTX_SPIN); ret = bus_alloc_resources(dev, res_spec, sc->res); - if (ret != 0) { device_printf(dev, "could not allocate resources\n"); mtx_destroy(>mutex); return (ENXIO); } - mv_rtc_configure_bus(sc); + switch (sc->rtc_type) { + case RTC_A38X: + mv_rtc_configure_bus_a38x(sc); + break; + case RTC_A8K: + mv_rtc_configure_bus_a8k(sc); + break; + default: + panic("Unknown RTC type: %d", sc->rtc_type); + } + clock_register(dev, RTC_RES_US); + return (0); } @@ -239,13 +266,15 @@ mv_rtc_gettime(device_t dev, struct timespec *ts) MV_RTC_LOCK(sc); /* -* According to HW Errata if more than one second between -* two time reads is detected, then read once again +*
svn commit: r362385 - in head/sys: arm/mv conf
Author: mmel Date: Fri Jun 19 15:21:33 2020 New Revision: 362385 URL: https://svnweb.freebsd.org/changeset/base/362385 Log: Add specialized gpio driver for ARMADA 8k SoC. Older marvell gpio blocks are to different for reusing/enhancing existing frivers. MFC after:2 weeks Added: head/sys/arm/mv/mvebu_gpio.c (contents, props changed) Modified: head/sys/arm/mv/gpio.c head/sys/conf/files.arm64 Modified: head/sys/arm/mv/gpio.c == --- head/sys/arm/mv/gpio.c Fri Jun 19 14:28:56 2020(r362384) +++ head/sys/arm/mv/gpio.c Fri Jun 19 15:21:33 2020(r362385) @@ -60,9 +60,6 @@ __FBSDID("$FreeBSD$"); #include "gpio_if.h" -#ifdef __aarch64__ -#include "opt_soc.h" -#endif #define GPIO_MAX_INTR_COUNT8 #define GPIO_PINS_PER_REG 32 @@ -199,9 +196,6 @@ EARLY_DRIVER_MODULE(mv_gpio, simplebus, mv_gpio_driver struct ofw_compat_data compat_data[] = { { "mrvl,gpio", 1 }, { "marvell,orion-gpio", 1 }, -#ifdef SOC_MARVELL_8K - { "marvell,armada-8k-gpio", 1 }, -#endif { NULL, 0 } }; Added: head/sys/arm/mv/mvebu_gpio.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/mvebu_gpio.cFri Jun 19 15:21:33 2020 (r362385) @@ -0,0 +1,869 @@ +/*- + * Copyright (c) 2020 Michal Meloun + * + * 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 +__FBSDID("$FreeBSD$"); + +/* + * ARMADA 8040 GPIO driver. + */ +#include "opt_platform.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include + +#include +#include +#include + +#include "pic_if.h" +#include "syscon_if.h" + +#defineGPIO_LOCK(_sc) mtx_lock(&(_sc)->mtx) +#defineGPIO_UNLOCK(_sc)mtx_unlock(&(_sc)->mtx) +#defineGPIO_LOCK_INIT(_sc) mtx_init(&_sc->mtx, \ + device_get_nameunit(_sc->dev), "mvebu_gpio", MTX_DEF) +#defineGPIO_LOCK_DESTROY(_sc) mtx_destroy(&_sc->mtx); +#defineGPIO_ASSERT_LOCKED(_sc) mtx_assert(&_sc->mtx, MA_OWNED); +#defineGPIO_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->mtx, MA_NOTOWNED); + +#defineGPIO_DATA_OUT 0x00 +#defineGPIO_CONTROL0x04 +#defineGPIO_BLINK_ENA 0x08 +#defineGPIO_DATA_IN_POL0x0C +#defineGPIO_DATA_IN0x10 +#defineGPIO_INT_CAUSE 0x14 +#defineGPIO_INT_MASK 0x18 +#defineGPIO_INT_LEVEL_MASK 0x1C +#defineGPIO_CONTROL_SET0x28 +#defineGPIO_CONTROL_CLR0x2C +#defineGPIO_DATA_SET 0x30 +#defineGPIO_DATA_CLR 0x34 + +#defineGPIO_BIT(_p)((_p) % 32) +#defineGPIO_REGNUM(_p) ((_p) / 32) + +#defineMV_GPIO_MAX_NIRQS 4 +#defineMV_GPIO_MAX_NPINS 32 + +#defineRD4(sc, reg)SYSCON_READ_4((sc)->syscon, (reg)) +#defineWR4(sc, reg, val) SYSCON_WRITE_4((sc)->syscon, (reg), (val)) + +struct mvebu_gpio_irqsrc { + struct intr_irqsrc isrc; + u_int irq; + boolis_level; + boolis_inverted; +}; + +struct mvebu_gpio_softc; +struct mvebu_gpio_irq_cookie { + struct mvebu_gpio_softc *sc; + i
svn commit: r362384 - head/sys/modules/dtb/mv
Author: mmel Date: Fri Jun 19 14:28:56 2020 New Revision: 362384 URL: https://svnweb.freebsd.org/changeset/base/362384 Log: Add DTB files for ARMADA 8040 based boards. MFC after:2 weeks Modified: head/sys/modules/dtb/mv/Makefile Modified: head/sys/modules/dtb/mv/Makefile == --- head/sys/modules/dtb/mv/MakefileFri Jun 19 13:48:23 2020 (r362383) +++ head/sys/modules/dtb/mv/MakefileFri Jun 19 14:28:56 2020 (r362384) @@ -7,7 +7,11 @@ DTS= \ armada-388-gp.dts .elif ${MACHINE_ARCH} == "aarch64" DTS= \ - marvell/armada-3720-espressobin.dts + marvell/armada-3720-espressobin.dts \ + marvell/armada-8040-clearfog-gt-8k.dts \ + marvell/armada-8040-db \ + marvell/armada-8040-mcbin.dts \ + marvell/armada-8040-mcbin-singleshot.dts .endif .include ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362053 - head/sys/arm/nvidia
Author: mmel Date: Thu Jun 11 12:53:22 2020 New Revision: 362053 URL: https://svnweb.freebsd.org/changeset/base/362053 Log: Fix grabbing of tegra uart. An attempt to write to FCR register may corrupt transmit FIFO, so we should wait for the FIFO to be empty before we can modify it. MFC after:1 week Modified: head/sys/arm/nvidia/tegra_uart.c Modified: head/sys/arm/nvidia/tegra_uart.c == --- head/sys/arm/nvidia/tegra_uart.cThu Jun 11 12:35:00 2020 (r362052) +++ head/sys/arm/nvidia/tegra_uart.cThu Jun 11 12:53:22 2020 (r362053) @@ -102,6 +102,10 @@ tegra_uart_grab(struct uart_softc *sc) uart_lock(sc->sc_hwmtx); ier = uart_getreg(bas, REG_IER); uart_setreg(bas, REG_IER, ier & ns8250->ier_mask); + + while ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0) + ; + uart_setreg(bas, REG_FCR, 0); uart_barrier(bas); uart_unlock(sc->sc_hwmtx); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r360463 - head/libexec/rtld-elf
On 29.04.2020 17:20, Konstantin Belousov wrote: > On Wed, Apr 29, 2020 at 02:06:42PM +0000, Michal Meloun wrote: >> Author: mmel >> Date: Wed Apr 29 14:06:42 2020 >> New Revision: 360463 >> URL: https://svnweb.freebsd.org/changeset/base/360463 >> >> Log: >> Don't allow to use FPU inside of rtld library. >> Clang10 may use FPU instructions for optimizing operations with >> memory blocks. But we don't want to do lengthy save/restore of all >> FPU registers across each rtld_start() call. >> >> MFC after: 3 week >> >> Modified: >> head/libexec/rtld-elf/Makefile >> >> Modified: head/libexec/rtld-elf/Makefile >> == >> --- head/libexec/rtld-elf/Makefile Wed Apr 29 13:45:21 2020 >> (r360462) >> +++ head/libexec/rtld-elf/Makefile Wed Apr 29 14:06:42 2020 >> (r360463) >> @@ -48,6 +48,9 @@ MLINKS?= rtld.1 ld-elf.so.1.1 \ >> rtld.1 ld.so.1 >> >> CFLAGS+=-fpic -DPIC $(DEBUG) >> +CFLAGS.armv6+= -mfpu=none >> +CFLAGS.armv7+= -mfpu=none > I cleaned rtld-elf/Makefile of all MD bits, please move this to > arm/Makefile.inc. > Done in r360469. arm/Makefile.inc is, of course, much better place for these flags. Thanks for pointing me me on this. Michal >> + >> LDFLAGS+= -shared -Wl,-Bsymbolic -Wl,-z,defs -nostdlib -e ${RTLD_ENTRY} >> # Pull in the dependencies that we use from libc >> .include "rtld-libc/Makefile.inc" ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r360469 - in head/libexec/rtld-elf: . arm
Author: mmel Date: Wed Apr 29 16:05:50 2020 New Revision: 360469 URL: https://svnweb.freebsd.org/changeset/base/360469 Log: Move ARM specific flags to arm/Makefile.inc Requested by: kib MFC with: r360463 Modified: head/libexec/rtld-elf/Makefile head/libexec/rtld-elf/arm/Makefile.inc Modified: head/libexec/rtld-elf/Makefile == --- head/libexec/rtld-elf/Makefile Wed Apr 29 16:04:59 2020 (r360468) +++ head/libexec/rtld-elf/Makefile Wed Apr 29 16:05:50 2020 (r360469) @@ -48,9 +48,7 @@ MLINKS?= rtld.1 ld-elf.so.1.1 \ rtld.1 ld.so.1 CFLAGS+= -fpic -DPIC $(DEBUG) -CFLAGS.armv6+= -mfpu=none -CFLAGS.armv7+= -mfpu=none - + LDFLAGS+= -shared -Wl,-Bsymbolic -Wl,-z,defs -nostdlib -e ${RTLD_ENTRY} # Pull in the dependencies that we use from libc .include "rtld-libc/Makefile.inc" Modified: head/libexec/rtld-elf/arm/Makefile.inc == --- head/libexec/rtld-elf/arm/Makefile.inc Wed Apr 29 16:04:59 2020 (r360468) +++ head/libexec/rtld-elf/arm/Makefile.inc Wed Apr 29 16:05:50 2020 (r360469) @@ -5,3 +5,4 @@ # correctly linked. As some of the functions are used before we have # shared libraries. LIBADD+= compiler_rt +CFLAGS+= -mfpu=none ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r360467 - head/sys/dev/dwc
Author: mmel Date: Wed Apr 29 14:36:50 2020 New Revision: 360467 URL: https://svnweb.freebsd.org/changeset/base/360467 Log: Fix style(9). Strip write only variables. Not a functional change. MFC after:1 week Modified: head/sys/dev/dwc/if_dwc.c head/sys/dev/dwc/if_dwcvar.h Modified: head/sys/dev/dwc/if_dwc.c == --- head/sys/dev/dwc/if_dwc.c Wed Apr 29 14:31:25 2020(r360466) +++ head/sys/dev/dwc/if_dwc.c Wed Apr 29 14:36:50 2020(r360467) @@ -252,14 +252,13 @@ dwc_txstart_locked(struct dwc_softc *sc) ifp = sc->ifp; - if (ifp->if_drv_flags & IFF_DRV_OACTIVE) { + if (ifp->if_drv_flags & IFF_DRV_OACTIVE) return; - } enqueued = 0; for (;;) { - if (sc->txcount == (TX_DESC_COUNT-1)) { + if (sc->txcount == (TX_DESC_COUNT - 1)) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } @@ -268,7 +267,7 @@ dwc_txstart_locked(struct dwc_softc *sc) if (m == NULL) break; if (dwc_setup_txbuf(sc, sc->tx_idx_head, ) != 0) { - IFQ_DRV_PREPEND(>if_snd, m); +IFQ_DRV_PREPEND(>if_snd, m); break; } BPF_MTAP(ifp, m); @@ -469,7 +468,7 @@ dwc_setup_rxdesc(struct dwc_softc *sc, int idx, bus_ad sc->rxdesc_ring[idx].addr = (uint32_t)paddr; nidx = next_rxidx(sc, idx); - sc->rxdesc_ring[idx].addr_next = sc->rxdesc_ring_paddr +\ + sc->rxdesc_ring[idx].addr_next = sc->rxdesc_ring_paddr + (nidx * sizeof(struct dwc_hwdesc)); if (sc->mactype == DWC_GMAC_ALT_DESC) sc->rxdesc_ring[idx].tdes1 = DDESC_CNTL_CHAINED | RX_MAX_PACKET; @@ -493,9 +492,8 @@ dwc_setup_rxbuf(struct dwc_softc *sc, int idx, struct error = bus_dmamap_load_mbuf_sg(sc->rxbuf_tag, sc->rxbuf_map[idx].map, m, , , 0); - if (error != 0) { + if (error != 0) return (error); - } KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); @@ -1167,10 +1165,6 @@ dwc_attach(device_t dev) device_printf(dev, "could not allocate resources\n"); return (ENXIO); } - - /* Memory interface */ - sc->bst = rman_get_bustag(sc->res[0]); - sc->bsh = rman_get_bushandle(sc->res[0]); /* Read MAC before reset */ if (dwc_get_hwaddr(sc, macaddr)) { Modified: head/sys/dev/dwc/if_dwcvar.h == --- head/sys/dev/dwc/if_dwcvar.hWed Apr 29 14:31:25 2020 (r360466) +++ head/sys/dev/dwc/if_dwcvar.hWed Apr 29 14:36:50 2020 (r360467) @@ -57,8 +57,6 @@ struct dwc_bufmap { struct dwc_softc { struct resource *res[2]; - bus_space_tag_t bst; - bus_space_handle_t bsh; device_tdev; int mactype; int mii_clk; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r360466 - head/sys/arm64/arm64
Author: mmel Date: Wed Apr 29 14:31:25 2020 New Revision: 360466 URL: https://svnweb.freebsd.org/changeset/base/360466 Log: Export tracing facility of GIC500 ITS block. Possibility of tracing of processing message based interrupts is very useful for debugging of PCIe driver, mainly for its MSI part. MFC after: 1 week Modified: head/sys/arm64/arm64/gic_v3_reg.h head/sys/arm64/arm64/gicv3_its.c Modified: head/sys/arm64/arm64/gic_v3_reg.h == --- head/sys/arm64/arm64/gic_v3_reg.h Wed Apr 29 14:15:21 2020 (r360465) +++ head/sys/arm64/arm64/gic_v3_reg.h Wed Apr 29 14:31:25 2020 (r360466) @@ -220,6 +220,8 @@ (rev) << GITS_IIDR_REVISION_SHIFT | \ (impl) << GITS_IIDR_IMPLEMENTOR_SHIFT) +#define GITS_IIDR_IMPL_ARM (0x43B) +#define GITS_IIDR_PROD_GIC500 (0x0) #define GITS_IIDR_IMPL_CAVIUM (0x34c) #define GITS_IIDR_PROD_THUNDER (0xa1) #define GITS_IIDR_VAR_THUNDER_1(0x0) @@ -359,6 +361,18 @@ #defineLPI_CONF_PRIO_MASK (0xFC) #defineLPI_CONF_GROUP1 (1 << 1) #defineLPI_CONF_ENABLE (1 << 0) + +/* + * GIC 500 ITS tracking facility + */ +#defineGITS_TRKCTLR0xC000 +#defineGITS_TRKR 0xC004 +#defineGITS_TRKDIDR0xC008 +#defineGITS_TRKPIDR0xC00C +#defineGITS_TRKVIDR0xC010 +#defineGITS_TRKTGTR0xC014 +#defineGITS_TRKICR 0xC018 +#defineGITS_TRKLCR 0xC018 /* * CPU interface Modified: head/sys/arm64/arm64/gicv3_its.c == --- head/sys/arm64/arm64/gicv3_its.cWed Apr 29 14:15:21 2020 (r360465) +++ head/sys/arm64/arm64/gicv3_its.cWed Apr 29 14:31:25 2020 (r360466) @@ -49,7 +49,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include @@ -229,6 +231,7 @@ struct gicv3_its_irqsrc { }; struct gicv3_its_softc { + device_tdev; struct intr_pic *sc_pic; struct resource *sc_its_res; @@ -262,6 +265,7 @@ struct gicv3_its_softc { #defineITS_FLAGS_LPI_CONF_FLUSH0x0002 #defineITS_FLAGS_ERRATA_CAVIUM_22375 0x0004 u_int sc_its_flags; + booltrace_enable; }; static void *conf_base; @@ -713,6 +717,86 @@ its_init_cpu(device_t dev, struct gicv3_its_softc *sc) } static int +gicv3_its_sysctl_trace_enable(SYSCTL_HANDLER_ARGS) +{ + struct gicv3_its_softc *sc; + int rv; + + sc = arg1; + + rv = sysctl_handle_bool(oidp, >trace_enable, 0, req); + if (rv != 0 || req->newptr == NULL) + return (rv); + if (sc->trace_enable) + gic_its_write_8(sc, GITS_TRKCTLR, 3); + else + gic_its_write_8(sc, GITS_TRKCTLR, 0); + + return (0); +} + +static int +gicv3_its_sysctl_trace_regs(SYSCTL_HANDLER_ARGS) +{ + struct gicv3_its_softc *sc; + struct sbuf *sb; + int err; + + sc = arg1; + sb = sbuf_new_for_sysctl(NULL, NULL, 128, req); + if (sb == NULL) { + device_printf(sc->dev, "Could not allocate sbuf for output.\n"); + return (ENOMEM); + } + sbuf_cat(sb, "\n"); + sbuf_printf(sb, "GITS_TRKCTLR: 0x%08X\n", + gic_its_read_4(sc, GITS_TRKCTLR)); + sbuf_printf(sb, "GITS_TRKR:0x%08X\n", + gic_its_read_4(sc, GITS_TRKR)); + sbuf_printf(sb, "GITS_TRKDIDR: 0x%08X\n", + gic_its_read_4(sc, GITS_TRKDIDR)); + sbuf_printf(sb, "GITS_TRKPIDR: 0x%08X\n", + gic_its_read_4(sc, GITS_TRKPIDR)); + sbuf_printf(sb, "GITS_TRKVIDR: 0x%08X\n", + gic_its_read_4(sc, GITS_TRKVIDR)); + sbuf_printf(sb, "GITS_TRKTGTR: 0x%08X\n", + gic_its_read_4(sc, GITS_TRKTGTR)); + + err = sbuf_finish(sb); + if (err) + device_printf(sc->dev, "Error finishing sbuf: %d\n", err); + sbuf_delete(sb); + return(err); +} + +static int +gicv3_its_init_sysctl(struct gicv3_its_softc *sc) +{ + struct sysctl_oid *oid, *child; + struct sysctl_ctx_list *ctx_list; + + ctx_list = device_get_sysctl_ctx(sc->dev); + child = device_get_sysctl_tree(sc->dev); + oid = SYSCTL_ADD_NODE(ctx_list, + SYSCTL_CHILDREN(child), OID_AUTO, "tracing", + CTLFLAG_RD| CTLFLAG_MPSAFE, NULL, "Messages tracing"); + if (oid == NULL) + return (ENXIO); + + /* Add registers */ + SYSCTL_ADD_PROC(ctx_list, + SYSCTL_CHILDREN(oid), OID_AUTO, "enable", + CTLTYPE_U8 | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, +
svn commit: r360464 - head/sys/kern
Author: mmel Date: Wed Apr 29 14:14:15 2020 New Revision: 360464 URL: https://svnweb.freebsd.org/changeset/base/360464 Log: Don't try to set frequendcy for enumerated but newer started CPUs. Openfirmare enumerates and installs the driver for all processors, regardless of whether they will be started later (because of power constrains for example). MFC after: 3 weeks Modified: head/sys/kern/kern_cpu.c Modified: head/sys/kern/kern_cpu.c == --- head/sys/kern/kern_cpu.cWed Apr 29 14:06:42 2020(r360463) +++ head/sys/kern/kern_cpu.cWed Apr 29 14:14:15 2020(r360464) @@ -325,6 +325,12 @@ cf_set_method(device_t dev, const struct cf_level *lev /* Bind to the target CPU before switching. */ pc = cpu_get_pcpu(set->dev); + + /* Skip settings if CPU is not started. */ + if (pc == NULL) { + error = 0; + goto out; + } thread_lock(curthread); pri = curthread->td_priority; sched_prio(curthread, PRI_MIN); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r360463 - head/libexec/rtld-elf
Author: mmel Date: Wed Apr 29 14:06:42 2020 New Revision: 360463 URL: https://svnweb.freebsd.org/changeset/base/360463 Log: Don't allow to use FPU inside of rtld library. Clang10 may use FPU instructions for optimizing operations with memory blocks. But we don't want to do lengthy save/restore of all FPU registers across each rtld_start() call. MFC after:3 week Modified: head/libexec/rtld-elf/Makefile Modified: head/libexec/rtld-elf/Makefile == --- head/libexec/rtld-elf/Makefile Wed Apr 29 13:45:21 2020 (r360462) +++ head/libexec/rtld-elf/Makefile Wed Apr 29 14:06:42 2020 (r360463) @@ -48,6 +48,9 @@ MLINKS?= rtld.1 ld-elf.so.1.1 \ rtld.1 ld.so.1 CFLAGS+= -fpic -DPIC $(DEBUG) +CFLAGS.armv6+= -mfpu=none +CFLAGS.armv7+= -mfpu=none + LDFLAGS+= -shared -Wl,-Bsymbolic -Wl,-z,defs -nostdlib -e ${RTLD_ENTRY} # Pull in the dependencies that we use from libc .include "rtld-libc/Makefile.inc" ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r360462 - head/sys/arm64/rockchip
Author: mmel Date: Wed Apr 29 13:45:21 2020 New Revision: 360462 URL: https://svnweb.freebsd.org/changeset/base/360462 Log: Don't try to re-initialize already preseted regulator. Don't set initial voltage for regulators having their voltage already in allowed range. As side effect of this change, we don't try to set initial voltage for fixed voltage regulators - these don't have impemented voltage set method so their initialization has always failed. MFC after:3 weeks Modified: head/sys/arm64/rockchip/rk805.c Modified: head/sys/arm64/rockchip/rk805.c == --- head/sys/arm64/rockchip/rk805.c Wed Apr 29 13:43:15 2020 (r360461) +++ head/sys/arm64/rockchip/rk805.c Wed Apr 29 13:45:21 2020 (r360462) @@ -105,6 +105,7 @@ struct rk805_softc { static int rk805_regnode_status(struct regnode *regnode, int *status); static int rk805_regnode_set_voltage(struct regnode *regnode, int min_uvolt, int max_uvolt, int *udelay); +static int rk805_regnode_get_voltage(struct regnode *regnode, int *uvolt); static struct rk805_regdef rk805_regdefs[] = { { @@ -366,13 +367,21 @@ rk805_regnode_init(struct regnode *regnode) { struct rk805_reg_sc *sc; struct regnode_std_param *param; - int rv, udelay, status; + int rv, udelay, uvolt, status; sc = regnode_get_softc(regnode); + dprintf(sc, "Regulator %s init called\n", sc->def->name); param = regnode_get_stdparam(regnode); if (param->min_uvolt == 0) return (0); + /* Check that the regulator is preset to the correct voltage */ + rv = rk805_regnode_get_voltage(regnode, ); + if (rv != 0) + return(rv); + + if (uvolt >= param->min_uvolt && uvolt <= param->max_uvolt) + return(0); /* * Set the regulator at the correct voltage if it is not enabled. * Do not enable it, this is will be done either by a ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r360461 - head/sys/arm64/rockchip
Author: mmel Date: Wed Apr 29 13:43:15 2020 New Revision: 360461 URL: https://svnweb.freebsd.org/changeset/base/360461 Log: Multiple fixes for rockchip iodomain driver: - always initialize selector of voltage signaling standard. Various versions of U-boot leaves voltage signaling standard settings for PMUIO2 domain in different state. Always initialize it into expected state. - start the driver as early as possible, the IO domains should be initialized before other drivers are attached. - rename RK3399 register to its name founds in TRM. This is the second part of fixes for serial port corruption observed after DT 5.6 import. Reviewed by: manu MFC after:1 week Modified: head/sys/arm64/rockchip/rk_iodomain.c Modified: head/sys/arm64/rockchip/rk_iodomain.c == --- head/sys/arm64/rockchip/rk_iodomain.c Wed Apr 29 13:41:32 2020 (r360460) +++ head/sys/arm64/rockchip/rk_iodomain.c Wed Apr 29 13:43:15 2020 (r360461) @@ -45,17 +45,20 @@ __FBSDID("$FreeBSD$"); #defineRK3288_GRF_IO_VSEL 0x380 #defineRK3399_GRF_IO_VSEL 0xe640 -#defineRK3399_PMUGRF_IO_VSEL 0x180 +#defineRK3399_PMUGRF_SOC_CON0 0x180 struct rk_iodomain_supply { char*name; uint32_tbit; }; +struct rk_iodomain_softc; + struct rk_iodomain_conf { struct rk_iodomain_supply *supply; int nsupply; uint32_tgrf_reg; + void(*init)(struct rk_iodomain_softc *sc); }; struct rk_iodomain_softc { @@ -101,10 +104,12 @@ static struct rk_iodomain_supply rk3399_pmu_supply[] = {"pmu1830-supply", 9}, }; +static void rk3399_pmu_init(struct rk_iodomain_softc *sc); static struct rk_iodomain_conf rk3399_pmu_conf = { .supply = rk3399_pmu_supply, .nsupply = nitems(rk3399_pmu_supply), - .grf_reg = RK3399_PMUGRF_IO_VSEL, + .grf_reg = RK3399_PMUGRF_SOC_CON0, + .init = rk3399_pmu_init, }; static struct ofw_compat_data compat_data[] = { @@ -115,6 +120,14 @@ static struct ofw_compat_data compat_data[] = { }; static void +rk3399_pmu_init(struct rk_iodomain_softc *sc) +{ + + SYSCON_WRITE_4(sc->grf, RK3399_PMUGRF_SOC_CON0, + (1 << 8) | (1 << (8 + 16)));/* set pmu1830_volsel */ +} + +static void rk_iodomain_set(struct rk_iodomain_softc *sc) { regulator_t supply; @@ -141,6 +154,8 @@ rk_iodomain_set(struct rk_iodomain_softc *sc) } SYSCON_WRITE_4(sc->grf, sc->conf->grf_reg, reg | mask); + if (sc->conf->init != NULL) +sc->conf->init(sc); } static int @@ -204,4 +219,4 @@ static driver_t rk_iodomain_driver = { static devclass_t rk_iodomain_devclass; EARLY_DRIVER_MODULE(rk_iodomain, simplebus, rk_iodomain_driver, - rk_iodomain_devclass, 0, 0, BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_MIDDLE); + rk_iodomain_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r360293 - head/sys/arm64/rockchip
Author: mmel Date: Sat Apr 25 09:17:49 2020 New Revision: 360293 URL: https://svnweb.freebsd.org/changeset/base/360293 Log: Reorder initialization steps for given pin. If pin is switched from fixed function to GPIO, it should have prepared direction, pull-up/down and default value before function gets switched. Otherwise we may produce unwanted glitch on output pin. Right order of drive strength settings is questionable, but I think that is slightly safer to do it also before function switch. This fixes serial port corruption observed after DT 5.6 import. MFC after:1 week Modified: head/sys/arm64/rockchip/rk_pinctrl.c Modified: head/sys/arm64/rockchip/rk_pinctrl.c == --- head/sys/arm64/rockchip/rk_pinctrl.cSat Apr 25 09:06:11 2020 (r360292) +++ head/sys/arm64/rockchip/rk_pinctrl.cSat Apr 25 09:17:49 2020 (r360293) @@ -932,7 +932,28 @@ rk_pinctrl_configure_pin(struct rk_pinctrl_softc *sc, /* Find syscon */ syscon = sc->conf->get_syscon(sc, bank); - /* Parse pin function */ + /* Setup GPIO properties first */ + rv = rk_pinctrl_handle_io(sc, pin_conf, bank, pin); + + /* Then pin pull-up/down */ + bias = sc->conf->parse_bias(pin_conf, bank); + if (bias >= 0) { + reg = sc->conf->get_pd_offset(sc, bank); + reg += bank * 0x10 + ((pin / 8) * 0x4); + bit = (pin % 8) * 2; + mask = (0x3 << bit); + SYSCON_MODIFY_4(syscon, reg, mask, bias << bit | (mask << 16)); + } + + /* Then drive strength */ + rv = rk_pinctrl_parse_drive(sc, pin_conf, bank, subbank, , ); + if (rv == 0) { + bit = (pin % 8) * 2; + mask = (0x3 << bit); + SYSCON_MODIFY_4(syscon, reg, mask, drive << bit | (mask << 16)); + } + + /* Finally set the pin function */ reg = sc->conf->iomux_conf[i].offset; switch (sc->conf->iomux_conf[i].nbits) { case 4: @@ -966,28 +987,6 @@ rk_pinctrl_configure_pin(struct rk_pinctrl_softc *sc, * without hi-word write mask. */ SYSCON_MODIFY_4(syscon, reg, mask, function << bit | (mask << 16)); - - /* Pull-Up/Down */ - bias = sc->conf->parse_bias(pin_conf, bank); - if (bias >= 0) { - reg = sc->conf->get_pd_offset(sc, bank); - - reg += bank * 0x10 + ((pin / 8) * 0x4); - bit = (pin % 8) * 2; - mask = (0x3 << bit); - SYSCON_MODIFY_4(syscon, reg, mask, bias << bit | (mask << 16)); - } - - /* Drive Strength */ - rv = rk_pinctrl_parse_drive(sc, pin_conf, bank, subbank, , ); - if (rv == 0) { - bit = (pin % 8) * 2; - mask = (0x3 << bit); - SYSCON_MODIFY_4(syscon, reg, mask, drive << bit | (mask << 16)); - } - - /* Input/Outpot + default level */ - rv = rk_pinctrl_handle_io(sc, pin_conf, bank, pin); } static int ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358807 - head/sys/arm64/rockchip
Author: mmel Date: Mon Mar 9 13:36:45 2020 New Revision: 358807 URL: https://svnweb.freebsd.org/changeset/base/358807 Log: Add the missing brackets to the logical expression. Reported by: clang10 via dim MFC with: r355755 Modified: head/sys/arm64/rockchip/rk_pcie.c Modified: head/sys/arm64/rockchip/rk_pcie.c == --- head/sys/arm64/rockchip/rk_pcie.c Mon Mar 9 13:35:07 2020 (r358806) +++ head/sys/arm64/rockchip/rk_pcie.c Mon Mar 9 13:36:45 2020 (r358807) @@ -895,7 +895,7 @@ rk_pcie_enable_resources(struct rk_pcie_softc *sc) /* Set basic PCIe core mode (RC, lanes, gen1 or 2) */ val = STRAP_CONF_GEN_2 << 16 | - sc->link_is_gen2 ? STRAP_CONF_GEN_2: 0; + (sc->link_is_gen2 ? STRAP_CONF_GEN_2: 0); val |= STRAP_CONF_MODE_RC << 16 | STRAP_CONF_MODE_RC; val |= STRAP_CONF_LANES(~0) << 16 | STRAP_CONF_LANES(sc->num_lanes); val |= STRAP_CONF_ARI_EN << 16 | STRAP_CONF_ARI_EN; @@ -1408,4 +1408,4 @@ DEFINE_CLASS_1(pcib, rk_pcie_driver, rk_pcie_methods, sizeof(struct rk_pcie_softc), ofw_pci_driver); static devclass_t rk_pcie_devclass; DRIVER_MODULE( rk_pcie, simplebus, rk_pcie_driver, rk_pcie_devclass, -NULL, NULL); \ No newline at end of file +NULL, NULL); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r356483 - head/share/mk
Author: mmel Date: Wed Jan 8 07:25:37 2020 New Revision: 356483 URL: https://svnweb.freebsd.org/changeset/base/356483 Log: Switch 32-bit arm back to LLVM libunwind. Actual LLVM libunwind passed all testing without issues, switch back to it. PR: 233664 Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk == --- head/share/mk/src.opts.mk Tue Jan 7 23:29:54 2020(r356482) +++ head/share/mk/src.opts.mk Wed Jan 8 07:25:37 2020(r356483) @@ -317,7 +317,7 @@ BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BO .if ${__T:Mriscv*} != "" BROKEN_OPTIONS+=OFED .endif -.if ${__T} != "armv6" && ${__T} != "armv7" && ${__T} != "sparc64" +.if ${__T} != "sparc64" __DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND .else __DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355803 - in head: contrib/libunwind/src lib/libgcc_s lib/libgcc_s/arm
Author: mmel Date: Mon Dec 16 14:08:49 2019 New Revision: 355803 URL: https://svnweb.freebsd.org/changeset/base/355803 Log: Fix LLVM libunwnwind _Unwind_Backtrace symbol version for ARM. In original GNU libgcc, _Unwind_Backtrace is published with GCC_3.3 version for all architectures but ARM. For ARM should be publishes with GCC_4.3.0 version. This was originally omitted in r255095, fixed in r318024 and omitted aging in LLVM libunwind implementation in r354347. For ARM _Unwind_Backtrace should be published as default with GCC_4.3.0 version , (because this is right original version) and again as normal(not-default) with GCC_3.3 version (to maintain ABI compatibility compiled/linked with wrong pre r318024 libgcc) PR: 233664 Added: head/lib/libgcc_s/SymbolDefault.map (contents, props changed) Modified: head/contrib/libunwind/src/UnwindLevel1-gcc-ext.c head/lib/libgcc_s/Makefile head/lib/libgcc_s/Symbol.map head/lib/libgcc_s/arm/Symbol.map Modified: head/contrib/libunwind/src/UnwindLevel1-gcc-ext.c == --- head/contrib/libunwind/src/UnwindLevel1-gcc-ext.c Mon Dec 16 13:32:06 2019(r355802) +++ head/contrib/libunwind/src/UnwindLevel1-gcc-ext.c Mon Dec 16 14:08:49 2019(r355803) @@ -182,8 +182,8 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callback, void *ref } } #ifdef __arm__ -/* Preserve legacy libgcc ARM ABI mistake. */ -__sym_compat(_Unwind_Backtrace, _Unwind_Backtrace, GCC_4.3.0); +/* Preserve legacy libgcc (pre r318024) ARM ABI mistake */ +__sym_compat(_Unwind_Backtrace, _Unwind_Backtrace, GCC_3.3); #endif Modified: head/lib/libgcc_s/Makefile == --- head/lib/libgcc_s/Makefile Mon Dec 16 13:32:06 2019(r355802) +++ head/lib/libgcc_s/Makefile Mon Dec 16 14:08:49 2019(r355803) @@ -18,6 +18,8 @@ SYMBOL_MAPS= ${.CURDIR}/Symbol.map # Export ARM AEABI unwind routines needed by libc and libthr. .if exists(${.CURDIR}/${MACHINE_CPUARCH}/Symbol.map) SYMBOL_MAPS+= ${.CURDIR}/${MACHINE_CPUARCH}/Symbol.map +.else +SYMBOL_MAPS+= ${.CURDIR}/SymbolDefault.map .endif .endif Modified: head/lib/libgcc_s/Symbol.map == --- head/lib/libgcc_s/Symbol.mapMon Dec 16 13:32:06 2019 (r355802) +++ head/lib/libgcc_s/Symbol.mapMon Dec 16 14:08:49 2019 (r355803) @@ -86,7 +86,6 @@ GCC_3.0 { }; GCC_3.3 { - _Unwind_Backtrace; _Unwind_FindEnclosingFunction; _Unwind_GetCFA; _Unwind_Resume_or_Rethrow; Added: head/lib/libgcc_s/SymbolDefault.map == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libgcc_s/SymbolDefault.map Mon Dec 16 14:08:49 2019 (r355803) @@ -0,0 +1,7 @@ +/* + * $FreeBSD$ + */ +/* _Unwind_Backtrace should be exported with different version on ARM */ +GCC_3.3 { + _Unwind_Backtrace; +}; Modified: head/lib/libgcc_s/arm/Symbol.map == --- head/lib/libgcc_s/arm/Symbol.mapMon Dec 16 13:32:06 2019 (r355802) +++ head/lib/libgcc_s/arm/Symbol.mapMon Dec 16 14:08:49 2019 (r355803) @@ -10,3 +10,7 @@ GCC_3.5 { __aeabi_unwind_cpp_pr2; __gnu_unwind_frame; }; + +GCC_4.3.0 { + _Unwind_Backtrace; +}; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355774 - head/sys/dev/nvme
Author: mmel Date: Sun Dec 15 14:28:38 2019 New Revision: 355774 URL: https://svnweb.freebsd.org/changeset/base/355774 Log: Properly synchronize completion DMA buffers. Within command completion processing the callback function may access DMAed data buffer. Synchronize it before use, not after. This allows to use NVMe disk on non-DMA coherent arm64 system. MFC after:3 weeks Modified: head/sys/dev/nvme/nvme_qpair.c Modified: head/sys/dev/nvme/nvme_qpair.c == --- head/sys/dev/nvme/nvme_qpair.c Sun Dec 15 14:09:49 2019 (r355773) +++ head/sys/dev/nvme/nvme_qpair.c Sun Dec 15 14:28:38 2019 (r355774) @@ -444,8 +444,15 @@ nvme_qpair_complete_tracker(struct nvme_tracker *tr, KASSERT(cpl->cid == req->cmd.cid, ("cpl cid does not match cmd cid\n")); - if (req->cb_fn && !retry) - req->cb_fn(req->cb_arg, cpl); + if (!retry) { + if (req->type != NVME_REQUEST_NULL) { + bus_dmamap_sync(qpair->dma_tag_payload, + tr->payload_dma_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + } + if (req->cb_fn) + req->cb_fn(req->cb_arg, cpl); + } mtx_lock(>lock); callout_stop(>timer); @@ -455,9 +462,6 @@ nvme_qpair_complete_tracker(struct nvme_tracker *tr, nvme_qpair_submit_tracker(qpair, tr); } else { if (req->type != NVME_REQUEST_NULL) { - bus_dmamap_sync(qpair->dma_tag_payload, - tr->payload_dma_map, - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(qpair->dma_tag_payload, tr->payload_dma_map); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355755 - in head/sys: arm64/rockchip conf
Author: mmel Date: Sat Dec 14 14:56:34 2019 New Revision: 355755 URL: https://svnweb.freebsd.org/changeset/base/355755 Log: Add driver for Rockchip PCIe root complex found in RK3399 SOC. Unfortunately, there are some limitations: - memory aperture of his controller is only 16MiB, so it is nearly unusable for graphic cards - every attempt to generate type 1 config cycle always causes trap. These config cycles are disabled now and we don't support cards with PCIe switch. - in some cases, attempt to do config cycle to (probably) not-yet ready card also causes trap. This cannot be detected at runtime, but it seems like very rare issue. MFC after:3 weeks Differential Revision: https://reviews.freebsd.org/D22724 Added: head/sys/arm64/rockchip/rk_pcie.c (contents, props changed) head/sys/arm64/rockchip/rk_pcie_phy.c (contents, props changed) Modified: head/sys/conf/files.arm64 Added: head/sys/arm64/rockchip/rk_pcie.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/rockchip/rk_pcie.c Sat Dec 14 14:56:34 2019 (r355755) @@ -0,0 +1,1411 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Michal Meloun + * + * 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. + * + */ + +/* Rockchip PCIe controller driver */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "pcib_if.h" + +#define ATU_CFG_BUS(x) (((x) & 0x0ff) << 20) +#define ATU_CFG_SLOT(x)(((x) & 0x01f) << 15) +#define ATU_CFG_FUNC(x)(((x) & 0x007) << 12) +#define ATU_CFG_REG(x) (((x) & 0xfff) << 0) + +#define ATU_TYPE_MEM 0x2 +#define ATU_TYPE_IO0x6 +#define ATU_TYPE_CFG0 0xA +#define ATU_TYPE_CFG1 0xB +#define ATY_TYPE_NOR_MSG 0xC + +#define ATU_OB_REGIONS 33 +#defineATU_OB_REGION_SHIFT 20 +#define ATU_OB_REGION_SIZE (1 << ATU_OB_REGION_SHIFT) +#define ATU_OB_REGION_0_SIZE (( ATU_OB_REGIONS - 1) * ATU_OB_REGION_SIZE) + +#define ATU_IB_REGIONS 3 + +#definePCIE_CLIENT_BASIC_STRAP_CONF0x00 +#define STRAP_CONF_GEN_2 (1 << 7) +#define STRAP_CONF_MODE_RC (1 << 6) +#define STRAP_CONF_LANES(n)n) / 2) & 0x3) << 4) +#define STRAP_CONF_ARI_EN (1 << 3) +#define STRAP_CONF_SR_IOV_EN (1 << 2) +#define STRAP_CONF_LINK_TRAIN_EN (1 << 1) +#define STRAP_CONF_CONF_EN (1 << 0) +#definePCIE_CLIENT_HOT_RESET_CTRL 0x18 +#define HOT_RESET_CTRL_LINK_DOWN_RESET (1 << 1) +#define HOT_RESET_CTRL_HOT_RESET_IN(1 << 0) +#definePCIE_CLIENT_BASIC_STATUS0 0x44 +#definePCIE_CLIENT_BASIC_STATUS1 0x48 +#define STATUS1_LINK_ST_GET(x) (((x) >> 20) & 0x3) +#define STATUS1_LINK_ST_UP3 +#definePCIE_CLIENT_INT_MASK