svn commit: r295869 - in head/sys/boot/efi: include libefi

2016-02-21 Thread Andrew Turner
Author: andrew
Date: Sun Feb 21 21:20:23 2016
New Revision: 295869
URL: https://svnweb.freebsd.org/changeset/base/295869

Log:
  Make efi_time and EFI_GetTimeOfDay static, neither are used by other parts
  of the efi code.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/boot/efi/include/efilib.h
  head/sys/boot/efi/libefi/time.c

Modified: head/sys/boot/efi/include/efilib.h
==
--- head/sys/boot/efi/include/efilib.h  Sun Feb 21 20:58:24 2016
(r295868)
+++ head/sys/boot/efi/include/efilib.h  Sun Feb 21 21:20:23 2016
(r295869)
@@ -46,7 +46,6 @@ int efi_handle_lookup(EFI_HANDLE, struct
 int efi_handle_update_dev(EFI_HANDLE, struct devsw *, int, uint64_t);
 
 int efi_status_to_errno(EFI_STATUS);
-time_t efi_time(EFI_TIME *);
 
 EFI_STATUS main(int argc, CHAR16 *argv[]);
 void exit(EFI_STATUS status);

Modified: head/sys/boot/efi/libefi/time.c
==
--- head/sys/boot/efi/libefi/time.c Sun Feb 21 20:58:24 2016
(r295868)
+++ head/sys/boot/efi/libefi/time.c Sun Feb 21 21:20:23 2016
(r295869)
@@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$");
 #define SECSPERHOUR ( 60*60 )
 #define SECSPERDAY (24 * SECSPERHOUR)
 
-time_t
+static time_t
 efi_time(EFI_TIME *ETime)
 {
 /*
@@ -164,7 +164,7 @@ efi_time(EFI_TIME *ETime)
 return UTime;
 }
 
-int
+static int
 EFI_GetTimeOfDay(
OUT struct timeval *tp,
OUT struct timezone *tzp
___
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: r295768 - head/usr.sbin/iostat

2016-02-21 Thread Andrew Turner
On Thu, 18 Feb 2016 20:08:01 + (UTC)
Alan Somers  wrote:

> Author: asomers
> Date: Thu Feb 18 20:08:01 2016
> New Revision: 295768
> URL: https://svnweb.freebsd.org/changeset/base/295768
> 
> Log:
>   Fix compiler warnings in iostat
>   
>   Raise WARNS from 1 to 6 (the default)

This breaks building with gcc:

===> usr.sbin/ifmcstat (all)
===> usr.sbin/iostat (all)
cc1: warnings being treated as errors
/scratch/tmp/andrew/head-git/usr.sbin/iostat/iostat.c: In function 'devstats':
/scratch/tmp/andrew/head-git/usr.sbin/iostat/iostat.c:800: warning: declaration 
of 'devname' shadows a global declaration
/scratch/tmp/andrew/obj/powerpc.powerpc/scratch/tmp/andrew/head-git/tmp/usr/include/stdlib.h:282:
 warning: shadowed declaration is here
/scratch/tmp/andrew/head-git/usr.sbin/iostat/iostat.c: In function 'cpustats':
/scratch/tmp/andrew/head-git/usr.sbin/iostat/iostat.c:982: warning: declaration 
of 'time' shadows a global declaration
/scratch/tmp/andrew/obj/powerpc.powerpc/scratch/tmp/andrew/head-git/tmp/usr/include/time.h:154:
 warning: shadowed declaration is here
*** Error code 1

Stop.
make[4]: stopped in /scratch/tmp/andrew/head-git/usr.sbin/iostat
*** Error code 1

Stop.
make[3]: stopped in /scratch/tmp/andrew/head-git/usr.sbin
*** Error code 1

Stop.
make[2]: stopped in /scratch/tmp/andrew/head-git
*** Error code 1

Stop.
make[1]: stopped in /scratch/tmp/andrew/head-git
*** Error code 1

Stop.
make: stopped in /scratch/tmp/andrew/head-git

-Wshadow is added to the warning flags with WARNS >= 4.

Andrew
___
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: r295612 - head/sys/arm/mv

2016-02-14 Thread Andrew Turner
Author: andrew
Date: Sun Feb 14 16:38:32 2016
New Revision: 295612
URL: https://svnweb.freebsd.org/changeset/base/295612

Log:
  Remove an unused include.

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

Modified: head/sys/arm/mv/twsi.c
==
--- head/sys/arm/mv/twsi.c  Sun Feb 14 16:18:39 2016(r295611)
+++ head/sys/arm/mv/twsi.c  Sun Feb 14 16:38:32 2016(r295612)
@@ -62,7 +62,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
 #include 
 
 #include "iicbus_if.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: r295527 - head/sys/mips/mips

2016-02-11 Thread Andrew Turner
Author: andrew
Date: Thu Feb 11 16:43:23 2016
New Revision: 295527
URL: https://svnweb.freebsd.org/changeset/base/295527

Log:
  Include the correct header to get a phandle_t needed by ofw_bus_if.h. While
  here only include opt_platform.h once.
  
  Sponsored by: ABT Systems Ltd

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

Modified: head/sys/mips/mips/nexus.c
==
--- head/sys/mips/mips/nexus.c  Thu Feb 11 16:39:30 2016(r295526)
+++ head/sys/mips/mips/nexus.c  Thu Feb 11 16:43:23 2016(r295527)
@@ -64,10 +64,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
-#include "opt_platform.h"
-
 #ifdef FDT
-#include 
+#include 
 #include "ofw_bus_if.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: r295540 - head/sys/arm/conf

2016-02-11 Thread Andrew Turner
Author: andrew
Date: Thu Feb 11 18:01:10 2016
New Revision: 295540
URL: https://svnweb.freebsd.org/changeset/base/295540

Log:
  Enable ARM_INTRNG on all kernel configs where we use the Generic Interrupt
  Controller.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/conf/ALPINE
  head/sys/arm/conf/ARMADA38X
  head/sys/arm/conf/EXYNOS5.common
  head/sys/arm/conf/ODROIDC1
  head/sys/arm/conf/PANDABOARD
  head/sys/arm/conf/RK3188
  head/sys/arm/conf/SOCKIT.common
  head/sys/arm/conf/VIRT
  head/sys/arm/conf/VSATV102
  head/sys/arm/conf/VYBRID
  head/sys/arm/conf/ZEDBOARD

Modified: head/sys/arm/conf/ALPINE
==
--- head/sys/arm/conf/ALPINEThu Feb 11 17:57:42 2016(r295539)
+++ head/sys/arm/conf/ALPINEThu Feb 11 18:01:10 2016(r295540)
@@ -37,6 +37,7 @@ options   DDB #Enable the kernel 
debugg
 
 # Interrupt controller
 device gic
+optionsARM_INTRNG
 
 # Pseudo devices
 device loop

Modified: head/sys/arm/conf/ARMADA38X
==
--- head/sys/arm/conf/ARMADA38X Thu Feb 11 17:57:42 2016(r295539)
+++ head/sys/arm/conf/ARMADA38X Thu Feb 11 18:01:10 2016(r295540)
@@ -62,6 +62,7 @@ devicepci
 
 # Interrupt controllers
 device gic
+optionsARM_INTRNG
 
 # Timers
 device mpcore_timer

Modified: head/sys/arm/conf/EXYNOS5.common
==
--- head/sys/arm/conf/EXYNOS5.commonThu Feb 11 17:57:42 2016
(r295539)
+++ head/sys/arm/conf/EXYNOS5.commonThu Feb 11 18:01:10 2016
(r295540)
@@ -87,6 +87,8 @@ devicedwmmc
 
 # Interrupt controller
 device gic
+optionsARM_INTRNG
+
 # ARM Generic Timer
 device generic_timer
 

Modified: head/sys/arm/conf/ODROIDC1
==
--- head/sys/arm/conf/ODROIDC1  Thu Feb 11 17:57:42 2016(r295539)
+++ head/sys/arm/conf/ODROIDC1  Thu Feb 11 18:01:10 2016(r295540)
@@ -26,6 +26,7 @@ options   SMP # Enable multiple cores
 
 # Interrupt controller
 device gic
+optionsARM_INTRNG
 
 optionsFDT_DTB_STATIC
 makeoptionsFDT_DTS_FILE=odroidc1.dts

Modified: head/sys/arm/conf/PANDABOARD
==
--- head/sys/arm/conf/PANDABOARDThu Feb 11 17:57:42 2016
(r295539)
+++ head/sys/arm/conf/PANDABOARDThu Feb 11 18:01:10 2016
(r295540)
@@ -30,8 +30,6 @@ hints "PANDABOARD.hints"
 include"std.armv6"
 include"../ti/omap4/pandaboard/std.pandaboard"
 
-optionsARM_INTRNG  # new interrupt framework
-
 optionsHZ=100
 optionsSCHED_ULE   # ULE scheduler
 optionsPLATFORM
@@ -62,6 +60,8 @@ options   DDB # Enable the kernel 
debug
 device fdt_pinctrl
 # Interrupt controller
 device gic
+optionsARM_INTRNG
+
 # ARM MPCore timer
 device mpcore_timer
 

Modified: head/sys/arm/conf/RK3188
==
--- head/sys/arm/conf/RK3188Thu Feb 11 17:57:42 2016(r295539)
+++ head/sys/arm/conf/RK3188Thu Feb 11 18:01:10 2016(r295540)
@@ -47,6 +47,8 @@ options   ROOTDEVNAME=\"ufs:/dev/mmcsd0\"
 
 # Interrupt controller
 device gic
+optionsARM_INTRNG
+
 # ARM MPCore timer
 device mpcore_timer
 

Modified: head/sys/arm/conf/SOCKIT.common
==
--- head/sys/arm/conf/SOCKIT.common Thu Feb 11 17:57:42 2016
(r295539)
+++ head/sys/arm/conf/SOCKIT.common Thu Feb 11 18:01:10 2016
(r295540)
@@ -53,6 +53,8 @@ options   INVARIANT_SUPPORT   # Extra sanit
 
 # Interrupt controller
 device gic
+optionsARM_INTRNG
+
 # ARM MPCore timer
 device mpcore_timer
 

Modified: head/sys/arm/conf/VIRT
==
--- head/sys/arm/conf/VIRT  Thu Feb 11 17:57:42 2016(r295539)
+++ head/sys/arm/conf/VIRT  Thu Feb 11 18:01:10 2016(r295540)
@@ -46,6 +46,8 @@ options   INVARIANT_SUPPORT   # Extra sanit
 
 # Interrupt controller
 device gic
+optionsARM_INTRNG
+
 # ARM Generic Timer
 device generic_timer
 

Modified: head/sys/arm/conf/VSATV102
==
--- head/sys/arm/conf/VSATV102  Thu Feb 11 17:57:42 2016(r295539)
+++ head/sys/arm/conf/VSATV102  Thu Feb 11 18:01:10 2016(r295540)
@@ -26,6 +26,7 @@ options   SMP # Enable 

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

2016-03-01 Thread Andrew Turner
Author: andrew
Date: Tue Mar  1 09:51:36 2016
New Revision: 296258
URL: https://svnweb.freebsd.org/changeset/base/296258

Log:
  Stop setting the memory size in the arm EFI and FDT code, we don't use it.
  
  Sponsored by: ABT Systems Ltd

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

Modified: head/sys/arm/arm/machdep.c
==
--- head/sys/arm/arm/machdep.c  Tue Mar  1 09:45:27 2016(r296257)
+++ head/sys/arm/arm/machdep.c  Tue Mar  1 09:51:36 2016(r296258)
@@ -1305,7 +1305,7 @@ set_stackptrs(int cpu)
 
 static void
 add_efi_map_entries(struct efi_map_header *efihdr, struct mem_region *mr,
-int *mrcnt, uint32_t *memsize)
+int *mrcnt)
 {
struct efi_md *map, *p;
const char *type;
@@ -1330,7 +1330,6 @@ add_efi_map_entries(struct efi_map_heade
};
 
*mrcnt = 0;
-   *memsize = 0;
 
/*
 * Memory map data provided by UEFI via the GetMemoryMap
@@ -1402,7 +1401,6 @@ add_efi_map_entries(struct efi_map_heade
}
 
*mrcnt = j;
-   *memsize = memory_size;
 }
 #endif /* EFI */
 
@@ -1715,7 +1713,6 @@ initarm(struct arm_boot_params *abp)
struct mem_region mem_regions[FDT_MEM_REGIONS];
vm_paddr_t lastaddr;
vm_offset_t dtbp, kernelstack, dpcpu;
-   u_long memsize;
char *env;
void *kmdp;
int err_devmap, mem_regions_sz;
@@ -1727,7 +1724,6 @@ initarm(struct arm_boot_params *abp)
arm_physmem_kernaddr = abp->abp_physaddr;
lastaddr = parse_boot_param(abp) - KERNVIRTADDR + arm_physmem_kernaddr;
 
-   memsize = 0;
set_cpufuncs();
cpuinfo_init();
 
@@ -1755,14 +1751,12 @@ initarm(struct arm_boot_params *abp)
efihdr = (struct efi_map_header *)preload_search_info(kmdp,
MODINFO_METADATA | MODINFOMD_EFI_MAP);
if (efihdr != NULL) {
-   add_efi_map_entries(efihdr, mem_regions, _regions_sz,
-  );
+   add_efi_map_entries(efihdr, mem_regions, _regions_sz);
} else
 #endif
{
/* Grab physical memory regions information from device tree. */
-   if (fdt_get_mem_regions(mem_regions, _regions_sz,
-   ) != 0)
+   if (fdt_get_mem_regions(mem_regions, _regions_sz,NULL) != 0)
panic("Cannot get physical memory regions");
}
arm_physmem_hardware_regions(mem_regions, mem_regions_sz);
___
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: r296257 - in head/sys: arm/mv dev/cesa dev/fdt riscv/riscv

2016-03-01 Thread Andrew Turner
Author: andrew
Date: Tue Mar  1 09:45:27 2016
New Revision: 296257
URL: https://svnweb.freebsd.org/changeset/base/296257

Log:
  Make the fdt_get_mem_regions memsize argument optional. It's only used in
  by a few callers.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/mv/mv_common.c
  head/sys/dev/cesa/cesa.c
  head/sys/dev/fdt/fdt_common.c
  head/sys/riscv/riscv/machdep.c

Modified: head/sys/arm/mv/mv_common.c
==
--- head/sys/arm/mv/mv_common.c Tue Mar  1 08:15:00 2016(r296256)
+++ head/sys/arm/mv/mv_common.c Tue Mar  1 09:45:27 2016(r296257)
@@ -918,11 +918,10 @@ decode_win_sdram_fixup(void)
struct mem_region mr[FDT_MEM_REGIONS];
uint8_t window_valid[MV_WIN_DDR_MAX];
int mr_cnt, err, i, j;
-   u_long memsize;
uint32_t valid_win_num = 0;
 
/* Grab physical memory regions information from device tree. */
-   err = fdt_get_mem_regions(mr, _cnt, );
+   err = fdt_get_mem_regions(mr, _cnt, NULL);
if (err != 0)
return (err);
 

Modified: head/sys/dev/cesa/cesa.c
==
--- head/sys/dev/cesa/cesa.cTue Mar  1 08:15:00 2016(r296256)
+++ head/sys/dev/cesa/cesa.cTue Mar  1 09:45:27 2016(r296257)
@@ -1642,11 +1642,10 @@ decode_win_cesa_setup(struct cesa_softc 
struct mem_region availmem_regions[FDT_MEM_REGIONS];
int availmem_regions_sz;
uint32_t br, cr, i;
-   u_long memsize;
 
/* Grab physical memory regions information from DTS */
if (fdt_get_mem_regions(availmem_regions, _regions_sz,
-   ) != 0)
+   NULL) != 0)
return (ENXIO);
 
if (availmem_regions_sz > MV_WIN_CESA_MAX) {

Modified: head/sys/dev/fdt/fdt_common.c
==
--- head/sys/dev/fdt/fdt_common.c   Tue Mar  1 08:15:00 2016
(r296256)
+++ head/sys/dev/fdt/fdt_common.c   Tue Mar  1 09:45:27 2016
(r296257)
@@ -705,7 +705,8 @@ fdt_get_mem_regions(struct mem_region *m
}
 
*mrcnt = i;
-   *memsize = memory_size;
+   if (memsize != NULL)
+   *memsize = memory_size;
rv = 0;
 out:
return (rv);

Modified: head/sys/riscv/riscv/machdep.c
==
--- head/sys/riscv/riscv/machdep.c  Tue Mar  1 08:15:00 2016
(r296256)
+++ head/sys/riscv/riscv/machdep.c  Tue Mar  1 09:45:27 2016
(r296257)
@@ -739,7 +739,6 @@ initriscv(struct riscv_bootparams *rvbp)
vm_offset_t lastaddr;
int mem_regions_sz;
vm_size_t kernlen;
-   u_long memsize;
caddr_t kmdp;
int i;
 
@@ -763,7 +762,7 @@ initriscv(struct riscv_bootparams *rvbp)
physmap_idx = 0;
 
/* Grab physical memory regions information from device tree. */
-   if (fdt_get_mem_regions(mem_regions, _regions_sz, ) != 0)
+   if (fdt_get_mem_regions(mem_regions, _regions_sz, NULL) != 0)
panic("Cannot get physical memory regions");
for (i = 0; i < mem_regions_sz; i++)
add_physmap_entry(mem_regions[i].mr_start,
___
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: r296938 - head/sys/arm/conf

2016-03-18 Thread Andrew Turner
Author: andrew
Date: Wed Mar 16 15:31:09 2016
New Revision: 296938
URL: https://svnweb.freebsd.org/changeset/base/296938

Log:
  Remove old COMPAT_FREEBSD options from the ARM kernel configs. We replaced
  the ABI in 10.0, and have removed support for the old ABI in 11. As such
  any of these options to provide compatibility prior to 10 are unneeded.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/conf/ATMEL
  head/sys/arm/conf/CNS11XXNAS
  head/sys/arm/conf/EFIKA_MX
  head/sys/arm/conf/ETHERNUT5
  head/sys/arm/conf/IMX53
  head/sys/arm/conf/NOTES
  head/sys/arm/conf/SAM9260EK
  head/sys/arm/conf/std.arm
  head/sys/arm/conf/std.armv6

Modified: head/sys/arm/conf/ATMEL
==
--- head/sys/arm/conf/ATMEL Wed Mar 16 14:00:45 2016(r296937)
+++ head/sys/arm/conf/ATMEL Wed Mar 16 15:31:09 2016(r296938)
@@ -57,11 +57,6 @@ options  GEOM_PART_BSD   # BSD partition 
 optionsGEOM_PART_MBR   # MBR partition scheme
 optionsGEOM_PART_GPT   # GUID Partition Tables.
 optionsGEOM_LABEL  # Provides labelization
-optionsCOMPAT_FREEBSD5 # Compatible with FreeBSD5
-optionsCOMPAT_FREEBSD6 # Compatible with FreeBSD6
-optionsCOMPAT_FREEBSD7 # Compatible with FreeBSD7
-optionsCOMPAT_FREEBSD9 # Compatible with FreeBSD9
-optionsCOMPAT_FREEBSD10# Compatible with FreeBSD10
 optionsSCSI_DELAY=5000 # Delay (in ms) before probing SCSI
 optionsKTRACE  # ktrace(1) support
 optionsSTACK   # stack(9) support

Modified: head/sys/arm/conf/CNS11XXNAS
==
--- head/sys/arm/conf/CNS11XXNASWed Mar 16 14:00:45 2016
(r296937)
+++ head/sys/arm/conf/CNS11XXNASWed Mar 16 15:31:09 2016
(r296938)
@@ -46,11 +46,6 @@ options  DDB # Enable the kernel 
debug
 #options   DIAGNOSTIC
 
 
-#options   COMPAT_FREEBSD5
-#options   COMPAT_FREEBSD6
-#options   COMPAT_FREEBSD7n
-
-
 optionsSCHED_ULE   # ULE scheduler
 #options   SCHED_4BSD  # 4BSD scheduler
 optionsGEOM_PART_BSD   # BSD partition scheme

Modified: head/sys/arm/conf/EFIKA_MX
==
--- head/sys/arm/conf/EFIKA_MX  Wed Mar 16 14:00:45 2016(r296937)
+++ head/sys/arm/conf/EFIKA_MX  Wed Mar 16 15:31:09 2016(r296938)
@@ -30,9 +30,6 @@ options   SOC_IMX51
 optionsSCHED_4BSD  # 4BSD scheduler
 #options   MD_ROOT # MD is a potential root device
 #options   NFSD# Network Filesystem Server
-#options   COMPAT_FREEBSD5 # Compatible with FreeBSD5
-#options   COMPAT_FREEBSD6 # Compatible with FreeBSD6
-#options   COMPAT_FREEBSD7 # Compatible with FreeBSD7
 optionsPLATFORM
 optionsINCLUDE_CONFIG_FILE # Include this file in kernel
 

Modified: head/sys/arm/conf/ETHERNUT5
==
--- head/sys/arm/conf/ETHERNUT5 Wed Mar 16 14:00:45 2016(r296937)
+++ head/sys/arm/conf/ETHERNUT5 Wed Mar 16 15:31:09 2016(r296938)
@@ -53,9 +53,6 @@ options   GEOM_PART_BSD   # BSD partition 
 optionsGEOM_PART_MBR   # MBR partition scheme
 #options   GEOM_PART_GPT   # GUID Partition Tables.
 #options   GEOM_LABEL  # Provides labelization
-#options   COMPAT_FREEBSD5 # Compatible with FreeBSD5
-#options   COMPAT_FREEBSD6 # Compatible with FreeBSD6
-#options   COMPAT_FREEBSD7 # Compatible with FreeBSD7
 optionsSCSI_DELAY=5000 # Delay (in ms) before probing SCSI
 optionsKTRACE  # ktrace(1) support
 #options   STACK   # stack(9) support

Modified: head/sys/arm/conf/IMX53
==
--- head/sys/arm/conf/IMX53 Wed Mar 16 14:00:45 2016(r296937)
+++ head/sys/arm/conf/IMX53 Wed Mar 16 15:31:09 2016(r296938)
@@ -27,9 +27,6 @@ options   SOC_IMX53
 
 optionsSCHED_4BSD  # 4BSD scheduler
 #options   NFSD# Network Filesystem Server
-#options   COMPAT_FREEBSD5 # Compatible with FreeBSD5
-#options   COMPAT_FREEBSD6 # Compatible with FreeBSD6
-#options   COMPAT_FREEBSD7 # Compatible with FreeBSD7
 optionsPLATFORM
 optionsINCLUDE_CONFIG_FILE # Include this file in kernel
 

Modified: head/sys/arm/conf/NOTES
==
--- head/sys/arm/conf/NOTES Wed 

Re: svn commit: r296861 - in head/sys: arm/arm powerpc/powerpc

2016-03-14 Thread Andrew Turner
On Mon, 14 Mar 2016 14:55:15 + (UTC)
"Bjoern A. Zeeb"  wrote:

> Author: bz
> Date: Mon Mar 14 14:55:15 2016
> New Revision: 296861
> URL: https://svnweb.freebsd.org/changeset/base/296861
> 
> Log:
>   Only check for SYS_freebsd6_lseek if the syscall code is defined.
>   Whether this is the right or best solution is unclear but it fixes
> the build for now.

We should make it an error if someone tries to build an ARM kernel with
COMPAT_FREEBSD6. I think there was some support for ARM in 6, however we
have switched the ABI since then so any old programs will now fail to
run.

Having it would be even more of a bug on armv6. This was added for 10.0
and, given running arm (v4/v5) programs on an armv6 kernel is
unsupported there should be no reason to include it in the kernel.

Andrew
___
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: r296713 - head/sys/boot/efi/boot1

2016-03-11 Thread Andrew Turner
Author: andrew
Date: Sat Mar 12 06:50:16 2016
New Revision: 296713
URL: https://svnweb.freebsd.org/changeset/base/296713

Log:
  Print the correct size of loader.efi when failing to load it into memory.
  
  Obtained from:AsiaBSDCon
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/boot/efi/boot1/boot1.c

Modified: head/sys/boot/efi/boot1/boot1.c
==
--- head/sys/boot/efi/boot1/boot1.c Sat Mar 12 03:53:58 2016
(r296712)
+++ head/sys/boot/efi/boot1/boot1.c Sat Mar 12 06:50:16 2016
(r296713)
@@ -405,7 +405,7 @@ try_boot()
if ((status = bs->LoadImage(TRUE, image, devpath_last(dev->devpath),
loaderbuf, loadersize, )) != EFI_SUCCESS) {
printf("Failed to load image provided by %s, size: %zu, 
(%lu)\n",
-mod->name, bufsize, EFI_ERROR_CODE(status));
+mod->name, loadersize, EFI_ERROR_CODE(status));
goto errout;
}
 
___
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: r297028 - in head/sys/arm64: arm64 include

2016-03-19 Thread Andrew Turner
Author: andrew
Date: Fri Mar 18 16:18:29 2016
New Revision: 297028
URL: https://svnweb.freebsd.org/changeset/base/297028

Log:
  Reduce the diff with intrng by renaming similar functions. This is a noop,
  but will help move to use the common interrupt handling code later.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/exception.S
  head/sys/arm64/arm64/intr_machdep.c
  head/sys/arm64/arm64/nexus.c
  head/sys/arm64/include/intr.h

Modified: head/sys/arm64/arm64/exception.S
==
--- head/sys/arm64/arm64/exception.SFri Mar 18 15:44:21 2016
(r297027)
+++ head/sys/arm64/arm64/exception.SFri Mar 18 16:18:29 2016
(r297028)
@@ -150,7 +150,7 @@ END(handle_el1h_sync)
 ENTRY(handle_el1h_irq)
save_registers 1
mov x0, sp
-   bl  arm_cpu_intr
+   bl  intr_irq_handler
restore_registers 1
eret
 END(handle_el1h_irq)
@@ -171,7 +171,7 @@ END(handle_el0_sync)
 ENTRY(handle_el0_irq)
save_registers 0
mov x0, sp
-   bl  arm_cpu_intr
+   bl  intr_irq_handler
do_ast
restore_registers 0
eret

Modified: head/sys/arm64/arm64/intr_machdep.c
==
--- head/sys/arm64/arm64/intr_machdep.c Fri Mar 18 15:44:21 2016
(r297027)
+++ head/sys/arm64/arm64/intr_machdep.c Fri Mar 18 16:18:29 2016
(r297028)
@@ -408,7 +408,7 @@ arm_setup_intr(const char *name, driver_
 }
 
 int
-arm_teardown_intr(void *cookie)
+intr_irq_remove_handler(device_t dev, u_int irq, void *cookie)
 {
struct arm64_intr_entry *intr;
int error;
@@ -426,7 +426,7 @@ arm_teardown_intr(void *cookie)
 }
 
 int
-arm_config_intr(u_int hw_irq, enum intr_trigger trig, enum intr_polarity pol)
+intr_irq_config(u_int hw_irq, enum intr_trigger trig, enum intr_polarity pol)
 {
struct arm64_intr_entry *intr;
 
@@ -476,7 +476,7 @@ stray:
 }
 
 void
-arm_cpu_intr(struct trapframe *tf)
+intr_irq_handler(struct trapframe *tf)
 {
 
critical_enter();
@@ -512,7 +512,7 @@ SYSINIT(arm_intr_smp_init, SI_SUB_SMP, S
 
 /* Attempt to bind the specified IRQ to the specified CPU. */
 int
-arm_intr_bind(u_int hw_irq, int cpu)
+intr_irq_bind(u_int hw_irq, int cpu)
 {
struct arm64_intr_entry *intr;
 

Modified: head/sys/arm64/arm64/nexus.c
==
--- head/sys/arm64/arm64/nexus.cFri Mar 18 15:44:21 2016
(r297027)
+++ head/sys/arm64/arm64/nexus.cFri Mar 18 16:18:29 2016
(r297028)
@@ -271,7 +271,7 @@ nexus_config_intr(device_t dev, int irq,
 enum intr_polarity pol)
 {
 
-   return (arm_config_intr(irq, trig, pol));
+   return (intr_irq_config(irq, trig, pol));
 }
 
 static int
@@ -298,7 +298,7 @@ static int
 nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih)
 {
 
-   return (arm_teardown_intr(ih));
+   return (intr_irq_remove_handler(child, rman_get_start(r), ih));
 }
 
 #ifdef SMP
@@ -306,7 +306,7 @@ static int
 nexus_bind_intr(device_t dev, device_t child, struct resource *irq, int cpu)
 {
 
-   return (arm_intr_bind(rman_get_start(irq), cpu));
+   return (intr_irq_bind(rman_get_start(irq), cpu));
 }
 #endif
 

Modified: head/sys/arm64/include/intr.h
==
--- head/sys/arm64/include/intr.h   Fri Mar 18 15:44:21 2016
(r297027)
+++ head/sys/arm64/include/intr.h   Fri Mar 18 16:18:29 2016
(r297028)
@@ -29,8 +29,10 @@
 #ifndef _MACHINE_INTR_H_
 #define_MACHINE_INTR_H_
 
-intarm_config_intr(u_int, enum intr_trigger, enum intr_polarity);
-void   arm_cpu_intr(struct trapframe *);
+intintr_irq_config(u_int, enum intr_trigger, enum intr_polarity);
+void   intr_irq_handler(struct trapframe *);
+intintr_irq_remove_handler(device_t, u_int, void *);
+
 void   arm_dispatch_intr(u_int, struct trapframe *);
 intarm_enable_intr(void);
 void   arm_mask_irq(u_int);
@@ -44,12 +46,12 @@ int arm_map_msi(device_t, device_t, int,
 intarm_map_msix(device_t, device_t, int, uint64_t *, uint32_t *);
 intarm_setup_intr(const char *, driver_filter_t *, driver_intr_t,
void *, u_int, enum intr_type, void **);
-intarm_teardown_intr(void *);
 void   arm_unmask_irq(u_int);
 
 #ifdef SMP
+intintr_irq_bind(u_int, int);
+
 void   arm_init_secondary(void);
-intarm_intr_bind(u_int, int);
 void   arm_setup_ipihandler(driver_filter_t *, u_int);
 void   arm_unmask_ipi(u_int);
 #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"


Re: svn commit: r296891 - in head/sys: cam dev/arcmsr dev/iir dev/isci dev/ncr dev/ppbus

2016-03-19 Thread Andrew Turner
On Tue, 15 Mar 2016 05:17:29 + (UTC)
Warner Losh  wrote:
...
> Modified: head/sys/dev/ppbus/vpo.c
> ==
> --- head/sys/dev/ppbus/vpo.c  Tue Mar 15 04:56:39 2016
> (r296890) +++ head/sys/dev/ppbus/vpo.cTue Mar 15 05:17:29
> 2016  (r296891) @@ -187,17 +187,19 @@ vpo_intr(struct vpo_data
...

> @@ -307,11 +309,15 @@ vpo_action(struct cam_sim *sim, union cc
>  
>   csio = >csio;
>  
> + if (ccb->ccb_h.flags & CAM_CDB_PHYS) {
> + ccb->ccb_h.status = CAM_REQ_INVALID;
> + xpt_done(ccb);
> + break;
> + }
>  #ifdef VP0_DEBUG
>   device_printf(vpo->vpo_dev, "XPT_SCSI_IO (0x%x)
> request\n",
> - csio->cdb_io.cdb_bytes[0]);
> + scsiio_cdb_ptr(csio));

This is broken, scsiio_cdb_ptr returns a uint8_t * while %x expects an
int.

Andrew
___
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: r296981 - head/sys/arm/arm

2016-03-19 Thread Andrew Turner
Author: andrew
Date: Thu Mar 17 08:40:58 2016
New Revision: 296981
URL: https://svnweb.freebsd.org/changeset/base/296981

Log:
  Make it an error to build an ARM kernel with COMPAT_FREEBSDn where n < 10.
  We changed the ABI for ARM in 10, an removed support for the old ABI in 11,
  as such binaries from these releases are unable to be run on a head kernel.
  
  Reviewed by:  bz, emast
  Sponsored by: ABT Systems Ltd
  Differential Revision:https://reviews.freebsd.org/D5652

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

Modified: head/sys/arm/arm/machdep.c
==
--- head/sys/arm/arm/machdep.c  Thu Mar 17 06:23:48 2016(r296980)
+++ head/sys/arm/arm/machdep.c  Thu Mar 17 08:40:58 2016(r296981)
@@ -178,6 +178,12 @@ DB_SHOW_COMMAND(vtop, db_show_vtop)
 #definedebugf(fmt, args...)
 #endif
 
+#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \
+defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) || \
+defined(COMPAT_FREEBSD9)
+#error FreeBSD/arm doesn't provide compatibility with releases prior to 10
+#endif
+
 struct pcpu __pcpu[MAXCPU];
 struct pcpu *pcpup = &__pcpu[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: r296825 - in head/sys: arm/conf arm/mv arm/mv/armada38x boot/fdt/dts/arm

2016-03-14 Thread Andrew Turner
On Mon, 14 Mar 2016 07:05:41 + (UTC)
Wojciech Macek  wrote:

> Author: wma
> Date: Mon Mar 14 07:05:41 2016
> New Revision: 296825
> URL: https://svnweb.freebsd.org/changeset/base/296825
> 
> Log:
>   Make MPIC compatible with ARM_INTRNG
>   
>   After ARM_INTRNG introduction, MPIC code needed several
> modifications:
>   - IRQ resource and its handler added
>   -  several DEVMETHODs of INTRNG interface implemented
>   -  defines enhanced to ensure code compiles as well for AXP as for
> A38X
>   - added dummy MSI_IRQ, ERR_IRQ defines for Armada38x
>   - MPIC driver was added to files.armada38x, ARM_INTRNG option
> enabled in kernconf file and regs of MPIC corrected in dts file.
>   
>   Instead of modifying Armada38X DTS, offsets to CPU registers
> defined in driver were changed. That required restoring 'reg'
> property of mpic node in ArmadaXP to state compliant with Linux DTS.
>   
>   Additionally, required ARM_INTRNG definitions were added to
> mv_common.c. 
>   Submitted by:  Bartosz Szczepanek 
>   Obtained from: Semihalf
>   Sponsored by:  Stormshield
>   Reviewed by:   adrian, andrew, ian, skra
>   Approved by:   cognet (mentor)
>   Differential Revision: https://reviews.freebsd.org/D5030
> 
> Modified:
>   head/sys/arm/conf/ARMADA38X
>   head/sys/arm/mv/armada38x/files.armada38x
>   head/sys/arm/mv/mpic.c
>   head/sys/arm/mv/mvreg.h
>   head/sys/boot/fdt/dts/arm/db78460.dts
> 
> Modified: head/sys/arm/conf/ARMADA38X
> ==
> --- head/sys/arm/conf/ARMADA38X   Mon Mar 14 06:30:37
> 2016  (r296824) +++ head/sys/arm/conf/ARMADA38X   Mon Mar
> 14 07:05:41 2016  (r296825) @@ -23,6 +23,7 @@ options
> SCHED_ULE # ULE scheduler #options
> SCHED_4BSD# 4BSD scheduler 
>  options  SMP
> +options  ARM_INTRNG

This file already had ARM_INTRNG set. It now has it twice.

Andrew
___
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: r297914 - in head/sys/arm64: arm64 include

2016-04-13 Thread Andrew Turner
Author: andrew
Date: Wed Apr 13 09:44:32 2016
New Revision: 297914
URL: https://svnweb.freebsd.org/changeset/base/297914

Log:
  Increase the arm64 kernel address space to 512GB, and the DMAP region to
  2TB. The latter can be increased in 512GB chunks by adjusting the lower
  address, however more work will be needed to increase the former.
  
  There is still some work needed to only create a DMAP region for the RAM
  address space as on ARM architectures all mappings should have the same
  memory attributes, and these will be different for device and normal memory.
  
  Reviewed by:  kib
  Obtained from:ABT Systems Ltd
  Relnotes: yes
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D5859

Modified:
  head/sys/arm64/arm64/locore.S
  head/sys/arm64/arm64/pmap.c
  head/sys/arm64/include/vmparam.h

Modified: head/sys/arm64/arm64/locore.S
==
--- head/sys/arm64/arm64/locore.S   Wed Apr 13 09:20:29 2016
(r297913)
+++ head/sys/arm64/arm64/locore.S   Wed Apr 13 09:44:32 2016
(r297914)
@@ -37,6 +37,7 @@
 #include 
 
 #defineVIRT_BITS   48
+#defineDMAP_TABLES ((DMAP_MAX_ADDRESS - DMAP_MIN_ADDRESS) >> 
L0_SHIFT)
 
.globl  kernbase
.setkernbase, KERNBASE
@@ -322,10 +323,12 @@ virt_map:
  * TODO: This is out of date.
  *  There are at least 5 pages before that address for the page tables
  *   The pages used are:
- *- The identity (PA = VA) table (TTBR0)
- *- The Kernel L1 table  (TTBR1)(not yet)
- *-  The PA != VA L2 table to jump into (not yet)
- *-  The FDT L2 table   (not yet)
+ *- The Kernel L2 table
+ *- The Kernel L1 table
+ *- The Kernel L0 table (TTBR1)
+ *- The identity (PA = VA) L1 table
+ *- The identity (PA = VA) L0 table (TTBR0)
+ *- The DMAP L1 tables
  */
 create_pagetables:
/* Save the Link register */
@@ -381,6 +384,12 @@ create_pagetables:
mov x10, #1
bl  link_l0_pagetable
 
+   /* Link the DMAP tables */
+   ldr x8, =DMAP_MIN_ADDRESS
+   adr x9, pagetable_dmap;
+   mov x10, #DMAP_TABLES
+   bl  link_l0_pagetable
+
/*
 * Build the TTBR0 maps.
 */
@@ -644,6 +653,10 @@ pagetable_l1_ttbr0:
.space  PAGE_SIZE
 pagetable_l0_ttbr0:
.space  PAGE_SIZE
+
+   .globl pagetable_dmap
+pagetable_dmap:
+   .space  PAGE_SIZE * DMAP_TABLES
 pagetable_end:
 
 el2_pagetable:

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Wed Apr 13 09:20:29 2016(r297913)
+++ head/sys/arm64/arm64/pmap.c Wed Apr 13 09:44:32 2016(r297914)
@@ -222,6 +222,13 @@ static struct rwlock_padalign pvh_global
 
 vm_paddr_t dmap_phys_base; /* The start of the dmap region */
 
+/* This code assumes all L1 DMAP entries will be used */
+CTASSERT((DMAP_MIN_ADDRESS  & ~L0_OFFSET) == DMAP_MIN_ADDRESS);
+CTASSERT((DMAP_MAX_ADDRESS  & ~L0_OFFSET) == DMAP_MAX_ADDRESS);
+
+#defineDMAP_TABLES ((DMAP_MAX_ADDRESS - DMAP_MIN_ADDRESS) >> 
L0_SHIFT)
+extern pt_entry_t pagetable_dmap[];
+
 /*
  * Data for the pv entry allocation mechanism
  */
@@ -543,28 +550,25 @@ pmap_early_vtophys(vm_offset_t l1pt, vm_
 }
 
 static void
-pmap_bootstrap_dmap(vm_offset_t l1pt, vm_paddr_t kernstart)
+pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t kernstart)
 {
vm_offset_t va;
vm_paddr_t pa;
-   pd_entry_t *l1;
u_int l1_slot;
 
pa = dmap_phys_base = kernstart & ~L1_OFFSET;
va = DMAP_MIN_ADDRESS;
-   l1 = (pd_entry_t *)l1pt;
-   l1_slot = pmap_l1_index(DMAP_MIN_ADDRESS);
-
for (; va < DMAP_MAX_ADDRESS;
pa += L1_SIZE, va += L1_SIZE, l1_slot++) {
-   KASSERT(l1_slot < Ln_ENTRIES, ("Invalid L1 index"));
+   l1_slot = ((va - DMAP_MIN_ADDRESS) >> L1_SHIFT);
 
-   pmap_load_store([l1_slot],
+   pmap_load_store(_dmap[l1_slot],
(pa & ~L1_OFFSET) | ATTR_DEFAULT |
ATTR_IDX(CACHED_MEMORY) | L1_BLOCK);
}
 
-   cpu_dcache_wb_range((vm_offset_t)l1, PAGE_SIZE);
+   cpu_dcache_wb_range((vm_offset_t)pagetable_dmap,
+   PAGE_SIZE * DMAP_TABLES);
cpu_tlb_flushID();
 }
 

Modified: head/sys/arm64/include/vmparam.h
==
--- head/sys/arm64/include/vmparam.hWed Apr 13 09:20:29 2016
(r297913)
+++ head/sys/arm64/include/vmparam.hWed Apr 13 09:44:32 2016
(r297914)
@@ -125,15 +125,16 @@
  * split into 2 regions at each end of the 64 bit address space, with an
  * out of range "hole" in the middle.
  *
- * We limit the size of the two spaces to 39 bits each.
+ * We use the full 48 bits for each 

svn commit: r297917 - head/sys/arm64/include

2016-04-13 Thread Andrew Turner
Author: andrew
Date: Wed Apr 13 11:43:03 2016
New Revision: 297917
URL: https://svnweb.freebsd.org/changeset/base/297917

Log:
  Document the memory ranges within the kernel region to help with debugging
  to track down which region an address is from.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/include/vmparam.h

Modified: head/sys/arm64/include/vmparam.h
==
--- head/sys/arm64/include/vmparam.hWed Apr 13 11:24:24 2016
(r297916)
+++ head/sys/arm64/include/vmparam.hWed Apr 13 11:43:03 2016
(r297917)
@@ -128,14 +128,19 @@
  * We use the full 48 bits for each region, however the kernel may only use
  * a limited range within this space.
  *
- * Upper region:   0x
- * 0x
+ * Upper region:0x  Top of virtual memory
  *
- * Hole:   0xfffe
- * 0x0001
+ *  0xfeff  End of DMAP
+ *  0xfd00  Start of DMAP
  *
- * Lower region:   0x
- * 0x
+ *  0x007f  End of KVA
+ *  0x  Kernel base address & start of KVA
+ *
+ * Hole:0xfffe
+ *  0x0001
+ *
+ * Lower region:0x End of user address space
+ *  0x Start of user address space
  *
  * We use the upper region for the kernel, and the lower region for userland.
  *
___
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: r297619 - in head/lib/libc: aarch64/gen aarch64/sys arm/aeabi gen include

2016-04-06 Thread Andrew Turner
Author: andrew
Date: Wed Apr  6 16:09:10 2016
New Revision: 297619
URL: https://svnweb.freebsd.org/changeset/base/297619

Log:
  Disable support for compat syscalls on arm64. These symbols were never
  shipped since arm64 exists only on 11+.
  
  Submitted by: brooks
  Reviewed by:  emaste, imp

Modified:
  head/lib/libc/aarch64/gen/Makefile.inc
  head/lib/libc/aarch64/sys/Makefile.inc
  head/lib/libc/arm/aeabi/aeabi_vfp.h
  head/lib/libc/gen/semctl.c
  head/lib/libc/include/compat.h

Modified: head/lib/libc/aarch64/gen/Makefile.inc
==
--- head/lib/libc/aarch64/gen/Makefile.inc  Wed Apr  6 15:28:26 2016
(r297618)
+++ head/lib/libc/aarch64/gen/Makefile.inc  Wed Apr  6 16:09:10 2016
(r297619)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+CFLAGS+=   -DNO_COMPAT7
+
 SRCS+= _ctx_start.S \
fabs.S \
flt_rounds.c \

Modified: head/lib/libc/aarch64/sys/Makefile.inc
==
--- head/lib/libc/aarch64/sys/Makefile.inc  Wed Apr  6 15:28:26 2016
(r297618)
+++ head/lib/libc/aarch64/sys/Makefile.inc  Wed Apr  6 16:09:10 2016
(r297619)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+MIASM:=${MIASM:Nfreebsd[467]_*}
+
 SRCS+= __vdso_gettc.c
 
 #MDASM= ptrace.S

Modified: head/lib/libc/arm/aeabi/aeabi_vfp.h
==
--- head/lib/libc/arm/aeabi/aeabi_vfp.h Wed Apr  6 15:28:26 2016
(r297618)
+++ head/lib/libc/arm/aeabi/aeabi_vfp.h Wed Apr  6 16:09:10 2016
(r297619)
@@ -42,7 +42,9 @@
 #defineAEABI_ENTRY(x)  ENTRY(__aeabi_ ## x ## _vfp)
 #defineAEABI_END(x)END(__aeabi_ ## x ## _vfp)
 #else
-#defineAEABI_ENTRY(x)  ENTRY(__aeabi_ ## x)
+#defineAEABI_ENTRY(x)  \
+.set __fbsd_ ## x, __aeabi_ ## x;  \
+ENTRY(__aeabi_ ## x)
 #defineAEABI_END(x)END(__aeabi_ ## x)
 #endif
 

Modified: head/lib/libc/gen/semctl.c
==
--- head/lib/libc/gen/semctl.c  Wed Apr  6 15:28:26 2016(r297618)
+++ head/lib/libc/gen/semctl.c  Wed Apr  6 16:09:10 2016(r297619)
@@ -29,7 +29,9 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#ifndef NO_COMPAT7
 #define _WANT_SEMUN_OLD
+#endif
 
 #include 
 #include 
@@ -38,8 +40,10 @@ __FBSDID("$FreeBSD$");
 #include 
 
 int__semctl(int semid, int semnum, int cmd, union semun *arg);
+#ifndef NO_COMPAT7
 intfreebsd7___semctl(int semid, int semnum, int cmd, union semun_old *arg);
 intfreebsd7_semctl(int semid, int semnum, int cmd, ...);
+#endif
 
 int
 semctl(int semid, int semnum, int cmd, ...)
@@ -61,6 +65,7 @@ semctl(int semid, int semnum, int cmd, .
return (__semctl(semid, semnum, cmd, semun_ptr));
 }
 
+#ifndef NO_COMPAT7
 int
 freebsd7_semctl(int semid, int semnum, int cmd, ...)
 {
@@ -82,3 +87,4 @@ freebsd7_semctl(int semid, int semnum, i
 }
 
 __sym_compat(semctl, freebsd7_semctl, FBSD_1.0);
+#endif

Modified: head/lib/libc/include/compat.h
==
--- head/lib/libc/include/compat.h  Wed Apr  6 15:28:26 2016
(r297618)
+++ head/lib/libc/include/compat.h  Wed Apr  6 16:09:10 2016
(r297619)
@@ -38,9 +38,11 @@
 #define__sym_compat(sym,impl,verid)\
.symver impl, sym@verid
 
+#ifndef NO_COMPAT7
 __sym_compat(__semctl, freebsd7___semctl, FBSD_1.0);
 __sym_compat(msgctl, freebsd7_msgctl, FBSD_1.0);
 __sym_compat(shmctl, freebsd7_shmctl, FBSD_1.0);
+#endif
 
 #undef __sym_compat
 
___
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: r297619 - in head/lib/libc: aarch64/gen aarch64/sys arm/aeabi gen include

2016-04-06 Thread Andrew Turner
On Wed, 6 Apr 2016 16:09:10 + (UTC)
Andrew Turner <and...@freebsd.org> wrote:

> Author: andrew
> Date: Wed Apr  6 16:09:10 2016
> New Revision: 297619
> URL: https://svnweb.freebsd.org/changeset/base/297619
> 
> Log:
>   Disable support for compat syscalls on arm64. These symbols were
> never shipped since arm64 exists only on 11+.
>   
>   Submitted by:   brooks
>   Reviewed by:emaste, imp
Differential Revision: https://reviews.freebsd.org/D5601

Andrew
___
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: r297617 - head/sys/arm64/arm64

2016-04-06 Thread Andrew Turner
Author: andrew
Date: Wed Apr  6 14:16:37 2016
New Revision: 297617
URL: https://svnweb.freebsd.org/changeset/base/297617

Log:
  Use PHYS_IN_DMAP to check if a physical address is within the DMAP region.
  
  Approved by:  ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/pmap.c

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Wed Apr  6 14:12:00 2016(r297616)
+++ head/sys/arm64/arm64/pmap.c Wed Apr  6 14:16:37 2016(r297617)
@@ -3534,7 +3534,7 @@ pmap_map_io_transient(vm_page_t page[], 
needs_mapping = FALSE;
for (i = 0; i < count; i++) {
paddr = VM_PAGE_TO_PHYS(page[i]);
-   if (__predict_false(paddr >= DMAP_MAX_PHYSADDR)) {
+   if (__predict_false(!PHYS_IN_DMAP(paddr))) {
error = vmem_alloc(kernel_arena, PAGE_SIZE,
M_BESTFIT | M_WAITOK, [i]);
KASSERT(error == 0, ("vmem_alloc failed: %d", error));
@@ -3552,7 +3552,7 @@ pmap_map_io_transient(vm_page_t page[], 
sched_pin();
for (i = 0; i < count; i++) {
paddr = VM_PAGE_TO_PHYS(page[i]);
-   if (paddr >= DMAP_MAX_PHYSADDR) {
+   if (!PHYS_IN_DMAP(paddr)) {
panic(
   "pmap_map_io_transient: TODO: Map out of DMAP data");
}
@@ -3572,7 +3572,7 @@ pmap_unmap_io_transient(vm_page_t page[]
sched_unpin();
for (i = 0; i < count; i++) {
paddr = VM_PAGE_TO_PHYS(page[i]);
-   if (paddr >= DMAP_MAX_PHYSADDR) {
+   if (!PHYS_IN_DMAP(paddr)) {
panic("ARM64TODO: pmap_unmap_io_transient: Unmap data");
}
}
___
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: r297615 - in head/sys/arm64: arm64 include

2016-04-06 Thread Andrew Turner
Author: andrew
Date: Wed Apr  6 14:08:10 2016
New Revision: 297615
URL: https://svnweb.freebsd.org/changeset/base/297615

Log:
  Allow vmparam.h to be included from assembly files on arm64.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/copyinout.S
  head/sys/arm64/arm64/genassym.c
  head/sys/arm64/arm64/locore.S
  head/sys/arm64/arm64/support.S
  head/sys/arm64/include/vmparam.h

Modified: head/sys/arm64/arm64/copyinout.S
==
--- head/sys/arm64/arm64/copyinout.SWed Apr  6 12:48:45 2016
(r297614)
+++ head/sys/arm64/arm64/copyinout.SWed Apr  6 14:08:10 2016
(r297615)
@@ -33,6 +33,8 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#include 
+
 #include "assym.s"
 
 /*

Modified: head/sys/arm64/arm64/genassym.c
==
--- head/sys/arm64/arm64/genassym.c Wed Apr  6 12:48:45 2016
(r297614)
+++ head/sys/arm64/arm64/genassym.c Wed Apr  6 14:08:10 2016
(r297615)
@@ -37,9 +37,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-ASSYM(KERNBASE, KERNBASE);
-ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS);
-
 ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
 ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
 

Modified: head/sys/arm64/arm64/locore.S
==
--- head/sys/arm64/arm64/locore.S   Wed Apr  6 12:48:45 2016
(r297614)
+++ head/sys/arm64/arm64/locore.S   Wed Apr  6 14:08:10 2016
(r297615)
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #defineVIRT_BITS   48
 

Modified: head/sys/arm64/arm64/support.S
==
--- head/sys/arm64/arm64/support.S  Wed Apr  6 12:48:45 2016
(r297614)
+++ head/sys/arm64/arm64/support.S  Wed Apr  6 14:08:10 2016
(r297615)
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 
 #include "assym.s"
 

Modified: head/sys/arm64/include/vmparam.h
==
--- head/sys/arm64/include/vmparam.hWed Apr  6 12:48:45 2016
(r297614)
+++ head/sys/arm64/include/vmparam.hWed Apr  6 14:08:10 2016
(r297615)
@@ -160,7 +160,6 @@
 #defineDMAP_MIN_ADDRESS(0xffc0UL)
 #defineDMAP_MAX_ADDRESS(0xffdfUL)
 
-extern vm_paddr_t dmap_phys_base;
 #defineDMAP_MIN_PHYSADDR   (dmap_phys_base)
 #defineDMAP_MAX_PHYSADDR   (dmap_phys_base + (DMAP_MAX_ADDRESS - 
DMAP_MIN_ADDRESS))
 
@@ -229,10 +228,15 @@ extern vm_paddr_t dmap_phys_base;
 
 #defineUMA_MD_SMALL_ALLOC
 
+#ifndef LOCORE
+
+extern vm_paddr_t dmap_phys_base;
 extern u_int tsb_kernel_ldd_phys;
 extern vm_offset_t vm_max_kernel_address;
 extern vm_offset_t init_pt_va;
 
+#endif
+
 #defineZERO_REGION_SIZE(64 * 1024) /* 64KB */
 
 #endif /* !_MACHINE_VMPARAM_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: r297616 - head/sys/arm64/arm64

2016-04-06 Thread Andrew Turner
Author: andrew
Date: Wed Apr  6 14:12:00 2016
New Revision: 297616
URL: https://svnweb.freebsd.org/changeset/base/297616

Log:
  Cleanup the early pagetable creation code in preperation for increasing
  the size of the arm64 DMAP region.
  
  Approved by:  ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/locore.S

Modified: head/sys/arm64/arm64/locore.S
==
--- head/sys/arm64/arm64/locore.S   Wed Apr  6 14:08:10 2016
(r297615)
+++ head/sys/arm64/arm64/locore.S   Wed Apr  6 14:12:00 2016
(r297616)
@@ -378,6 +378,7 @@ create_pagetables:
/* Link the l0 -> l1 table */
mov x9, x6
mov x6, x24
+   mov x10, #1
bl  link_l0_pagetable
 
/*
@@ -408,6 +409,7 @@ create_pagetables:
/* Link the l0 -> l1 table */
mov x9, x6
mov x6, x27
+   mov x10, #1
bl  link_l0_pagetable
 
/* Restore the Link register */
@@ -423,6 +425,7 @@ create_pagetables:
  *  x6  = L0 table
  *  x8  = Virtual Address
  *  x9  = L1 PA (trashed)
+ *  x10 = Entry count
  *  x11, x12 and x13 are trashed
  */
 link_l0_pagetable:
@@ -437,11 +440,16 @@ link_l0_pagetable:
mov x12, #L0_TABLE
 
/* Only use the output address bits */
-   lsr x9, x9, #12
-   orr x12, x12, x9, lsl #12
+   lsr x9, x9, #PAGE_SHIFT
+1: orr x13, x12, x9, lsl #PAGE_SHIFT
 
/* Store the entry */
-   str x12, [x6, x11, lsl #3]
+   str x13, [x6, x11, lsl #3]
+
+   sub x10, x10, #1
+   add x11, x11, #1
+   add x9, x9, #1
+   cbnzx10, 1b
 
ret
 
@@ -468,11 +476,11 @@ link_l1_pagetable:
mov x12, #L1_TABLE
 
/* Only use the output address bits */
-   lsr x9, x9, #12
-   orr x12, x12, x9, lsl #12
+   lsr x9, x9, #PAGE_SHIFT
+   orr x13, x12, x9, lsl #PAGE_SHIFT
 
/* Store the entry */
-   str x12, [x6, x11, lsl #3]
+   str x13, [x6, x11, lsl #3]
 
ret
 
@@ -482,7 +490,7 @@ link_l1_pagetable:
  *  x7  = Type (0 = Device, 1 = Normal)
  *  x8  = VA start
  *  x9  = PA start (trashed)
- *  x10 = Entry count (TODO)
+ *  x10 = Entry count
  *  x11, x12 and x13 are trashed
  */
 build_l1_block_pagetable:
@@ -505,20 +513,17 @@ build_l1_block_pagetable:
lsr x9, x9, #L1_SHIFT
 
/* Set the physical address for this virtual address */
-1: orr x12, x12, x9, lsl #L1_SHIFT
+1: orr x13, x12, x9, lsl #L1_SHIFT
 
/* Store the entry */
-   str x12, [x6, x11, lsl #3]
-
-   /* Clear the address bits */
-   and x12, x12, #ATTR_MASK_L
+   str x13, [x6, x11, lsl #3]
 
sub x10, x10, #1
add x11, x11, #1
add x9, x9, #1
cbnzx10, 1b
 
-2: ret
+   ret
 
 /*
  * Builds count 2 MiB page table entry
@@ -526,7 +531,7 @@ build_l1_block_pagetable:
  *  x7  = Type (0 = Device, 1 = Normal)
  *  x8  = VA start
  *  x9  = PA start (trashed)
- *  x10 = Entry count (TODO)
+ *  x10 = Entry count
  *  x11, x12 and x13 are trashed
  */
 build_l2_block_pagetable:
@@ -549,20 +554,17 @@ build_l2_block_pagetable:
lsr x9, x9, #L2_SHIFT
 
/* Set the physical address for this virtual address */
-1: orr x12, x12, x9, lsl #L2_SHIFT
+1: orr x13, x12, x9, lsl #L2_SHIFT
 
/* Store the entry */
-   str x12, [x6, x11, lsl #3]
-
-   /* Clear the address bits */
-   and x12, x12, #ATTR_MASK_L
+   str x13, [x6, x11, lsl #3]
 
sub x10, x10, #1
add x11, x11, #1
add x9, x9, #1
cbnzx10, 1b
 
-2: ret
+   ret
 
 start_mmu:
dsb sy
___
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: r297620 - head/lib/libc/arm/aeabi

2016-04-06 Thread Andrew Turner
Author: andrew
Date: Wed Apr  6 16:50:18 2016
New Revision: 297620
URL: https://svnweb.freebsd.org/changeset/base/297620

Log:
  Revert a change that sneeked with 297619

Modified:
  head/lib/libc/arm/aeabi/aeabi_vfp.h

Modified: head/lib/libc/arm/aeabi/aeabi_vfp.h
==
--- head/lib/libc/arm/aeabi/aeabi_vfp.h Wed Apr  6 16:09:10 2016
(r297619)
+++ head/lib/libc/arm/aeabi/aeabi_vfp.h Wed Apr  6 16:50:18 2016
(r297620)
@@ -42,9 +42,7 @@
 #defineAEABI_ENTRY(x)  ENTRY(__aeabi_ ## x ## _vfp)
 #defineAEABI_END(x)END(__aeabi_ ## x ## _vfp)
 #else
-#defineAEABI_ENTRY(x)  \
-.set __fbsd_ ## x, __aeabi_ ## x;  \
-ENTRY(__aeabi_ ## x)
+#defineAEABI_ENTRY(x)  ENTRY(__aeabi_ ## x)
 #defineAEABI_END(x)END(__aeabi_ ## x)
 #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: r297029 - in head/sys/arm64: arm64 include

2016-03-19 Thread Andrew Turner
Author: andrew
Date: Fri Mar 18 16:29:58 2016
New Revision: 297029
URL: https://svnweb.freebsd.org/changeset/base/297029

Log:
  Rename COUNT_IPI to INTR_IPI_COUNT to reduce the diff with intrng.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/mp_machdep.c
  head/sys/arm64/include/smp.h

Modified: head/sys/arm64/arm64/mp_machdep.c
==
--- head/sys/arm64/arm64/mp_machdep.c   Fri Mar 18 16:18:29 2016
(r297028)
+++ head/sys/arm64/arm64/mp_machdep.c   Fri Mar 18 16:29:58 2016
(r297029)
@@ -179,7 +179,7 @@ release_aps(void *dummy __unused)
int cpu, i;
 
/* Setup the IPI handler */
-   for (i = 0; i < COUNT_IPI; i++)
+   for (i = 0; i < INTR_IPI_COUNT; i++)
arm_setup_ipihandler(ipi_handler, i);
 
atomic_store_rel_int(_ready, 1);
@@ -238,7 +238,7 @@ init_secondary(uint64_t cpu)
/* Configure the interrupt controller */
arm_init_secondary();
 
-   for (i = 0; i < COUNT_IPI; i++)
+   for (i = 0; i < INTR_IPI_COUNT; i++)
arm_unmask_ipi(i);
 
/* Start per-CPU event timers. */
@@ -277,7 +277,7 @@ ipi_handler(void *arg)
u_int cpu, ipi;
 
arg = (void *)((uintptr_t)arg & ~(1 << 16));
-   KASSERT((uintptr_t)arg < COUNT_IPI,
+   KASSERT((uintptr_t)arg < INTR_IPI_COUNT,
("Invalid IPI %ju", (uintptr_t)arg));
 
cpu = PCPU_GET(cpuid);

Modified: head/sys/arm64/include/smp.h
==
--- head/sys/arm64/include/smp.hFri Mar 18 16:18:29 2016
(r297028)
+++ head/sys/arm64/include/smp.hFri Mar 18 16:29:58 2016
(r297029)
@@ -42,7 +42,7 @@ enum {
IPI_STOP,
IPI_STOP_HARD,
IPI_HARDCLOCK,
-   COUNT_IPI,
+   INTR_IPI_COUNT,
 };
 
 void   ipi_all_but_self(u_int ipi);
___
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: r297030 - head/sys/arm64/arm64

2016-03-19 Thread Andrew Turner
Author: andrew
Date: Fri Mar 18 16:32:22 2016
New Revision: 297030
URL: https://svnweb.freebsd.org/changeset/base/297030

Log:
  Move the opt_ files to be included first so their definitions can be used
  from within all further included files.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/arm64/arm64/nexus.c
==
--- head/sys/arm64/arm64/nexus.cFri Mar 18 16:29:58 2016
(r297029)
+++ head/sys/arm64/arm64/nexus.cFri Mar 18 16:32:22 2016
(r297030)
@@ -39,6 +39,9 @@
  * and I/O memory address space.
  */
 
+#include "opt_acpi.h"
+#include "opt_platform.h"
+
 #include 
 __FBSDID("$FreeBSD$");
 
@@ -60,9 +63,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "opt_acpi.h"
-#include "opt_platform.h"
-
 #ifdef FDT
 #include 
 #include "ofw_bus_if.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: r297017 - head/sys/arm64/include

2016-03-19 Thread Andrew Turner
Author: andrew
Date: Fri Mar 18 10:01:25 2016
New Revision: 297017
URL: https://svnweb.freebsd.org/changeset/base/297017

Log:
  Remove the invalid L0_BLOCK definition. ARMv8 doesn't support block
  translation in the level 0 descriptor.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/include/pte.h

Modified: head/sys/arm64/include/pte.h
==
--- head/sys/arm64/include/pte.hFri Mar 18 09:54:09 2016
(r297016)
+++ head/sys/arm64/include/pte.hFri Mar 18 10:01:25 2016
(r297017)
@@ -74,7 +74,7 @@ typedef   uint64_tpt_entry_t; /* page 
ta
 /* Level 0 table, 512GiB per entry */
 #defineL0_SHIFT39
 #defineL0_INVAL0x0 /* An invalid address */
-#defineL0_BLOCK0x1 /* A block */
+   /* 0x1 Level 0 doesn't support block translation */
/* 0x2 also marks an invalid address */
 #defineL0_TABLE0x3 /* A next-level table */
 
@@ -83,16 +83,16 @@ typedef uint64_tpt_entry_t; /* page 
ta
 #defineL1_SIZE (1 << L1_SHIFT)
 #defineL1_OFFSET   (L1_SIZE - 1)
 #defineL1_INVALL0_INVAL
-#defineL1_BLOCKL0_BLOCK
+#defineL1_BLOCK0x1
 #defineL1_TABLEL0_TABLE
 
 /* Level 2 table, 2MiB per entry */
 #defineL2_SHIFT21
 #defineL2_SIZE (1 << L2_SHIFT)
 #defineL2_OFFSET   (L2_SIZE - 1)
-#defineL2_INVALL0_INVAL
-#defineL2_BLOCKL0_BLOCK
-#defineL2_TABLEL0_TABLE
+#defineL2_INVALL1_INVAL
+#defineL2_BLOCKL1_BLOCK
+#defineL2_TABLEL1_TABLE
 
 #defineL2_BLOCK_MASK   UINT64_C(0xffe0)
 
___
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: r297184 - head/sys/arm64/include

2016-03-22 Thread Andrew Turner
Author: andrew
Date: Tue Mar 22 08:36:25 2016
New Revision: 297184
URL: https://svnweb.freebsd.org/changeset/base/297184

Log:
  Use the saved program state register to detect when an exception frame is
  from userpsace. Previously we could have triggered a panic by trying to
  jump to a kernel address from userland as the trap handling code thought we
  received an ast in kernel mode.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/include/cpu.h

Modified: head/sys/arm64/include/cpu.h
==
--- head/sys/arm64/include/cpu.hTue Mar 22 08:12:45 2016
(r297183)
+++ head/sys/arm64/include/cpu.hTue Mar 22 08:36:25 2016
(r297184)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
- * Copyright (c) 2014 The FreeBSD Foundation
+ * Copyright (c) 2014-2016 The FreeBSD Foundation
  * All rights reserved.
  *
  * This code is derived from software contributed to Berkeley by
@@ -46,7 +46,7 @@
 #include 
 
 #defineTRAPF_PC(tfp)   ((tfp)->tf_lr)
-#defineTRAPF_USERMODE(tfp) (((tfp)->tf_elr & (1ul << 63)) == 0)
+#defineTRAPF_USERMODE(tfp) (((tfp)->tf_spsr & PSR_M_MASK) == 
PSR_M_EL0t)
 
 #definecpu_getstack(td)((td)->td_frame->tf_sp)
 #definecpu_setstack(td, sp)((td)->td_frame->tf_sp = (sp))
___
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: r297284 - in head/sys/arm: arm at91 conf include

2016-03-26 Thread Andrew Turner
On Sat, 26 Mar 2016 15:07:55 +0100
Oliver Pinter  wrote:

> Hi Michal!
> 
> Is there any chance to add similar workaround to arm64 kernel too?
> There are some arm64 devices without UEFI for example Odroid C2 and
> Beelink Mini MX...

No, for these you should port loader, either use loader.efi with the
EFI support in U-Boot, use the port of ubldr, or write something new.

Andrew
___
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: r297295 - head/sys/arm/allwinner

2016-03-26 Thread Andrew Turner
Author: andrew
Date: Sat Mar 26 17:49:46 2016
New Revision: 297295
URL: https://svnweb.freebsd.org/changeset/base/297295

Log:
  Only define the platform methods for the Allwinner platforms we are
  building for.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/allwinner/allwinner_machdep.c

Modified: head/sys/arm/allwinner/allwinner_machdep.c
==
--- head/sys/arm/allwinner/allwinner_machdep.c  Sat Mar 26 17:38:15 2016
(r297294)
+++ head/sys/arm/allwinner/allwinner_machdep.c  Sat Mar 26 17:49:46 2016
(r297295)
@@ -140,6 +140,7 @@ cpu_reset()
while (1);
 }
 
+#if defined(SOC_ALLWINNER_A10)
 static platform_method_t a10_methods[] = {
PLATFORMMETHOD(platform_attach, a10_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
@@ -147,7 +148,10 @@ static platform_method_t a10_methods[] =
 
PLATFORMMETHOD_END,
 };
+FDT_PLATFORM_DEF(a10, "a10", 0, "allwinner,sun4i-a10");
+#endif
 
+#if defined(SOC_ALLWINNER_A20)
 static platform_method_t a20_methods[] = {
PLATFORMMETHOD(platform_attach, a20_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
@@ -159,7 +163,10 @@ static platform_method_t a20_methods[] =
 #endif
PLATFORMMETHOD_END,
 };
+FDT_PLATFORM_DEF(a20, "a20", 0, "allwinner,sun7i-a20");
+#endif
 
+#if defined(SOC_ALLWINNER_A31)
 static platform_method_t a31_methods[] = {
PLATFORMMETHOD(platform_attach, a31_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
@@ -171,7 +178,10 @@ static platform_method_t a31_methods[] =
 #endif
PLATFORMMETHOD_END,
 };
+FDT_PLATFORM_DEF(a31, "a31", 0, "allwinner,sun6i-a31");
+#endif
 
+#if defined(SOC_ALLWINNER_A31S)
 static platform_method_t a31s_methods[] = {
PLATFORMMETHOD(platform_attach, a31s_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
@@ -183,6 +193,8 @@ static platform_method_t a31s_methods[] 
 #endif
PLATFORMMETHOD_END,
 };
+FDT_PLATFORM_DEF(a31s, "a31s", 0, "allwinner,sun6i-a31s");
+#endif
 
 u_int
 allwinner_soc_type(void)
@@ -195,8 +207,3 @@ allwinner_soc_family(void)
 {
return (soc_family);
 }
-
-FDT_PLATFORM_DEF(a10, "a10", 0, "allwinner,sun4i-a10");
-FDT_PLATFORM_DEF(a20, "a20", 0, "allwinner,sun7i-a20");
-FDT_PLATFORM_DEF(a31, "a31", 0, "allwinner,sun6i-a31");
-FDT_PLATFORM_DEF(a31s, "a31s", 0, "allwinner,sun6i-a31s");
___
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: r296426 - in head/sys/arm: allwinner allwinner/a20 conf

2016-03-06 Thread Andrew Turner
Author: andrew
Date: Sun Mar  6 11:41:08 2016
New Revision: 296426
URL: https://svnweb.freebsd.org/changeset/base/296426

Log:
  Add SMP support for the Allwinner A31 and A31s. This updated the existing
  code for the A20 to use the new PLATFORM_SMP interface, and extends it to
  add support for the new SoCs allowing for both to coexist within the same
  kernel.
  
  Submitted by: Emmanuel Vadot 
  Reviewed by:  jmcneill
  Differential Revision:https://reviews.freebsd.org/D5342

Added:
  head/sys/arm/allwinner/aw_mp.c
 - copied, changed from r296425, head/sys/arm/allwinner/a20/a20_mp.c
  head/sys/arm/allwinner/aw_mp.h   (contents, props changed)
Deleted:
  head/sys/arm/allwinner/a20/a20_mp.c
Modified:
  head/sys/arm/allwinner/a20/files.a20
  head/sys/arm/allwinner/allwinner_machdep.c
  head/sys/arm/conf/A20

Modified: head/sys/arm/allwinner/a20/files.a20
==
--- head/sys/arm/allwinner/a20/files.a20Sun Mar  6 08:52:03 2016
(r296425)
+++ head/sys/arm/allwinner/a20/files.a20Sun Mar  6 11:41:08 2016
(r296426)
@@ -1,5 +1,5 @@
 # $FreeBSD$
 
 arm/allwinner/a20/a20_padconf.cstandard
-arm/allwinner/a20/a20_mp.c optionalsmp
+arm/allwinner/aw_mp.c  optionalsmp
 arm/allwinner/a20/a20_if_dwc.c optionaldwc

Modified: head/sys/arm/allwinner/allwinner_machdep.c
==
--- head/sys/arm/allwinner/allwinner_machdep.c  Sun Mar  6 08:52:03 2016
(r296425)
+++ head/sys/arm/allwinner/allwinner_machdep.c  Sun Mar  6 11:41:08 2016
(r296426)
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -152,6 +153,10 @@ static platform_method_t a20_methods[] =
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
 
+#ifdef SMP
+   PLATFORMMETHOD(platform_mp_start_ap,a20_mp_start_ap),
+   PLATFORMMETHOD(platform_mp_setmaxid,aw_mp_setmaxid),
+#endif
PLATFORMMETHOD_END,
 };
 
@@ -160,6 +165,10 @@ static platform_method_t a31_methods[] =
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
 
+#ifdef SMP
+   PLATFORMMETHOD(platform_mp_start_ap,a31_mp_start_ap),
+   PLATFORMMETHOD(platform_mp_setmaxid,aw_mp_setmaxid),
+#endif
PLATFORMMETHOD_END,
 };
 
@@ -168,6 +177,10 @@ static platform_method_t a31s_methods[] 
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
 
+#ifdef SMP
+   PLATFORMMETHOD(platform_mp_start_ap,a31_mp_start_ap),
+   PLATFORMMETHOD(platform_mp_setmaxid,aw_mp_setmaxid),
+#endif
PLATFORMMETHOD_END,
 };
 

Copied and modified: head/sys/arm/allwinner/aw_mp.c (from r296425, 
head/sys/arm/allwinner/a20/a20_mp.c)
==
--- head/sys/arm/allwinner/a20/a20_mp.c Sun Mar  6 08:52:03 2016
(r296425, copy source)
+++ head/sys/arm/allwinner/aw_mp.c  Sun Mar  6 11:41:08 2016
(r296426)
@@ -1,5 +1,6 @@
 /*-
  * Copyright (c) 2014 Ganbold Tsagaankhuu 
+ * Copyright (c) 2016 Emmanuel Vadot 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,53 +39,69 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 
-#defineCPUCFG_BASE 0x01c25c00
+#include 
+#include 
+
+/* Register for all dual-core SoC */
+#defineA20_CPUCFG_BASE 0x01c25c00
+/* Register for all quad-core SoC */
+#defineCPUCFG_BASE 0x01f01c00
 #defineCPUCFG_SIZE 0x400
+#definePRCM_BASE   0x01f01400
+#definePRCM_SIZE   0x800
+
+#defineCPU_OFFSET  0x40
+#defineCPU_OFFSET_CTL  0x04
+#defineCPU_OFFSET_STATUS   0x08
+#defineCPU_RST_CTL(cpuid)  ((cpuid + 1) * CPU_OFFSET)
+#defineCPU_CTL(cpuid)  (((cpuid + 1) * CPU_OFFSET) + 
CPU_OFFSET_CTL)
+#defineCPU_STATUS(cpuid)   (((cpuid + 1) * CPU_OFFSET) + 
CPU_OFFSET_STATUS)
+
+#defineCPU_RESET   (1 << 0)
+#defineCPU_CORE_RESET  (1 << 1)
 
-#defineCPU0_RST_CTL0x40
-#defineCPU0_CTL0x44
-#defineCPU0_STATUS 0x48
-#defineCPU1_RST_CTL0x80
-#defineCPU1_CTL0x84
-#defineCPU1_STATUS 0x88
 #defineCPUCFG_GENCTL   0x184
 #defineCPUCFG_P_REG0   0x1a4
-#define   

svn commit: r296265 - in head/sys: arm/arm dev/fdt mips/beri

2016-03-01 Thread Andrew Turner
Author: andrew
Date: Tue Mar  1 11:39:07 2016
New Revision: 296265
URL: https://svnweb.freebsd.org/changeset/base/296265

Log:
  Make the memory size returned from fdt_get_mem_regions a 64-bit type. This
  is the physical memory size so may be larger than a u_long can hold, e.g.
  on ARM with LPAE we could see an address space of up to 40 bits. On ARM
  u_long is only 32 bits so the memory size will be truncated, possibly to
  zero.
  
  Reported by:  bz
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/arm/machdep.c
  head/sys/dev/fdt/fdt_common.c
  head/sys/dev/fdt/fdt_common.h
  head/sys/mips/beri/beri_machdep.c

Modified: head/sys/arm/arm/machdep.c
==
--- head/sys/arm/arm/machdep.c  Tue Mar  1 11:36:10 2016(r296264)
+++ head/sys/arm/arm/machdep.c  Tue Mar  1 11:39:07 2016(r296265)
@@ -1443,7 +1443,7 @@ initarm(struct arm_boot_params *abp)
struct pv_addr kernel_l1pt;
struct pv_addr dpcpu;
vm_offset_t dtbp, freemempos, l2_start, lastaddr;
-   u_long memsize;
+   uint64_t memsize;
uint32_t l2size;
char *env;
void *kmdp;

Modified: head/sys/dev/fdt/fdt_common.c
==
--- head/sys/dev/fdt/fdt_common.c   Tue Mar  1 11:36:10 2016
(r296264)
+++ head/sys/dev/fdt/fdt_common.c   Tue Mar  1 11:39:07 2016
(r296265)
@@ -647,12 +647,12 @@ out:
 }
 
 int
-fdt_get_mem_regions(struct mem_region *mr, int *mrcnt, u_long *memsize)
+fdt_get_mem_regions(struct mem_region *mr, int *mrcnt, uint64_t *memsize)
 {
pcell_t reg[FDT_REG_CELLS * FDT_MEM_REGIONS];
pcell_t *regp;
phandle_t memory;
-   u_long memory_size;
+   uint64_t memory_size;
int addr_cells, size_cells;
int i, max_size, reg_len, rv, tuple_size, tuples;
 

Modified: head/sys/dev/fdt/fdt_common.h
==
--- head/sys/dev/fdt/fdt_common.h   Tue Mar  1 11:36:10 2016
(r296264)
+++ head/sys/dev/fdt/fdt_common.h   Tue Mar  1 11:39:07 2016
(r296265)
@@ -85,7 +85,7 @@ u_long fdt_data_get(void *, int);
 int fdt_data_to_res(pcell_t *, int, int, u_long *, u_long *);
 phandle_t fdt_find_compatible(phandle_t, const char *, int);
 phandle_t fdt_depth_search_compatible(phandle_t, const char *, int);
-int fdt_get_mem_regions(struct mem_region *, int *, u_long *);
+int fdt_get_mem_regions(struct mem_region *, int *, uint64_t *);
 int fdt_get_reserved_regions(struct mem_region *, int *);
 int fdt_get_phyaddr(phandle_t, device_t, int *, void **);
 int fdt_get_range(phandle_t, int, u_long *, u_long *);

Modified: head/sys/mips/beri/beri_machdep.c
==
--- head/sys/mips/beri/beri_machdep.c   Tue Mar  1 11:36:10 2016
(r296264)
+++ head/sys/mips/beri/beri_machdep.c   Tue Mar  1 11:39:07 2016
(r296265)
@@ -90,8 +90,8 @@ mips_init(void)
int i;
 #ifdef FDT
struct mem_region mr[FDT_MEM_REGIONS];
+   uint64_t val;
int mr_cnt;
-   u_long val;
int j;
 #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: r296408 - head/sys/arm/allwinner

2016-03-05 Thread Andrew Turner
Author: andrew
Date: Sat Mar  5 13:17:53 2016
New Revision: 296408
URL: https://svnweb.freebsd.org/changeset/base/296408

Log:
  Add support to enable/disable both the EHCI and OHCI Allwinner clocks. This
  adds a lock to ensure only a single device is accessing the hardware. A
  reference count is added to only enable when we start to use the clock,
  and to disable after we have finished needing the clock.
  
  This was extracted from a larger review to add OHCI support to the
  Allwinner SoCs.
  
  Submitted by: Emmanuel Vadot 
  Reviewed by:  jmcneill
  X-Differential Revision:  https://reviews.freebsd.org/D5481

Modified:
  head/sys/arm/allwinner/a10_clk.c
  head/sys/arm/allwinner/a10_clk.h
  head/sys/arm/allwinner/a10_ehci.c

Modified: head/sys/arm/allwinner/a10_clk.c
==
--- head/sys/arm/allwinner/a10_clk.cSat Mar  5 11:20:02 2016
(r296407)
+++ head/sys/arm/allwinner/a10_clk.cSat Mar  5 13:17:53 2016
(r296408)
@@ -59,14 +59,27 @@ struct a10_ccm_softc {
struct resource *res;
bus_space_tag_t bst;
bus_space_handle_t  bsh;
+   struct mtx  mtx;
int pll6_enabled;
+   int ehci_cnt;
+   int ohci_cnt;
+   int usbphy_cnt;
+   int usb_cnt;
 };
 
 static struct a10_ccm_softc *a10_ccm_sc = NULL;
 
-#define ccm_read_4(sc, reg)\
+static int a10_clk_usbphy_activate(struct a10_ccm_softc *sc);
+static int a10_clk_usbphy_deactivate(struct a10_ccm_softc *sc);
+static int a10_clk_usb_activate(struct a10_ccm_softc *sc);
+static int a10_clk_usb_deactivate(struct a10_ccm_softc *sc);
+
+#defineCCM_LOCK(sc)mtx_lock(&(sc)->mtx);
+#defineCCM_UNLOCK(sc)  mtx_unlock(&(sc)->mtx);
+#defineCCM_LOCK_ASSERT(sc) mtx_assert(&(sc)->mtx, MA_OWNED)
+#defineccm_read_4(sc, reg) \
bus_space_read_4((sc)->bst, (sc)->bsh, (reg))
-#define ccm_write_4(sc, reg, val)  \
+#defineccm_write_4(sc, reg, val)   \
bus_space_write_4((sc)->bst, (sc)->bsh, (reg), (val))
 
 static int
@@ -102,6 +115,8 @@ a10_ccm_attach(device_t dev)
sc->bst = rman_get_bustag(sc->res);
sc->bsh = rman_get_bushandle(sc->res);
 
+   mtx_init(>mtx, "a10_ccm", NULL, MTX_DEF);
+
a10_ccm_sc = sc;
 
return (0);
@@ -125,7 +140,7 @@ EARLY_DRIVER_MODULE(a10_ccm, simplebus, 
 BUS_PASS_TIMER + BUS_PASS_ORDER_MIDDLE);
 
 int
-a10_clk_usb_activate(void)
+a10_clk_ehci_activate(void)
 {
struct a10_ccm_softc *sc = a10_ccm_sc;
uint32_t reg_value;
@@ -133,26 +148,26 @@ a10_clk_usb_activate(void)
if (sc == NULL)
return (ENXIO);
 
-   /* Gating AHB clock for USB */
-   reg_value = ccm_read_4(sc, CCM_AHB_GATING0);
-   reg_value |= CCM_AHB_GATING_USB0; /* AHB clock gate usb0 */
-   reg_value |= CCM_AHB_GATING_EHCI0; /* AHB clock gate ehci0 */
-   reg_value |= CCM_AHB_GATING_EHCI1; /* AHB clock gate ehci1 */
-   ccm_write_4(sc, CCM_AHB_GATING0, reg_value);
+   CCM_LOCK(sc);
+
+   if (++sc->ehci_cnt == 1) {
+   /* Gating AHB clock for USB */
+   reg_value = ccm_read_4(sc, CCM_AHB_GATING0);
+   reg_value |= CCM_AHB_GATING_EHCI0; /* AHB clock gate ehci0 */
+   reg_value |= CCM_AHB_GATING_EHCI1; /* AHB clock gate ehci1 */
+   ccm_write_4(sc, CCM_AHB_GATING0, reg_value);
+   }
+
+   a10_clk_usb_activate(sc);
+   a10_clk_usbphy_activate(sc);
 
-   /* Enable clock for USB */
-   reg_value = ccm_read_4(sc, CCM_USB_CLK);
-   reg_value |= CCM_USB_PHY; /* USBPHY */
-   reg_value |= CCM_USB0_RESET; /* disable reset for USB0 */
-   reg_value |= CCM_USB1_RESET; /* disable reset for USB1 */
-   reg_value |= CCM_USB2_RESET; /* disable reset for USB2 */
-   ccm_write_4(sc, CCM_USB_CLK, reg_value);
+   CCM_UNLOCK(sc);
 
return (0);
 }
 
 int
-a10_clk_usb_deactivate(void)
+a10_clk_ehci_deactivate(void)
 {
struct a10_ccm_softc *sc = a10_ccm_sc;
uint32_t reg_value;
@@ -160,20 +175,160 @@ a10_clk_usb_deactivate(void)
if (sc == NULL)
return (ENXIO);
 
-   /* Disable clock for USB */
-   reg_value = ccm_read_4(sc, CCM_USB_CLK);
-   reg_value &= ~CCM_USB_PHY; /* USBPHY */
-   reg_value &= ~CCM_USB0_RESET; /* reset for USB0 */
-   reg_value &= ~CCM_USB1_RESET; /* reset for USB1 */
-   reg_value &= ~CCM_USB2_RESET; /* reset for USB2 */
-   ccm_write_4(sc, CCM_USB_CLK, reg_value);
+   CCM_LOCK(sc);
 
-   /* Disable gating AHB clock for USB */
-   reg_value = ccm_read_4(sc, CCM_AHB_GATING0);
-   reg_value &= ~CCM_AHB_GATING_USB0; /* disable AHB clock gate usb0 */
-   reg_value &= ~CCM_AHB_GATING_EHCI0; /* disable 

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

2016-03-02 Thread Andrew Turner
Author: andrew
Date: Wed Mar  2 14:33:46 2016
New Revision: 296313
URL: https://svnweb.freebsd.org/changeset/base/296313

Log:
  The cpu_reset_needs_v4_MMU_disable variable is only used in locore-v4.S,
  only define it when building for ARMv5 or prior.
  
  Sponsored by: ABT Systems Ltd

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

Modified: head/sys/arm/arm/cpufunc.c
==
--- head/sys/arm/arm/cpufunc.c  Wed Mar  2 13:54:43 2016(r296312)
+++ head/sys/arm/arm/cpufunc.c  Wed Mar  2 14:33:46 2016(r296313)
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -559,7 +560,9 @@ struct cpu_functions cortexa_cpufuncs = 
 
 struct cpu_functions cpufuncs;
 u_int cputype;
-u_int cpu_reset_needs_v4_MMU_disable;  /* flag used in locore.s */
+#if __ARM_ARCH <= 5
+u_int cpu_reset_needs_v4_MMU_disable;  /* flag used in locore-v4.s */
+#endif
 
 #if defined(CPU_ARM9) ||   \
   defined (CPU_ARM9E) ||   \
@@ -754,7 +757,6 @@ set_cpufuncs()
 #if defined(CPU_ARM1176)
if (cputype == CPU_ID_ARM1176JZS) {
cpufuncs = arm1176_cpufuncs;
-   cpu_reset_needs_v4_MMU_disable = 1; /* V4 or higher */
get_cachetype_cp15();
goto out;
}
@@ -777,7 +779,6 @@ set_cpufuncs()
cputype == CPU_ID_KRAIT300R0 ||
cputype == CPU_ID_KRAIT300R1 ) {
cpufuncs = cortexa_cpufuncs;
-   cpu_reset_needs_v4_MMU_disable = 1; /* V4 or higher */
get_cachetype_cp15();
goto out;
}
___
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: r297552 - head/sys/kern

2016-04-04 Thread Andrew Turner
Author: andrew
Date: Mon Apr  4 10:52:43 2016
New Revision: 297552
URL: https://svnweb.freebsd.org/changeset/base/297552

Log:
  Include sys/rman.h directly rather than relying on header pollution.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/subr_intr.c

Modified: head/sys/kern/subr_intr.c
==
--- head/sys/kern/subr_intr.c   Mon Apr  4 10:27:48 2016(r297551)
+++ head/sys/kern/subr_intr.c   Mon Apr  4 10:52:43 2016(r297552)
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #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: r297550 - head/sys/dev/extres/clk

2016-04-04 Thread Andrew Turner
Author: andrew
Date: Mon Apr  4 10:03:06 2016
New Revision: 297550
URL: https://svnweb.freebsd.org/changeset/base/297550

Log:
  Fix a format string when uint64_t is not unsigned long long by casting
  through uintmax_t.

Modified:
  head/sys/dev/extres/clk/clk.c

Modified: head/sys/dev/extres/clk/clk.c
==
--- head/sys/dev/extres/clk/clk.c   Mon Apr  4 09:50:28 2016
(r297549)
+++ head/sys/dev/extres/clk/clk.c   Mon Apr  4 10:03:06 2016
(r297550)
@@ -487,10 +487,10 @@ clkdom_dump(struct clkdom * clkdom)
CLK_TOPO_SLOCK();
TAILQ_FOREACH(clknode, >clknode_list, clkdom_link) {
rv = clknode_get_freq(clknode, );
-   printf("Clock: %s, parent: %s(%d), freq: %llu\n", clknode->name,
+   printf("Clock: %s, parent: %s(%d), freq: %ju\n", clknode->name,
clknode->parent == NULL ? "(NULL)" : clknode->parent->name,
clknode->parent_idx,
-   ((rv == 0) ? freq: rv));
+   (uintmax_t)((rv == 0) ? freq: rv));
}
CLK_TOPO_UNLOCK();
 }
___
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: r297390 - in head/sys: arm/arm arm64/arm64

2016-03-29 Thread Andrew Turner
Author: andrew
Date: Tue Mar 29 13:51:26 2016
New Revision: 297390
URL: https://svnweb.freebsd.org/changeset/base/297390

Log:
  Read the CPU ID for the current CPU from the GIC. The GIC may have a
  different ID space than the kernel. Because of this we need to read the
  ID from the hardware. The hardware will provide this value to the CPU by
  reading any of the first 8 Interrupt Processor Targets Registers.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D5706

Modified:
  head/sys/arm/arm/gic.c
  head/sys/arm64/arm64/gic.c

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Tue Mar 29 13:31:09 2016(r297389)
+++ head/sys/arm/arm/gic.c  Tue Mar 29 13:51:26 2016(r297390)
@@ -376,7 +376,7 @@ arm_gic_attach(device_t dev)
 {
struct  arm_gic_softc *sc;
int i;
-   uint32_ticciidr;
+   uint32_ticciidr, mask;
 #ifdef ARM_INTRNG
phandle_t   pxref;
intptr_txref = gic_xref(dev);
@@ -437,10 +437,28 @@ arm_gic_attach(device_t dev)
gic_d_write_4(sc, GICD_ICENABLER(i >> 5), 0x);
}
 
+   /* Read the current cpuid mask by reading ITARGETSR{0..7} */
+   for (i = 0; i < 8; i++) {
+   mask = gic_d_read_4(sc, GICD_ITARGETSR(i));
+   if (mask != 0)
+   break;
+   }
+   /* No mask found, assume we are on CPU interface 0 */
+   if (mask == 0)
+   mask = 1;
+
+   /* Collect the mask in the lower byte */
+   mask |= mask >> 16;
+   mask |= mask >> 8;
+   /* Distribute this back to the upper bytes */
+   mask |= mask << 8;
+   mask |= mask << 16;
+
for (i = 0; i < sc->nirqs; i += 4) {
gic_d_write_4(sc, GICD_IPRIORITYR(i >> 2), 0);
-   gic_d_write_4(sc, GICD_ITARGETSR(i >> 2),
-   1 << 0 | 1 << 8 | 1 << 16 | 1 << 24);
+   if (i > 32) {
+   gic_d_write_4(sc, GICD_ITARGETSR(i >> 2), mask);
+   }
}
 
/* Set all the interrupts to be in Group 0 (secure) */

Modified: head/sys/arm64/arm64/gic.c
==
--- head/sys/arm64/arm64/gic.c  Tue Mar 29 13:31:09 2016(r297389)
+++ head/sys/arm64/arm64/gic.c  Tue Mar 29 13:51:26 2016(r297390)
@@ -162,7 +162,7 @@ arm_gic_attach(device_t dev)
 {
struct  arm_gic_softc *sc;
int i;
-   uint32_ticciidr;
+   uint32_ticciidr, mask;
 
if (arm_gic_sc)
return (ENXIO);
@@ -212,10 +212,28 @@ arm_gic_attach(device_t dev)
gic_d_write_4(sc, GICD_ICENABLER(i >> 5), 0x);
}
 
+   /* Read the current cpuid mask by reading ITARGETSR{0..7} */
+   for (i = 0; i < 8; i++) {
+   mask = gic_d_read_4(sc, GICD_ITARGETSR(i));
+   if (mask != 0)
+   break;
+   }
+   /* No mask found, assume we are on CPU interface 0 */
+   if (mask == 0)
+   mask = 1;
+
+   /* Collect the mask in the lower byte */
+   mask |= mask >> 16;
+   mask |= mask >> 8;
+   /* Distribute this back to the upper bytes */
+   mask |= mask << 8;
+   mask |= mask << 16;
+
for (i = 0; i < sc->nirqs; i += 4) {
gic_d_write_4(sc, GICD_IPRIORITYR(i >> 2), 0);
-   gic_d_write_4(sc, GICD_ITARGETSR(i >> 2),
-   1 << 0 | 1 << 8 | 1 << 16 | 1 << 24);
+   if (i > 32) {
+   gic_d_write_4(sc, GICD_ITARGETSR(i >> 2), mask);
+   }
}
 
/* Set all the interrupts to be in Group 0 (secure) */
___
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: r297561 - in head/sys: arm/arm arm64/arm64

2016-04-04 Thread Andrew Turner
Author: andrew
Date: Mon Apr  4 17:04:33 2016
New Revision: 297561
URL: https://svnweb.freebsd.org/changeset/base/297561

Log:
  Add a table to map from the FreeBSD CPUID space to the GIC CPUID space. On
  many SoCs these two are the same, however there is no requirement for this
  to be the case, e.g. on the ARM Juno we boot on what the GIC thinks of as
  CPU 2, but FreeBSD numbers it CPU 0.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm/arm/gic.c
  head/sys/arm64/arm64/gic.c

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Mon Apr  4 16:41:35 2016(r297560)
+++ head/sys/arm/arm/gic.c  Mon Apr  4 17:04:33 2016(r297561)
@@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$");
 #define GICD_ITARGETSR(n)  (0x0800 + ((n) * 4))/* v1 ICDIPTR */
 #define GICD_ICFGR(n)  (0x0C00 + ((n) * 4))/* v1 ICDICFR */
 #define GICD_SGIR(n)   (0x0F00 + ((n) * 4))/* v1 ICDSGIR */
+#define  GICD_SGI_TARGET_SHIFT 16
 
 /* CPU Registers */
 #define GICC_CTLR  0x  /* v1 ICCICR */
@@ -165,6 +166,8 @@ static struct resource_spec arm_gic_spec
{ -1, 0 }
 };
 
+static u_int arm_gic_map[MAXCPU];
+
 static struct arm_gic_softc *gic_sc = NULL;
 
 #definegic_c_read_4(_sc, _reg) \
@@ -224,6 +227,29 @@ gic_irq_mask(struct arm_gic_softc *sc, u
 }
 #endif
 
+static uint8_t
+gic_cpu_mask(struct arm_gic_softc *sc)
+{
+   uint32_t mask;
+   int i;
+
+   /* Read the current cpuid mask by reading ITARGETSR{0..7} */
+   for (i = 0; i < 8; i++) {
+   mask = gic_d_read_4(sc, GICD_ITARGETSR(i));
+   if (mask != 0)
+   break;
+   }
+   /* No mask found, assume we are on CPU interface 0 */
+   if (mask == 0)
+   return (1);
+
+   /* Collect the mask in the lower byte */
+   mask |= mask >> 16;
+   mask |= mask >> 8;
+
+   return (mask);
+}
+
 #ifdef SMP
 #ifdef ARM_INTRNG
 static void
@@ -233,6 +259,9 @@ arm_gic_init_secondary(device_t dev)
struct intr_irqsrc *isrc;
u_int irq;
 
+   /* Set the mask so we can find this CPU to send it IPIs */
+   arm_gic_map[PCPU_GET(cpuid)] = gic_cpu_mask(sc);
+
for (irq = 0; irq < sc->nirqs; irq += 4)
gic_d_write_4(sc, GICD_IPRIORITYR(irq >> 2), 0);
 
@@ -280,6 +309,9 @@ arm_gic_init_secondary(device_t dev)
struct arm_gic_softc *sc = device_get_softc(dev);
int i;
 
+   /* Set the mask so we can find this CPU to send it IPIs */
+   arm_gic_map[PCPU_GET(cpuid)] = gic_cpu_mask(sc);
+
for (i = 0; i < sc->nirqs; i += 4)
gic_d_write_4(sc, GICD_IPRIORITYR(i >> 2), 0);
 
@@ -490,20 +522,11 @@ arm_gic_attach(device_t dev)
gic_d_write_4(sc, GICD_ICENABLER(i >> 5), 0x);
}
 
-   /* Read the current cpuid mask by reading ITARGETSR{0..7} */
-   for (i = 0; i < 8; i++) {
-   mask = gic_d_read_4(sc, GICD_ITARGETSR(i));
-   if (mask != 0)
-   break;
-   }
-   /* No mask found, assume we are on CPU interface 0 */
-   if (mask == 0)
-   mask = 1;
-
-   /* Collect the mask in the lower byte */
-   mask |= mask >> 16;
-   mask |= mask >> 8;
-   /* Distribute this back to the upper bytes */
+   /* Find the current cpu mask */
+   mask = gic_cpu_mask(sc);
+   /* Set the mask so we can find this CPU to send it IPIs */
+   arm_gic_map[PCPU_GET(cpuid)] = mask;
+   /* Set all four targets to this cpu */
mask |= mask << 8;
mask |= mask << 16;
 
@@ -985,7 +1008,7 @@ arm_gic_ipi_send(device_t dev, struct in
 
for (i = 0; i < MAXCPU; i++)
if (CPU_ISSET(i, ))
-   val |= 1 << (16 + i);
+   val |= arm_gic_map[i] << GICD_SGI_TARGET_SHIFT;
 
gic_d_write_4(sc, GICD_SGIR(0), val | gi->gi_irq);
 }
@@ -1113,7 +1136,7 @@ arm_gic_ipi_send(device_t dev, cpuset_t 
 
for (i = 0; i < MAXCPU; i++)
if (CPU_ISSET(i, ))
-   val |= 1 << (16 + i);
+   val |= arm_gic_map[i] << GICD_SGI_TARGET_SHIFT;
 
gic_d_write_4(sc, GICD_SGIR(0), val | ipi);
 }

Modified: head/sys/arm64/arm64/gic.c
==
--- head/sys/arm64/arm64/gic.c  Mon Apr  4 16:41:35 2016(r297560)
+++ head/sys/arm64/arm64/gic.c  Mon Apr  4 17:04:33 2016(r297561)
@@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$");
 #define GICD_ITARGETSR(n)  (0x0800 + ((n) * 4))/* v1 ICDIPTR */
 #define GICD_ICFGR(n)  (0x0C00 + ((n) * 4))/* v1 ICDICFR */
 #define GICD_SGIR(n)   (0x0F00 + ((n) * 4))/* v1 ICDSGIR */
+#define  GICD_SGI_TARGET_SHIFT 16
 
 /* CPU Registers */
 #define GICC_CTLR  

svn commit: r297556 - head/sys/arm64/arm64

2016-04-04 Thread Andrew Turner
Author: andrew
Date: Mon Apr  4 15:13:17 2016
New Revision: 297556
URL: https://svnweb.freebsd.org/changeset/base/297556

Log:
  Reduce the diff for when we switch to intrng. The IPI interrupts will be
  split out to multiple handlers.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/mp_machdep.c

Modified: head/sys/arm64/arm64/mp_machdep.c
==
--- head/sys/arm64/arm64/mp_machdep.c   Mon Apr  4 12:21:04 2016
(r297555)
+++ head/sys/arm64/arm64/mp_machdep.c   Mon Apr  4 15:13:17 2016
(r297556)
@@ -80,6 +80,12 @@ static device_identify_t arm64_cpu_ident
 static device_probe_t arm64_cpu_probe;
 static device_attach_t arm64_cpu_attach;
 
+static void ipi_ast(void *);
+static void ipi_hardclock(void *);
+static void ipi_preempt(void *);
+static void ipi_rendezvous(void *);
+static void ipi_stop(void *);
+
 static int ipi_handler(void *arg);
 
 struct mtx ap_boot_mtx;
@@ -271,6 +277,58 @@ init_secondary(uint64_t cpu)
/* NOTREACHED */
 }
 
+static void
+ipi_ast(void *dummy __unused)
+{
+
+   CTR0(KTR_SMP, "IPI_AST");
+}
+
+static void
+ipi_hardclock(void *dummy __unused)
+{
+
+   CTR1(KTR_SMP, "%s: IPI_HARDCLOCK", __func__);
+   hardclockintr();
+}
+
+static void
+ipi_preempt(void *dummy __unused)
+{
+   CTR1(KTR_SMP, "%s: IPI_PREEMPT", __func__);
+   sched_preempt(curthread);
+}
+
+static void
+ipi_rendezvous(void *dummy __unused)
+{
+
+   CTR0(KTR_SMP, "IPI_RENDEZVOUS");
+   smp_rendezvous_action();
+}
+
+static void
+ipi_stop(void *dummy __unused)
+{
+   u_int cpu;
+
+   CTR0(KTR_SMP, "IPI_STOP");
+
+   cpu = PCPU_GET(cpuid);
+   savectx([cpu]);
+
+   /* Indicate we are stopped */
+   CPU_SET_ATOMIC(cpu, _cpus);
+
+   /* Wait for restart */
+   while (!CPU_ISSET(cpu, _cpus))
+   cpu_spinwait();
+
+   CPU_CLR_ATOMIC(cpu, _cpus);
+   CPU_CLR_ATOMIC(cpu, _cpus);
+   CTR0(KTR_SMP, "IPI_STOP (restart)");
+}
+
 static int
 ipi_handler(void *arg)
 {
@@ -285,35 +343,20 @@ ipi_handler(void *arg)
 
switch(ipi) {
case IPI_AST:
-   CTR0(KTR_SMP, "IPI_AST");
+   ipi_ast(NULL);
break;
case IPI_PREEMPT:
-   CTR1(KTR_SMP, "%s: IPI_PREEMPT", __func__);
-   sched_preempt(curthread);
+   ipi_preempt(NULL);
break;
case IPI_RENDEZVOUS:
-   CTR0(KTR_SMP, "IPI_RENDEZVOUS");
-   smp_rendezvous_action();
+   ipi_rendezvous(NULL);
break;
case IPI_STOP:
case IPI_STOP_HARD:
-   CTR0(KTR_SMP, (ipi == IPI_STOP) ? "IPI_STOP" : "IPI_STOP_HARD");
-   savectx([cpu]);
-
-   /* Indicate we are stopped */
-   CPU_SET_ATOMIC(cpu, _cpus);
-
-   /* Wait for restart */
-   while (!CPU_ISSET(cpu, _cpus))
-   cpu_spinwait();
-
-   CPU_CLR_ATOMIC(cpu, _cpus);
-   CPU_CLR_ATOMIC(cpu, _cpus);
-   CTR0(KTR_SMP, "IPI_STOP (restart)");
+   ipi_stop(NULL);
break;
case IPI_HARDCLOCK:
-   CTR1(KTR_SMP, "%s: IPI_HARDCLOCK", __func__);
-   hardclockintr();
+   ipi_hardclock(NULL);
break;
default:
panic("Unknown IPI %#0x on cpu %d", ipi, curcpu);
___
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: r297446 - in head/sys/arm64: arm64 include

2016-03-31 Thread Andrew Turner
age table */
 #if defined(SOCDEV_PA) && defined(SOCDEV_VA)
@@ -440,7 +430,7 @@ link_l0_pagetable:
 */
/* Find the table index */
lsr x11, x8, #L0_SHIFT
-   and x11, x11, #Ln_ADDR_MASK
+   and x11, x11, #L0_ADDR_MASK
 
/* Build the L0 block entry */
mov x12, #L0_TABLE
@@ -582,7 +572,7 @@ start_mmu:
 
/* Load ttbr0 and ttbr1 */
msr ttbr0_el1, x27
-   msr ttbr1_el1, x26
+   msr ttbr1_el1, x24
isb
 
/* Clear the Monitor Debug System control register */
@@ -596,11 +586,8 @@ start_mmu:
 
/*
 * Setup TCR according to PARange bits from ID_AA64MMFR0_EL1.
-* Some machines have physical memory mapped >512GiB, which can not
-* be identity-mapped using the default 39 VA bits. Thus, use
-* 48 VA bits for now and switch back to 39 after the VA jump.
 */
-   ldr x2, tcr_early
+   ldr x2, tcr
mrs x3, id_aa64mmfr0_el1
bfi x2, x3, #32, #3
msr tcr_el1, x2
@@ -623,9 +610,6 @@ mair:
 tcr:
.quad (TCR_TxSZ(64 - VIRT_BITS) | TCR_ASID_16 | TCR_TG1_4K | \
TCR_CACHE_ATTRS | TCR_SMP_ATTRS)
-tcr_early:
-   .quad (TCR_T1SZ(64 - VIRT_BITS) | TCR_T0SZ(64 - 48) | \
-   TCR_ASID_16 | TCR_TG1_4K | TCR_CACHE_ATTRS | TCR_SMP_ATTRS)
 sctlr_set:
/* Bits to set */
.quad (SCTLR_UCI | SCTLR_nTWE | SCTLR_nTWI | SCTLR_UCT | SCTLR_DZE | \
@@ -651,6 +635,8 @@ pagetable:
.space  PAGE_SIZE
 pagetable_l1_ttbr1:
.space  PAGE_SIZE
+pagetable_l0_ttbr1:
+   .space  PAGE_SIZE
 pagetable_l1_ttbr0:
.space  PAGE_SIZE
 pagetable_l0_ttbr0:

Modified: head/sys/arm64/arm64/machdep.c
==
--- head/sys/arm64/arm64/machdep.c  Thu Mar 31 09:55:21 2016
(r297445)
+++ head/sys/arm64/arm64/machdep.c  Thu Mar 31 11:07:24 2016
(r297446)
@@ -896,8 +896,8 @@ initarm(struct arm64_bootparams *abp)
cache_setup();
 
/* Bootstrap enough of pmap  to enter the kernel proper */
-   pmap_bootstrap(abp->kern_l1pt, KERNBASE - abp->kern_delta,
-   lastaddr - KERNBASE);
+   pmap_bootstrap(abp->kern_l0pt, abp->kern_l1pt,
+   KERNBASE - abp->kern_delta, lastaddr - KERNBASE);
 
arm_devmap_bootstrap(0, NULL);
 

Modified: head/sys/arm64/arm64/minidump_machdep.c
==
--- head/sys/arm64/arm64/minidump_machdep.c Thu Mar 31 09:55:21 2016
(r297445)
+++ head/sys/arm64/arm64/minidump_machdep.c Thu Mar 31 11:07:24 2016
(r297446)
@@ -218,7 +218,7 @@ blk_write(struct dumperinfo *di, char *p
 int
 minidumpsys(struct dumperinfo *di)
 {
-   pd_entry_t *l1, *l2;
+   pd_entry_t *l0, *l1, *l2;
pt_entry_t *l3;
uint32_t pmapsize;
vm_offset_t va;
@@ -236,7 +236,7 @@ minidumpsys(struct dumperinfo *di)
pmapsize = 0;
for (va = VM_MIN_KERNEL_ADDRESS; va < kernel_vm_end; va += L2_SIZE) {
pmapsize += PAGE_SIZE;
-   if (!pmap_get_tables(pmap_kernel(), va, , , ))
+   if (!pmap_get_tables(pmap_kernel(), va, , , , ))
continue;
 
/* We should always be using the l2 table for kvm */
@@ -335,7 +335,7 @@ minidumpsys(struct dumperinfo *di)
/* Dump kernel page directory pages */
bzero(, sizeof(tmpbuffer));
for (va = VM_MIN_KERNEL_ADDRESS; va < kernel_vm_end; va += L2_SIZE) {
-   if (!pmap_get_tables(pmap_kernel(), va, , , )) {
+   if (!pmap_get_tables(pmap_kernel(), va, , , , )) {
/* We always write a page, even if it is zero */
error = blk_write(di, (char *), 0, PAGE_SIZE);
if (error)

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Thu Mar 31 09:55:21 2016(r297445)
+++ head/sys/arm64/arm64/pmap.c Thu Mar 31 11:07:24 2016(r297446)
@@ -11,7 +11,7 @@
  * All rights reserved.
  * Copyright (c) 2014 Andrew Turner
  * All rights reserved.
- * Copyright (c) 2014 The FreeBSD Foundation
+ * Copyright (c) 2014-2016 The FreeBSD Foundation
  * All rights reserved.
  *
  * This code is derived from software contributed to Berkeley by
@@ -142,9 +142,14 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#defineNPDEPG  (PAGE_SIZE/(sizeof (pd_entry_t)))
-#defineNUPDE   (NPDEPG * NPDEPG)
-#defineNUSERPGTBLS (NUPDE + NPDEPG)
+#defineNL0PG   (PAGE_SIZE/(sizeof (pd_entry_t)))
+#defineNL1PG   (PAGE_SIZE/(sizeof (pd_entry_t)))
+#defineNL2PG   (PAGE_SIZE/(sizeof (pd_entry_t)))
+#defineNL3PG   (PAGE_SIZE/(

svn commit: r297958 - in head/sys/arm64: arm64 include

2016-04-14 Thread Andrew Turner
Author: andrew
Date: Thu Apr 14 10:43:28 2016
New Revision: 297958
URL: https://svnweb.freebsd.org/changeset/base/297958

Log:
  Set the upper limit of the DMAP region to the limit of RAM as was found in
  the physmap. This will reduce the likelihood of an issue where we have
  device memory mapped in the DMAP. This can only happen if it is within the
  same 1G block of normal memory.
  
  Reviewed by:  kib
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D5938

Modified:
  head/sys/arm64/arm64/pmap.c
  head/sys/arm64/include/vmparam.h

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Thu Apr 14 09:10:09 2016(r297957)
+++ head/sys/arm64/arm64/pmap.c Thu Apr 14 10:43:28 2016(r297958)
@@ -221,6 +221,8 @@ struct msgbuf *msgbufp = NULL;
 static struct rwlock_padalign pvh_global_lock;
 
 vm_paddr_t dmap_phys_base; /* The start of the dmap region */
+vm_paddr_t dmap_phys_max;  /* The limit of the dmap region */
+vm_offset_t dmap_max_addr; /* The virtual address limit of the dmap */
 
 /* This code assumes all L1 DMAP entries will be used */
 CTASSERT((DMAP_MIN_ADDRESS  & ~L0_OFFSET) == DMAP_MIN_ADDRESS);
@@ -550,15 +552,15 @@ pmap_early_vtophys(vm_offset_t l1pt, vm_
 }
 
 static void
-pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t kernstart)
+pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t min_pa, vm_paddr_t max_pa)
 {
vm_offset_t va;
vm_paddr_t pa;
u_int l1_slot;
 
-   pa = dmap_phys_base = kernstart & ~L1_OFFSET;
+   pa = dmap_phys_base = min_pa & ~L1_OFFSET;
va = DMAP_MIN_ADDRESS;
-   for (; va < DMAP_MAX_ADDRESS;
+   for (; va < DMAP_MAX_ADDRESS && pa < max_pa;
pa += L1_SIZE, va += L1_SIZE, l1_slot++) {
l1_slot = ((va - DMAP_MIN_ADDRESS) >> L1_SHIFT);
 
@@ -567,6 +569,10 @@ pmap_bootstrap_dmap(vm_offset_t kern_l1,
ATTR_IDX(CACHED_MEMORY) | L1_BLOCK);
}
 
+   /* Set the upper limit of the DMAP region */
+   dmap_phys_max = pa;
+   dmap_max_addr = va;
+
cpu_dcache_wb_range((vm_offset_t)pagetable_dmap,
PAGE_SIZE * DMAP_TABLES);
cpu_tlb_flushID();
@@ -651,7 +657,7 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offs
pt_entry_t *l2;
vm_offset_t va, freemempos;
vm_offset_t dpcpu, msgbufpv;
-   vm_paddr_t pa, min_pa;
+   vm_paddr_t pa, max_pa, min_pa;
int i;
 
kern_delta = KERNBASE - kernstart;
@@ -671,7 +677,7 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offs
rw_init(_global_lock, "pmap pv global");
 
/* Assume the address we were loaded to is a valid physical address */
-   min_pa = KERNBASE - kern_delta;
+   min_pa = max_pa = KERNBASE - kern_delta;
 
/*
 * Find the minimum physical address. physmap is sorted,
@@ -682,11 +688,12 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offs
continue;
if (physmap[i] <= min_pa)
min_pa = physmap[i];
-   break;
+   if (physmap[i + 1] > max_pa)
+   max_pa = physmap[i + 1];
}
 
/* Create a direct map region early so we can use it for pa -> va */
-   pmap_bootstrap_dmap(l1pt, min_pa);
+   pmap_bootstrap_dmap(l1pt, min_pa, max_pa);
 
va = KERNBASE;
pa = KERNBASE - kern_delta;

Modified: head/sys/arm64/include/vmparam.h
==
--- head/sys/arm64/include/vmparam.hThu Apr 14 09:10:09 2016
(r297957)
+++ head/sys/arm64/include/vmparam.hThu Apr 14 10:43:28 2016
(r297958)
@@ -162,19 +162,19 @@
 #defineVM_MIN_KERNEL_ADDRESS   (0xUL)
 #defineVM_MAX_KERNEL_ADDRESS   (0x0080UL)
 
-/* 2TiB for the direct map region */
+/* 2 TiB maximum for the direct map region */
 #defineDMAP_MIN_ADDRESS(0xfd00UL)
 #defineDMAP_MAX_ADDRESS(0xff00UL)
 
 #defineDMAP_MIN_PHYSADDR   (dmap_phys_base)
-#defineDMAP_MAX_PHYSADDR   (dmap_phys_base + (DMAP_MAX_ADDRESS - 
DMAP_MIN_ADDRESS))
+#defineDMAP_MAX_PHYSADDR   (dmap_phys_max)
 
 /* True if pa is in the dmap range */
 #definePHYS_IN_DMAP(pa)((pa) >= DMAP_MIN_PHYSADDR && \
 (pa) < DMAP_MAX_PHYSADDR)
 /* True if va is in the dmap range */
 #defineVIRT_IN_DMAP(va)((va) >= DMAP_MIN_ADDRESS && \
-(va) < DMAP_MAX_ADDRESS)
+(va) < (dmap_max_addr))
 
 #definePHYS_TO_DMAP(pa)
\
 ({ \
@@ -237,6 +237,8 @@
 #ifndef LOCORE
 
 extern vm_paddr_t dmap_phys_base;
+extern vm_paddr_t dmap_phys_max;
+extern 

svn commit: r298586 - head/sys/arm64/include

2016-04-25 Thread Andrew Turner
Author: andrew
Date: Mon Apr 25 17:32:08 2016
New Revision: 298586
URL: https://svnweb.freebsd.org/changeset/base/298586

Log:
  Use the yield instruction in the arm64 cpu_spinwait. This instruction is
  a hint to the hardware the software is not performing a task.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm64/include/cpu.h

Modified: head/sys/arm64/include/cpu.h
==
--- head/sys/arm64/include/cpu.hMon Apr 25 17:06:50 2016
(r298585)
+++ head/sys/arm64/include/cpu.hMon Apr 25 17:32:08 2016
(r298586)
@@ -50,7 +50,7 @@
 
 #definecpu_getstack(td)((td)->td_frame->tf_sp)
 #definecpu_setstack(td, sp)((td)->td_frame->tf_sp = (sp))
-#definecpu_spinwait()  /* nothing */
+#definecpu_spinwait()  __asm __volatile("yield" ::: "memory")
 
 /* Extract CPU affinity levels 0-3 */
 #defineCPU_AFF0(mpidr) (u_int)(((mpidr) >> 0) & 0xff)
___
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: r298741 - head/contrib/jemalloc/include/jemalloc

2016-04-28 Thread Andrew Turner
Author: andrew
Date: Thu Apr 28 12:24:58 2016
New Revision: 298741
URL: https://svnweb.freebsd.org/changeset/base/298741

Log:
  Stop using sbrk(2) with malloc. This helps reduce the number of places
  within the tree where we call this legacy interface.
  
  Reviewed by:  jasone
  Obtained from:brooks
  Sponsored by: ABT Systems Ltd

Modified:
  head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h

Modified: head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h
==
--- head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h   Thu Apr 28 
12:05:07 2016(r298740)
+++ head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h   Thu Apr 28 
12:24:58 2016(r298741)
@@ -8,6 +8,8 @@
 #defineJEMALLOC_DEBUG
 #endif
 
+#undef JEMALLOC_DSS
+
 /*
  * The following are architecture-dependent, so conditionally define them for
  * each supported architecture.
___
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: r298626 - head/bin/csh

2016-04-26 Thread Andrew Turner
Author: andrew
Date: Tue Apr 26 11:39:32 2016
New Revision: 298626
URL: https://svnweb.freebsd.org/changeset/base/298626

Log:
  Stop using sbrk in csh. This is a legacy interface and its use within csh
  is invalid. It is used to find the size of allocated memory. As malloc may
  allocate memory with mmap it will fail to take this memory into account.
  
  Obtained from:brooks

Modified:
  head/bin/csh/config.h

Modified: head/bin/csh/config.h
==
--- head/bin/csh/config.h   Tue Apr 26 11:15:48 2016(r298625)
+++ head/bin/csh/config.h   Tue Apr 26 11:39:32 2016(r298626)
@@ -99,7 +99,7 @@
 #define HAVE_PATHS_H 1
 
 /* Define to 1 if you have the `sbrk' function. */
-#define HAVE_SBRK 1
+/* #undef HAVE_SBRK 1 */
 
 /* Define to 1 if you have the `setpgid' function. */
 #define HAVE_SETPGID 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"


Re: svn commit: r298425 - head/sys/dev/acpica

2016-04-27 Thread Andrew Turner
On Wed, 27 Apr 2016 16:57:28 +0200
Zbigniew Bodek  wrote:

> Hello,
> 
> I'm forwarding a message from Michal Stanek who found some problems
> wit this commit. Please see below:
> 
> ---
> I'm getting a lot of ACPI error messages on ThunderX (arm64). The
> kernel also panics before it gets to prompt.
> Running bisect pointed to this patch as the culprit.
> 
> Removing acpi from GENERIC configuration fixes the issue.

See r298639.

I know the issue, the code is picking up the ofw cpu devices. I'm
expecting to work on ACPI in a few months so will expect to fix this
then (unless someone else gets to it first)

Andrew
___
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: r298637 - head/sys/dev/uart

2016-04-26 Thread Andrew Turner
Author: andrew
Date: Tue Apr 26 13:16:45 2016
New Revision: 298637
URL: https://svnweb.freebsd.org/changeset/base/298637

Log:
  Stop including machine/fdt.h from the fdt uart code, it's unneeded.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/dev/uart/uart_cpu_fdt.c

Modified: head/sys/dev/uart/uart_cpu_fdt.c
==
--- head/sys/dev/uart/uart_cpu_fdt.cTue Apr 26 12:56:44 2016
(r298636)
+++ head/sys/dev/uart/uart_cpu_fdt.cTue Apr 26 13:16:45 2016
(r298637)
@@ -42,9 +42,6 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
-#if !defined(__aarch64__) && !defined(__riscv__)
-#include 
-#endif
 
 #include 
 #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: r298639 - head/sys/arm64/conf

2016-04-26 Thread Andrew Turner
Author: andrew
Date: Tue Apr 26 14:21:39 2016
New Revision: 298639
URL: https://svnweb.freebsd.org/changeset/base/298639

Log:
  Disable ACPI on arm64 ad it has only had minimal testing and is causing
  boot issues when booting with FDT. It is planned to re-enable this at a
  later date.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/conf/GENERIC

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Tue Apr 26 13:22:08 2016(r298638)
+++ head/sys/arm64/conf/GENERIC Tue Apr 26 14:21:39 2016(r298639)
@@ -153,7 +153,7 @@ device  bpf # Berkeley packet filter
 optionsTHUNDERX_PASS_1_1_ERRATA
 
 optionsFDT
-device acpi
+#deviceacpi
 
 # The crypto framework is required by IPSEC
 device crypto  # Required by IPSEC
___
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: r298854 - in head/sys: arm/allwinner arm/arm arm/broadcom/bcm2835 arm/conf arm/freescale/imx arm/include arm/nvidia/tegra124 arm/qemu arm/ti conf

2016-04-30 Thread Andrew Turner
Author: andrew
Date: Sat Apr 30 17:27:33 2016
New Revision: 298854
URL: https://svnweb.freebsd.org/changeset/base/298854

Log:
  Add a MULTIDELAY option to allow the ARM kernel to have multiple DELAY
  implementations. Early in the boot the kernel will use an approximate,
  however after the timer has been probed it will switch to a more accurate
  implementation.
  
  Reviewed by:  manu
  Sponsored by: ABT Systems Ltd
  Differential Revision:https://reviews.freebsd.org/D5762

Modified:
  head/sys/arm/allwinner/allwinner_machdep.c
  head/sys/arm/allwinner/timer.c
  head/sys/arm/arm/generic_timer.c
  head/sys/arm/arm/machdep.c
  head/sys/arm/arm/platform.c
  head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
  head/sys/arm/conf/A10
  head/sys/arm/conf/ALLWINNER
  head/sys/arm/conf/VIRT
  head/sys/arm/freescale/imx/imx51_machdep.c
  head/sys/arm/freescale/imx/imx53_machdep.c
  head/sys/arm/freescale/imx/imx6_machdep.c
  head/sys/arm/include/machdep.h
  head/sys/arm/include/platformvar.h
  head/sys/arm/nvidia/tegra124/tegra124_machdep.c
  head/sys/arm/qemu/virt_machdep.c
  head/sys/arm/ti/ti_machdep.c
  head/sys/conf/options.arm

Modified: head/sys/arm/allwinner/allwinner_machdep.c
==
--- head/sys/arm/allwinner/allwinner_machdep.c  Sat Apr 30 16:01:37 2016
(r298853)
+++ head/sys/arm/allwinner/allwinner_machdep.c  Sat Apr 30 17:27:33 2016
(r298854)
@@ -148,7 +148,7 @@ static platform_method_t a10_methods[] =
 
PLATFORMMETHOD_END,
 };
-FDT_PLATFORM_DEF(a10, "a10", 0, "allwinner,sun4i-a10");
+FDT_PLATFORM_DEF(a10, "a10", 0, "allwinner,sun4i-a10", 200);
 #endif
 
 #if defined(SOC_ALLWINNER_A20)
@@ -163,7 +163,7 @@ static platform_method_t a20_methods[] =
 #endif
PLATFORMMETHOD_END,
 };
-FDT_PLATFORM_DEF(a20, "a20", 0, "allwinner,sun7i-a20");
+FDT_PLATFORM_DEF(a20, "a20", 0, "allwinner,sun7i-a20", 200);
 #endif
 
 #if defined(SOC_ALLWINNER_A31)
@@ -178,7 +178,7 @@ static platform_method_t a31_methods[] =
 #endif
PLATFORMMETHOD_END,
 };
-FDT_PLATFORM_DEF(a31, "a31", 0, "allwinner,sun6i-a31");
+FDT_PLATFORM_DEF(a31, "a31", 0, "allwinner,sun6i-a31", 200);
 #endif
 
 #if defined(SOC_ALLWINNER_A31S)
@@ -193,7 +193,7 @@ static platform_method_t a31s_methods[] 
 #endif
PLATFORMMETHOD_END,
 };
-FDT_PLATFORM_DEF(a31s, "a31s", 0, "allwinner,sun6i-a31s");
+FDT_PLATFORM_DEF(a31s, "a31s", 0, "allwinner,sun6i-a31s", 200);
 #endif
 
 u_int

Modified: head/sys/arm/allwinner/timer.c
==
--- head/sys/arm/allwinner/timer.c  Sat Apr 30 16:01:37 2016
(r298853)
+++ head/sys/arm/allwinner/timer.c  Sat Apr 30 17:27:33 2016
(r298854)
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -100,11 +101,12 @@ static inta10_timer_timer_stop(struct e
 
 static uint64_t timer_read_counter64(void);
 
-static int a10_timer_initialized = 0;
 static int a10_timer_hardclock(void *);
 static int a10_timer_probe(device_t);
 static int a10_timer_attach(device_t);
 
+static delay_func a10_timer_delay;
+
 static struct timecounter a10_timer_timecounter = {
.tc_name   = "a10_timer timer0",
.tc_get_timecount  = a10_timer_get_timecount,
@@ -209,8 +211,10 @@ a10_timer_attach(device_t dev)
sc->et.et_priv = sc;
et_register(>et);
 
-   if (device_get_unit(dev) == 0)
+   if (device_get_unit(dev) == 0) {
+   arm_set_delay(a10_timer_delay, sc);
a10_timer_sc = sc;
+   }
 
a10_timer_timecounter.tc_frequency = sc->timer0_freq;
tc_init(_timer_timecounter);
@@ -224,8 +228,6 @@ a10_timer_attach(device_t dev)
a10_timer_timecounter.tc_frequency);
}
 
-   a10_timer_initialized = 1;
-
return (0);
 }
 
@@ -352,23 +354,15 @@ static devclass_t a10_timer_devclass;
 EARLY_DRIVER_MODULE(a10_timer, simplebus, a10_timer_driver, 
a10_timer_devclass, 0, 0,
 BUS_PASS_TIMER + BUS_PASS_ORDER_MIDDLE);
 
-void
-DELAY(int usec)
+static void
+a10_timer_delay(int usec, void *arg)
 {
-   uint32_t counter;
+   struct a10_timer_softc *sc = arg;
uint64_t end, now;
 
-   if (!a10_timer_initialized) {
-   for (; usec > 0; usec--)
-   for (counter = 50; counter > 0; counter--)
-   cpufunc_nullop();
-   return;
-   }
-
now = timer_read_counter64();
-   end = now + (a10_timer_sc->timer0_freq / 100) * (usec + 1);
+   end = now + (sc->timer0_freq / 100) * (usec + 1);
 
while (now < end)
now = timer_read_counter64();
 }
-

Modified: head/sys/arm/arm/generic_timer.c
==
--- head/sys/arm/arm/generic_timer.cSat Apr 30 16:01:37 2016
(r298853)
+++ 

svn commit: r300300 - head/sys/arm64/arm64

2016-05-20 Thread Andrew Turner
Author: andrew
Date: Fri May 20 13:11:07 2016
New Revision: 300300
URL: https://svnweb.freebsd.org/changeset/base/300300

Log:
  Add more useful GICv3 register definitions. While here fix
  GITS_CBASER_CACHE_MASK to use the correct shift macro.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/gic_v3_reg.h

Modified: head/sys/arm64/arm64/gic_v3_reg.h
==
--- head/sys/arm64/arm64/gic_v3_reg.h   Fri May 20 12:38:48 2016
(r300299)
+++ head/sys/arm64/arm64/gic_v3_reg.h   Fri May 20 13:11:07 2016
(r300300)
@@ -142,6 +142,8 @@
 #defineGICR_PROPBASER_CACHE_NIWAWB 0x5UL
 #defineGICR_PROPBASER_CACHE_NIRAWAWT   0x6UL
 #defineGICR_PROPBASER_CACHE_NIRAWAWB   0x7UL
+#defineGICR_PROPBASER_CACHE_MASK   \
+   (0x7UL << GICR_PROPBASER_CACHE_SHIFT)
 
 /*
  * Shareability
@@ -179,6 +181,8 @@
 #defineGICR_PENDBASER_CACHE_NIWAWB 0x5UL
 #defineGICR_PENDBASER_CACHE_NIRAWAWT   0x6UL
 #defineGICR_PENDBASER_CACHE_NIRAWAWB   0x7UL
+#defineGICR_PENDBASER_CACHE_MASK   \
+   (0x7UL << GICR_PENDBASER_CACHE_SHIFT)
 
 /*
  * Shareability
@@ -217,6 +221,26 @@
 #defineGITS_CTLR   (0x)
 #defineGITS_CTLR_EN(1 << 0)
 
+#defineGITS_IIDR   (0x0004)
+#define GITS_IIDR_PRODUCT_SHIFT24
+#define GITS_IIDR_PRODUCT_MASK (0xff << 
GITS_IIDR_PRODUCT_SHIFT)
+#define GITS_IIDR_VARIANT_SHIFT16
+#define GITS_IIDR_VARIANT_MASK (0xf << GITS_IIDR_VARIANT_SHIFT)
+#define GITS_IIDR_REVISION_SHIFT   12
+#define GITS_IIDR_REVISION_MASK(0xf << 
GITS_IIDR_REVISION_SHIFT)
+#define GITS_IIDR_IMPLEMENTOR_SHIFT0
+#define GITS_IIDR_IMPLEMENTOR_MASK (0xfff << 
GITS_IIDR_IMPLEMENTOR_SHIFT)
+
+#define GITS_IIDR_RAW(impl, prod, var, rev)\
+((prod) << GITS_IIDR_PRODUCT_SHIFT |   \
+ (var) << GITS_IIDR_VARIANT_SHIFT |\
+ (rev) << GITS_IIDR_REVISION_SHIFT |   \
+ (impl) << GITS_IIDR_IMPLEMENTOR_SHIFT)
+
+#define GITS_IIDR_IMPL_CAVIUM  (0x34c)
+#define GITS_IIDR_PROD_THUNDER (0xa1)
+#define GITS_IIDR_VAR_THUNDER_1(0x0)
+
 #defineGITS_CBASER (0x0080)
 #defineGITS_CBASER_VALID   (1UL << 63)
 /*
@@ -239,7 +263,7 @@
 #defineGITS_CBASER_CACHE_NIWAWB0x5UL
 #defineGITS_CBASER_CACHE_NIRAWAWT  0x6UL
 #defineGITS_CBASER_CACHE_NIRAWAWB  0x7UL
-#defineGITS_CBASER_CACHE_MASK  (0x7UL << 
GITS_CBASER_TYPE_SHIFT)
+#defineGITS_CBASER_CACHE_MASK  (0x7UL << 
GITS_CBASER_CACHE_SHIFT)
 /*
  * Shareability
  * 0x0 - Non-shareable
___
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: r300206 - head/sys/arm64/include

2016-05-19 Thread Andrew Turner
On Thu, 19 May 2016 07:22:51 -0700
John Baldwin <j...@freebsd.org> wrote:

> On Thursday, May 19, 2016 02:00:18 PM Andrew Turner wrote:
> > Author: andrew
> > Date: Thu May 19 14:00:18 2016
> > New Revision: 300206
> > URL: https://svnweb.freebsd.org/changeset/base/300206
> > 
> > Log:
> >   Define PCI_RES_BUS for NEW_PCIB
> >   
> >   Obtained from:ABT Systems Ltd
> >   Sponsored by: The FreeBSD Foundation  
> 
> Does it work? :)  You'd need to handle it explicitly in non-ACPI
> Host-PCI bridge drivers.
> 

See https://reviews.freebsd.org/D6453 for the review.

Andrew
___
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: r300290 - in head/sys: arm64/cavium dev/pci

2016-05-20 Thread Andrew Turner
Author: andrew
Date: Fri May 20 08:29:00 2016
New Revision: 300290
URL: https://svnweb.freebsd.org/changeset/base/300290

Log:
  Handle PCI_RES_BUS on the generic and ThunderX PCIe drivers. This has been
  tested on the Pass 1.1 and 2.0 ThunderX machines in the Netperf cluster.
  
  Reviewed by:  jhb
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D6453

Modified:
  head/sys/arm64/cavium/thunder_pcie_pem.c
  head/sys/dev/pci/pci_host_generic.c

Modified: head/sys/arm64/cavium/thunder_pcie_pem.c
==
--- head/sys/arm64/cavium/thunder_pcie_pem.cFri May 20 08:28:11 2016
(r300289)
+++ head/sys/arm64/cavium/thunder_pcie_pem.cFri May 20 08:29:00 2016
(r300290)
@@ -313,6 +313,10 @@ thunder_pem_adjust_resource(device_t dev
struct rman *rm;
 
sc = device_get_softc(dev);
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+   if (type == PCI_RES_BUS)
+   return (pci_domain_adjust_bus(sc->id, child, res, start, end));
+#endif
 
rm = thunder_pem_rman(sc, type);
if (rm == NULL)
@@ -619,6 +623,11 @@ thunder_pem_alloc_resource(device_t dev,
struct resource *res;
device_t parent_dev;
 
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+   if (type == PCI_RES_BUS)
+   return (pci_domain_alloc_bus(sc->id, child, rid, start,  end,
+   count, flags));
+#endif
rm = thunder_pem_rman(sc, type);
if (rm == NULL) {
/* Find parent device. On ThunderX we know an exact path. */
@@ -675,7 +684,12 @@ thunder_pem_release_resource(device_t de
 struct resource *res)
 {
device_t parent_dev;
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+   struct thunder_pem_softc *sc = device_get_softc(dev);
 
+   if (type == PCI_RES_BUS)
+   return (pci_domain_release_bus(sc->id, child, rid, res));
+#endif
/* Find parent device. On ThunderX we know an exact path. */
parent_dev = device_get_parent(device_get_parent(dev));
 

Modified: head/sys/dev/pci/pci_host_generic.c
==
--- head/sys/dev/pci/pci_host_generic.c Fri May 20 08:28:11 2016
(r300289)
+++ head/sys/dev/pci/pci_host_generic.c Fri May 20 08:29:00 2016
(r300290)
@@ -501,7 +501,14 @@ static int
 generic_pcie_release_resource(device_t dev, device_t child, int type,
 int rid, struct resource *res)
 {
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+   struct generic_pcie_softc *sc;
 
+   if (type == PCI_RES_BUS) {
+   sc = device_get_softc(dev);
+   return (pci_domain_release_bus(sc->ecam, child, rid, res));
+   }
+#endif
/* For PCIe devices that do not have FDT nodes, use PCIB method */
if ((int)ofw_bus_get_node(child) <= 0) {
return (generic_pcie_release_resource_pcie(dev,
@@ -517,7 +524,15 @@ struct resource *
 pci_host_generic_alloc_resource(device_t dev, device_t child, int type, int 
*rid,
 rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
 {
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+   struct generic_pcie_softc *sc;
 
+   if (type == PCI_RES_BUS) {
+   sc = device_get_softc(dev);
+   return (pci_domain_alloc_bus(sc->ecam, child, rid, start, end,
+   count, flags));
+   }
+#endif
/* For PCIe devices that do not have FDT nodes, use PCIB method */
if ((int)ofw_bus_get_node(child) <= 0)
return (generic_pcie_alloc_resource_pcie(dev, child, type, rid,
@@ -579,6 +594,11 @@ generic_pcie_adjust_resource(device_t de
struct rman *rm;
 
sc = device_get_softc(dev);
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+   if (type == PCI_RES_BUS)
+   return (pci_domain_adjust_bus(sc->ecam, child, res, start,
+   end));
+#endif
 
rm = generic_pcie_rman(sc, type);
if (rm != 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: r300303 - in head: . contrib/netbsd-tests/lib/libc/gen contrib/netbsd-tests/lib/libc/sys lib/libc/aarch64 lib/libc/aarch64/sys sys/sys

2016-05-20 Thread Andrew Turner
Author: andrew
Date: Fri May 20 15:04:48 2016
New Revision: 300303
URL: https://svnweb.freebsd.org/changeset/base/300303

Log:
  Remove brk and sbrk from arm64. They were defined in The Single UNIX
  Specification, Version 2, but marked as legacy, and have been removed from
  later specifications. After 12 years it is time to remove them from new
  architectures when the main use for sbrk is an invalid method to attempt
  to find how much memory has been allocated from malloc.
  
  There are a few places in the tree that still call sbrk, however they are
  not used on arm64. They will need to be fixed to cross build from arm64,
  but these will be fixed in a follow up commit.
  
  Old copies of binutils from ports called into sbrk, however this has been
  fixed around 6 weeks ago. It is advised to update binutils on arm64 before
  installing a world that includes this change.
  
  Reviewed by:  brooks, emaste
  Obtained from:brooks
  Relnotes: yes
  Sponsored by: ABT Systems Ltd
  Differential Revision:https://reviews.freebsd.org/D6464

Deleted:
  head/lib/libc/aarch64/sys/brk.S
  head/lib/libc/aarch64/sys/sbrk.S
Modified:
  head/UPDATING
  head/contrib/netbsd-tests/lib/libc/gen/t_dir.c
  head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c
  head/lib/libc/aarch64/Symbol.map
  head/lib/libc/aarch64/sys/Makefile.inc
  head/sys/sys/param.h

Modified: head/UPDATING
==
--- head/UPDATING   Fri May 20 15:00:12 2016(r300302)
+++ head/UPDATING   Fri May 20 15:04:48 2016(r300303)
@@ -31,6 +31,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20160520:
+   The brk and sbrk functions have been removed from libc on arm64.
+   Binutils from ports has been updated to not link to these
+   functions and should be updated to the latest version before
+   installing a new libc.
+
 20160517:
The armv6 port now defaults to hard float ABI. Limited support
for running both hardfloat and soft float on the same system

Modified: head/contrib/netbsd-tests/lib/libc/gen/t_dir.c
==
--- head/contrib/netbsd-tests/lib/libc/gen/t_dir.c  Fri May 20 15:00:12 
2016(r300302)
+++ head/contrib/netbsd-tests/lib/libc/gen/t_dir.c  Fri May 20 15:04:48 
2016(r300303)
@@ -111,6 +111,7 @@ ATF_TC_BODY(seekdir_basic, tc)
closedir(dp);
 }
 
+#ifndef __aarch64__ /* There is no sbrk on AArch64 */
 ATF_TC(telldir_leak);
 ATF_TC_HEAD(telldir_leak, tc)
 {
@@ -154,12 +155,15 @@ ATF_TC_BODY(telldir_leak, tc)
(void)printf("OK: used %td bytes\n", (char *)(sbrk(0))-memused);
}
 }
+#endif
 
 ATF_TP_ADD_TCS(tp)
 {
 
ATF_TP_ADD_TC(tp, seekdir_basic);
+#ifndef __aarch64__
ATF_TP_ADD_TC(tp, telldir_leak);
+#endif
 
return atf_no_error();
 }

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c
==
--- head/contrib/netbsd-tests/lib/libc/sys/t_mlock.cFri May 20 15:00:12 
2016(r300302)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_mlock.cFri May 20 15:04:48 
2016(r300303)
@@ -176,7 +176,9 @@ ATF_TC_BODY(mlock_err, tc)
unsigned long vmin = 0;
size_t len = sizeof(vmin);
 #endif
+#ifndef __aarch64__
void *invalid_ptr;
+#endif
int null_errno = ENOMEM;/* error expected for NULL */
 
 #ifdef __FreeBSD__
@@ -212,6 +214,7 @@ ATF_TC_BODY(mlock_err, tc)
errno = 0;
ATF_REQUIRE_ERRNO(EINVAL, munlock((char *)-1, page) == -1);
 
+#ifndef __aarch64__ /* There is no sbrk on AArch64 */
/*
 * Try to create a pointer to an unmapped page - first after current
 * brk will likely do.
@@ -224,6 +227,7 @@ ATF_TC_BODY(mlock_err, tc)
 
errno = 0;
ATF_REQUIRE_ERRNO(ENOMEM, munlock(invalid_ptr, page) == -1);
+#endif
 }
 
 #ifdef __FreeBSD__

Modified: head/lib/libc/aarch64/Symbol.map
==
--- head/lib/libc/aarch64/Symbol.mapFri May 20 15:00:12 2016
(r300302)
+++ head/lib/libc/aarch64/Symbol.mapFri May 20 15:04:48 2016
(r300303)
@@ -28,8 +28,6 @@ FBSD_1.0 {
ntohl;
ntohs;
vfork;
-   brk;
-   sbrk;
makecontext;
 };
 

Modified: head/lib/libc/aarch64/sys/Makefile.inc
==
--- head/lib/libc/aarch64/sys/Makefile.inc  Fri May 20 15:00:12 2016
(r300302)
+++ head/lib/libc/aarch64/sys/Makefile.inc  Fri May 20 15:04:48 2016
(r300303)
@@ -5,10 +5,8 @@ MIASM:=${MIASM:Nfreebsd[467]_*}
 SRCS+= __vdso_gettc.c
 
 #MDASM= ptrace.S
-MDASM= brk.S \
-   

svn commit: r300510 - head/sys/kern

2016-05-23 Thread Andrew Turner
Author: andrew
Date: Mon May 23 15:26:35 2016
New Revision: 300510
URL: https://svnweb.freebsd.org/changeset/base/300510

Log:
  Add the needed hwpmc hooks to subr_intr.c. This is needed for the correct
  operation of hwpmc on, for example, arm64 with intrng.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/subr_intr.c

Modified: head/sys/kern/subr_intr.c
==
--- head/sys/kern/subr_intr.c   Mon May 23 15:11:01 2016(r300509)
+++ head/sys/kern/subr_intr.c   Mon May 23 15:26:35 2016(r300510)
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
 
 #include "opt_acpi.h"
 #include "opt_ddb.h"
+#include "opt_hwpmc_hooks.h"
 #include "opt_platform.h"
 
 #include 
@@ -53,6 +54,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#ifdef HWPMC_HOOKS
+#include 
+#endif
+
 #include 
 #include 
 #include 
@@ -311,6 +316,10 @@ intr_irq_handler(struct trapframe *tf)
irq_root_filter(irq_root_arg);
td->td_intr_frame = oldframe;
critical_exit();
+#ifdef HWPMC_HOOKS
+   if (pmc_hook && (PCPU_GET(curthread)->td_pflags & TDP_CALLCHAIN))
+   pmc_hook(PCPU_GET(curthread), PMC_FN_USER_CALLCHAIN, tf);
+#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: r300206 - head/sys/arm64/include

2016-05-19 Thread Andrew Turner
Author: andrew
Date: Thu May 19 14:00:18 2016
New Revision: 300206
URL: https://svnweb.freebsd.org/changeset/base/300206

Log:
  Define PCI_RES_BUS for NEW_PCIB
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/include/resource.h

Modified: head/sys/arm64/include/resource.h
==
--- head/sys/arm64/include/resource.h   Thu May 19 13:52:12 2016
(r300205)
+++ head/sys/arm64/include/resource.h   Thu May 19 14:00:18 2016
(r300206)
@@ -42,5 +42,8 @@
 #defineSYS_RES_MEMORY  3   /* i/o memory */
 #defineSYS_RES_IOPORT  4   /* i/o ports */
 #defineSYS_RES_GPIO5   /* general purpose i/o */
+#ifdef NEW_PCIB
+#definePCI_RES_BUS 6   /* PCI bus numbers */
+#endif
 
 #endif /* !_MACHINE_RESOURCE_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: r300348 - head

2016-05-23 Thread Andrew Turner
On Mon, 23 May 2016 11:34:00 +0100
Andrew Turner <and...@fubar.geek.nz> wrote:

> On Sat, 21 May 2016 01:32:04 + (UTC)
> Bryan Drewery <bdrew...@freebsd.org> wrote:
> 
> > Author: bdrewery
> > Date: Sat May 21 01:32:04 2016
> > New Revision: 300348
> > URL: https://svnweb.freebsd.org/changeset/base/300348
> > 
> > Log:
> >   Move external toolchain support earlier.
> >   
> >   This is to consolidate external toolchain and
> > WITHOUT_CROSS_COMPILER support. 
> >   Reviewed by:  brooks, bapt
> >   Sponsored by: EMC / Isilon Storage Division
> >   Differential Revision:https://reviews.freebsd.org/D6353
> >   
> 
> This seems to have broken the arm64 build. My guess is the wrong
> linker is being used, but I haven't looked into the issue too far.

The issue is you moved a block that depends on BROKEN_OPTIONS being
defined to before the point we include share/mk/src.opts.mk, the place
it is defined.

Andrew
___
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: r300348 - head

2016-05-23 Thread Andrew Turner
On Sat, 21 May 2016 01:32:04 + (UTC)
Bryan Drewery  wrote:

> Author: bdrewery
> Date: Sat May 21 01:32:04 2016
> New Revision: 300348
> URL: https://svnweb.freebsd.org/changeset/base/300348
> 
> Log:
>   Move external toolchain support earlier.
>   
>   This is to consolidate external toolchain and
> WITHOUT_CROSS_COMPILER support. 
>   Reviewed by:brooks, bapt
>   Sponsored by:   EMC / Isilon Storage Division
>   Differential Revision:  https://reviews.freebsd.org/D6353
> 

This seems to have broken the arm64 build. My guess is the wrong linker
is being used, but I haven't looked into the issue too far.

Andrew

--
>>> stage 4.2: building libraries
--
===> gnu/lib/libssp/libssp_nonshared (obj,all,install)
===> gnu/lib/libgcc (obj,all,install)
===> lib/libcompiler_rt (obj,all,install)
===> gnu/lib/csu (obj,all,install)
===> lib/csu (obj,all,install)
===> lib/libcompiler_rt (obj,all,install)
===> lib/libc (obj,all,install)
===> lib/libc_nonshared (obj,all,install)
===> lib/csu/aarch64 (obj)
===> lib/csu/aarch64 (all)
===> lib/csu/aarch64 (install)
/scratch/tmp/andrew/obj/arm64.aarch64/scratch/tmp/andrew/head-git/tmp/usr/lib/crti.o:
 file not recognized: File format not recognized
cc: error: linker command failed with exit code 1 (use -v to see invocation)
--- libc.so.7.full ---
*** [libc.so.7.full] Error code 1

make[4]: stopped in /scratch/tmp/andrew/head-git/lib/libc
1 error

make[4]: stopped in /scratch/tmp/andrew/head-git/lib/libc
--- lib/libc__L ---
*** [lib/libc__L] Error code 2

make[3]: stopped in /scratch/tmp/andrew/head-git
1 error

make[3]: stopped in /scratch/tmp/andrew/head-git
--- libraries ---
*** [libraries] Error code 2

make[2]: stopped in /scratch/tmp/andrew/head-git
___
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: r300604 - head/sys/kern

2016-05-24 Thread Andrew Turner
Author: andrew
Date: Tue May 24 12:06:56 2016
New Revision: 300604
URL: https://svnweb.freebsd.org/changeset/base/300604

Log:
  Limit calling pmc_hook to when the interrupt comes while running userspace.
  We may enable interrupts from within the callback, e.g. in a data abort
  during copyin. If we receive an interrupt at that time pmc_hook will be
  called again and, as it is handling userspace stack tracing, will hit a
  KASSERT as it checks if the trapframe is from userland.
  
  With this I can run hwpmc with intrng on a ThunderX and have it trace all
  CPUs.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/subr_intr.c

Modified: head/sys/kern/subr_intr.c
==
--- head/sys/kern/subr_intr.c   Tue May 24 11:47:14 2016(r300603)
+++ head/sys/kern/subr_intr.c   Tue May 24 12:06:56 2016(r300604)
@@ -317,7 +317,8 @@ intr_irq_handler(struct trapframe *tf)
td->td_intr_frame = oldframe;
critical_exit();
 #ifdef HWPMC_HOOKS
-   if (pmc_hook && (PCPU_GET(curthread)->td_pflags & TDP_CALLCHAIN))
+   if (pmc_hook && TRAPF_USERMODE(tf) &&
+   (PCPU_GET(curthread)->td_pflags & TDP_CALLCHAIN))
pmc_hook(PCPU_GET(curthread), PMC_FN_USER_CALLCHAIN, tf);
 #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: r300611 - head/sys/cddl/dev/dtrace/aarch64

2016-05-24 Thread Andrew Turner
Author: andrew
Date: Tue May 24 13:57:23 2016
New Revision: 300611
URL: https://svnweb.freebsd.org/changeset/base/300611

Log:
  Mark all memory before the kernel as toxic to DTrace.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c

Modified: head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c
==
--- head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c  Tue May 24 12:40:03 
2016(r300610)
+++ head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c  Tue May 24 13:57:23 
2016(r300611)
@@ -120,7 +120,7 @@ void
 dtrace_toxic_ranges(void (*func)(uintptr_t base, uintptr_t limit))
 {
 
-   printf("IMPLEMENT ME: dtrace_toxic_ranges\n");
+   (*func)(0, (uintptr_t)VM_MIN_KERNEL_ADDRESS);
 }
 
 void
___
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: r300406 - head/lib/csu/aarch64

2016-05-22 Thread Andrew Turner
Author: andrew
Date: Sun May 22 08:20:30 2016
New Revision: 300406
URL: https://svnweb.freebsd.org/changeset/base/300406

Log:
  Stop dereferencing _end in crt1.c. This was only needed for brk/sbrk so is
  no longer needed.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/lib/csu/aarch64/crt1.c

Modified: head/lib/csu/aarch64/crt1.c
==
--- head/lib/csu/aarch64/crt1.c Sun May 22 07:50:10 2016(r300405)
+++ head/lib/csu/aarch64/crt1.c Sun May 22 08:20:30 2016(r300406)
@@ -71,17 +71,8 @@ __start(int argc, char *argv[], char *en
 
if (&_DYNAMIC != NULL)
atexit(cleanup);
-   else {
-   /*
-* Hack to resolve _end so we read the correct symbol.
-* Without this it will resolve to the copy in the library
-* that firsts requests it. We should fix the toolchain,
-* however this is is needed until this can take place.
-*/
-   *(volatile long *)&_end;
-
+   else
_init_tls();
-   }
 
 #ifdef GCRT
atexit(_mcleanup);
___
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: r300308 - head/sys/arm64/arm64

2016-05-20 Thread Andrew Turner
Author: andrew
Date: Fri May 20 15:43:51 2016
New Revision: 300308
URL: https://svnweb.freebsd.org/changeset/base/300308

Log:
  Extract the correct bits from the GICD_TYPER register. The interrupt count
  is encoded in the bottom 5 bits.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/gic_v3_reg.h

Modified: head/sys/arm64/arm64/gic_v3_reg.h
==
--- head/sys/arm64/arm64/gic_v3_reg.h   Fri May 20 15:41:05 2016
(r300307)
+++ head/sys/arm64/arm64/gic_v3_reg.h   Fri May 20 15:43:51 2016
(r300308)
@@ -67,7 +67,7 @@
 
 #defineGICD_TYPER  (0x0004)
 #defineGICD_TYPER_IDBITS(n)n) >> 19) & 0x1F) + 1)
-#defineGICD_TYPER_I_NUM(n) n) & 0xF1) + 1) * 32)
+#defineGICD_TYPER_I_NUM(n) n) & 0x1F) + 1) * 32)
 
 #defineGICD_ISENABLER(n)   (0x0100 + (((n) >> 5) * 4))
 #defineGICD_I_PER_ISENABLERn   (32)
___
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: r299683 - in head/sys/arm64: arm64 include

2016-05-20 Thread Andrew Turner
On Fri, 20 May 2016 11:44:44 +0200
Wojciech Macek  wrote:

> Where can I find any details about how was this change tested or
> reviewed? Apparently it breaks AHCI on armv8. Log below.
> 
> Wojtek
> 
> 
> mountroot> ufs:/dev/ada0s2
> > Trying to mount root from ufs:/dev/ada0s2 []...
> > warning: no time-of-day clock registered, system time will not be
> > set accurately
> > Setting hostuuid: 701a2acc-d0a0-11e5-8550-001517169365.
> > Setting hostid: 0x2abffeca.
> > No suitable dump device was found.
> > Starting file system checks:
> > /dev/ada0s2: FILE SYSTEM CLEAN; SKIPPING CHECKS
> > /dev/ada0s2: clean, 16575173 free (25325 frags, 2068731 blocks, 0.1%
> > fragmentation)
> > panic: unsupported combination of sync operations: 0x0008  

How were you getting into dma_dcache_sync? That should only happen when
map->sync_count != 0, this should only be possible when the BF_COHERENT
flag is set. This flag should never get set.

Andrew
___
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: r300299 - head/sys/arm64/arm64

2016-05-20 Thread Andrew Turner
Author: andrew
Date: Fri May 20 12:38:48 2016
New Revision: 300299
URL: https://svnweb.freebsd.org/changeset/base/300299

Log:
  Filter out BUS_DMASYNC_POSTWRITE sync operations, there is nothing for us
  to do on these.
  
  Reported by:  wma
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/busdma_bounce.c

Modified: head/sys/arm64/arm64/busdma_bounce.c
==
--- head/sys/arm64/arm64/busdma_bounce.cFri May 20 12:17:40 2016
(r300298)
+++ head/sys/arm64/arm64/busdma_bounce.cFri May 20 12:38:48 2016
(r300299)
@@ -955,6 +955,9 @@ bounce_bus_dmamap_sync(bus_dma_tag_t dma
struct sync_list *sl, *end;
vm_offset_t datavaddr, tempvaddr;
 
+   if (op == BUS_DMASYNC_POSTWRITE)
+   return;
+
if ((op & BUS_DMASYNC_POSTREAD) != 0) {
/*
 * Wait for any DMA operations to complete before the bcopy.
___
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: r300291 - head/sys/arm64/conf

2016-05-20 Thread Andrew Turner
Author: andrew
Date: Fri May 20 08:43:18 2016
New Revision: 300291
URL: https://svnweb.freebsd.org/changeset/base/300291

Log:
  Enable NEW_PCIB on arm64.
  
  Obtained from:ABT Systems Ltd
  Relnotes: yes
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/conf/DEFAULTS

Modified: head/sys/arm64/conf/DEFAULTS
==
--- head/sys/arm64/conf/DEFAULTSFri May 20 08:29:00 2016
(r300290)
+++ head/sys/arm64/conf/DEFAULTSFri May 20 08:43:18 2016
(r300291)
@@ -12,3 +12,4 @@ devicemem # Memory and kernel 
memory 
 optionsGEOM_PART_BSD
 optionsGEOM_PART_MBR
 
+optionsNEW_PCIB
___
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: r299457 - head/sys/arm64/arm64

2016-05-11 Thread Andrew Turner
Author: andrew
Date: Wed May 11 14:59:54 2016
New Revision: 299457
URL: https://svnweb.freebsd.org/changeset/base/299457

Log:
  Add data barriers to the arm64 bus_dmamap_sync function. We need these
  to ensure ordering between the CPU and device. As the CPU and DMA target
  may be in different shareability domains they need to be full system
  barriers.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/busdma_bounce.c

Modified: head/sys/arm64/arm64/busdma_bounce.c
==
--- head/sys/arm64/arm64/busdma_bounce.cWed May 11 14:38:27 2016
(r299456)
+++ head/sys/arm64/arm64/busdma_bounce.cWed May 11 14:59:54 2016
(r299457)
@@ -770,8 +770,11 @@ bounce_bus_dmamap_sync(bus_dma_tag_t dma
struct bounce_page *bpage;
vm_offset_t datavaddr, tempvaddr;
 
-   if (map == NULL || (bpage = STAILQ_FIRST(>bpages)) == NULL)
+   if (map == NULL || (bpage = STAILQ_FIRST(>bpages)) == NULL) {
+   /* Wait for any memory access to complete */
+   dsb(sy);
return;
+   }
 
/*
 * XXX ARM64TODO:
@@ -801,9 +804,19 @@ bounce_bus_dmamap_sync(bus_dma_tag_t dma
bpage = STAILQ_NEXT(bpage, links);
}
dmat->bounce_zone->total_bounced++;
+
+   /*
+* Wait for the bcopy to complete before any DMA operations.
+*/
+   dsb(sy);
}
 
if ((op & BUS_DMASYNC_POSTREAD) != 0) {
+   /*
+* Wait for any DMA operations to complete before the bcopy.
+*/
+   dsb(sy);
+
while (bpage != NULL) {
tempvaddr = 0;
datavaddr = bpage->datavaddr;
___
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: r299463 - head/sys/arm64/arm64

2016-05-11 Thread Andrew Turner
Author: andrew
Date: Wed May 11 16:53:41 2016
New Revision: 299463
URL: https://svnweb.freebsd.org/changeset/base/299463

Log:
  On arm64 always create a bus_dmamap_t object. This will be use to hold the
  list of memory that the kernel will need to sync when operating with a
  non-cache coherent DMA engine.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/busdma_bounce.c

Modified: head/sys/arm64/arm64/busdma_bounce.c
==
--- head/sys/arm64/arm64/busdma_bounce.cWed May 11 16:45:58 2016
(r299462)
+++ head/sys/arm64/arm64/busdma_bounce.cWed May 11 16:53:41 2016
(r299463)
@@ -122,11 +122,13 @@ struct bus_dmamap {
bus_dmamap_callback_t *callback;
void  *callback_arg;
STAILQ_ENTRY(bus_dmamap) links;
+   u_int   flags;
+#defineDMAMAP_COULD_BOUNCE (1 << 0)
+#defineDMAMAP_FROM_DMAMEM  (1 << 1)
 };
 
 static STAILQ_HEAD(, bus_dmamap) bounce_map_waitinglist;
 static STAILQ_HEAD(, bus_dmamap) bounce_map_callbacklist;
-static struct bus_dmamap nobounce_dmamap;
 
 static void init_bounce_pages(void *dummy);
 static int alloc_bounce_zone(bus_dma_tag_t dmat);
@@ -248,6 +250,21 @@ out:
return (error);
 }
 
+static bus_dmamap_t
+alloc_dmamap(int flags)
+{
+   bus_dmamap_t map;
+
+   map = malloc(sizeof(*map), M_DEVBUF, flags | M_ZERO);
+   if (map == NULL)
+   return (NULL);
+
+   /* Initialize the new map */
+   STAILQ_INIT(>bpages);
+
+   return (map);
+}
+
 /*
  * Allocate a handle for mapping from kva/uva/physical
  * address space into bus device space.
@@ -271,6 +288,13 @@ bounce_bus_dmamap_create(bus_dma_tag_t d
}
}
 
+   *mapp = alloc_dmamap(M_NOWAIT);
+   if (*mapp == NULL) {
+   CTR3(KTR_BUSDMA, "%s: tag %p error %d",
+   __func__, dmat, ENOMEM);
+   return (ENOMEM);
+   }
+
/*
 * Bouncing might be required if the driver asks for an active
 * exclusion region, a data alignment that is stricter than 1, and/or
@@ -279,21 +303,14 @@ bounce_bus_dmamap_create(bus_dma_tag_t d
if (dmat->bounce_flags & BUS_DMA_COULD_BOUNCE) {
/* Must bounce */
if (dmat->bounce_zone == NULL) {
-   if ((error = alloc_bounce_zone(dmat)) != 0)
+   if ((error = alloc_bounce_zone(dmat)) != 0) {
+   free(*mapp, M_DEVBUF);
return (error);
+   }
}
bz = dmat->bounce_zone;
 
-   *mapp = (bus_dmamap_t)malloc(sizeof(**mapp), M_DEVBUF,
-   M_NOWAIT | M_ZERO);
-   if (*mapp == NULL) {
-   CTR3(KTR_BUSDMA, "%s: tag %p error %d",
-   __func__, dmat, ENOMEM);
-   return (ENOMEM);
-   }
-
-   /* Initialize the new map */
-   STAILQ_INIT(&((*mapp)->bpages));
+   (*mapp)->flags = DMAMAP_COULD_BOUNCE;
 
/*
 * Attempt to add pages to our pool on a per-instance
@@ -321,11 +338,11 @@ bounce_bus_dmamap_create(bus_dma_tag_t d
error = 0;
}
bz->map_count++;
-   } else {
-   *mapp = NULL;
}
if (error == 0)
dmat->map_count++;
+   else
+   free(*mapp, M_DEVBUF);
CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d",
__func__, dmat, dmat->common.flags, error);
return (error);
@@ -339,16 +356,20 @@ static int
 bounce_bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map)
 {
 
-   if (map != NULL && map != _dmamap) {
-   if (STAILQ_FIRST(>bpages) != NULL) {
-   CTR3(KTR_BUSDMA, "%s: tag %p error %d",
-   __func__, dmat, EBUSY);
-   return (EBUSY);
-   }
-   if (dmat->bounce_zone)
-   dmat->bounce_zone->map_count--;
-   free(map, M_DEVBUF);
+   /* Check we are destroying the correct map type */
+   if ((map->flags & DMAMAP_FROM_DMAMEM) != 0)
+   panic("bounce_bus_dmamap_destroy: Invalid map freed\n");
+
+   if (STAILQ_FIRST(>bpages) != NULL) {
+   CTR3(KTR_BUSDMA, "%s: tag %p error %d", __func__, dmat, EBUSY);
+   return (EBUSY);
+   }
+   if (dmat->bounce_zone) {
+   KASSERT((map->flags & DMAMAP_COULD_BOUNCE) != 0,
+   ("%s: Bounce zone when cannot bounce", __func__));
+   dmat->bounce_zone->map_count--;
}
+   free(map, M_DEVBUF);
dmat->map_count--;
CTR2(KTR_BUSDMA, "%s: tag %p error 0", __func__, 

svn commit: r299467 - in head: share/man/man9 sys/dev/pci

2016-05-11 Thread Andrew Turner
Author: andrew
Date: Wed May 11 17:07:29 2016
New Revision: 299467
URL: https://svnweb.freebsd.org/changeset/base/299467

Log:
  Add a new get_id interface to pci and pcib. This will allow us to both
  detect failures, and get different PCI IDs.
  
  For the former the interface returns an int to signal an error. The ID is
  returned at a uintptr_t * argument.
  
  For the latter there is a type argument that allows selecting the ID type.
  This only specifies a single type, however a MSI type will be added
  to handle the need to find the ID the hardware passes to the ARM GICv3
  interrupt controller.
  
  A follow up commit will be made to remove pci_get_rid.
  
  Reviewed by:  jhb, rstone
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D6239

Modified:
  head/share/man/man9/Makefile
  head/share/man/man9/pci.9
  head/sys/dev/pci/pci.c
  head/sys/dev/pci/pci_if.m
  head/sys/dev/pci/pci_pci.c
  head/sys/dev/pci/pcib_if.m
  head/sys/dev/pci/pcib_private.h
  head/sys/dev/pci/pcib_support.c
  head/sys/dev/pci/pcivar.h

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileWed May 11 17:06:03 2016
(r299466)
+++ head/share/man/man9/MakefileWed May 11 17:07:29 2016
(r299467)
@@ -1290,6 +1290,7 @@ MLINKS+=pci.9 pci_alloc_msi.9 \
pci.9 pci_find_extcap.9 \
pci.9 pci_find_htcap.9 \
pci.9 pci_find_pcie_root_port.9 \
+   pci.9 pci_get_id.9 \
pci.9 pci_get_max_read_req.9 \
pci.9 pci_get_powerstate.9 \
pci.9 pci_get_vpd_ident.9 \

Modified: head/share/man/man9/pci.9
==
--- head/share/man/man9/pci.9   Wed May 11 17:06:03 2016(r299466)
+++ head/share/man/man9/pci.9   Wed May 11 17:07:29 2016(r299467)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 23, 2015
+.Dd May 11, 2016
 .Dt PCI 9
 .Os
 .Sh NAME
@@ -43,6 +43,7 @@
 .Nm pci_find_extcap ,
 .Nm pci_find_htcap ,
 .Nm pci_find_pcie_root_port ,
+.Nm pci_get_id ,
 .Nm pci_get_max_read_req ,
 .Nm pci_get_powerstate ,
 .Nm pci_get_vpd_ident ,
@@ -97,6 +98,8 @@
 .Ft device_t
 .Fn pci_find_pcie_root_port "device_t dev"
 .Ft int
+.Fn pci_get_id "device_t dev" "enum pci_id_type type" "uintptr_t *id"
+.Ft int
 .Fn pci_get_max_read_req "device_t dev"
 .Ft int
 .Fn pci_get_powerstate "device_t dev"
@@ -357,6 +360,18 @@ returns
 .Dv NULL .
 .Pp
 The
+.Fn pci_get_id
+function is used to read an identifier from a device.
+The
+.Fa type
+flag is used to specify which identifier to read.
+The following flags are supported:
+.Bl -hang -width ".Dv PCI_ID_RID"
+.It Dv PCI_ID_RID
+Read the routing identifier for the device.
+.El
+.Pp
+The
 .Fn pci_get_vpd_ident
 function is used to fetch a device's Vital Product Data
 .Pq VPD

Modified: head/sys/dev/pci/pci.c
==
--- head/sys/dev/pci/pci.c  Wed May 11 17:06:03 2016(r299466)
+++ head/sys/dev/pci/pci.c  Wed May 11 17:07:29 2016(r299467)
@@ -122,7 +122,8 @@ static void pci_resume_msix(device_t de
 static int pci_remap_intr_method(device_t bus, device_t dev,
u_int irq);
 
-static uint16_tpci_get_rid_method(device_t dev, device_t 
child);
+static int pci_get_id_method(device_t dev, device_t child,
+   enum pci_id_type type, uintptr_t *rid);
 
 static struct pci_devinfo * pci_fill_devinfo(device_t pcib, device_t bus, int 
d,
 int b, int s, int f, uint16_t vid, uint16_t did);
@@ -190,7 +191,7 @@ static device_method_t pci_methods[] = {
DEVMETHOD(pci_msix_count,   pci_msix_count_method),
DEVMETHOD(pci_msix_pba_bar, pci_msix_pba_bar_method),
DEVMETHOD(pci_msix_table_bar,   pci_msix_table_bar_method),
-   DEVMETHOD(pci_get_rid,  pci_get_rid_method),
+   DEVMETHOD(pci_get_id,   pci_get_id_method),
DEVMETHOD(pci_alloc_devinfo,pci_alloc_devinfo_method),
DEVMETHOD(pci_child_added,  pci_child_added_method),
 #ifdef PCI_IOV
@@ -5823,11 +5824,12 @@ pci_restore_state(device_t dev)
pci_cfg_restore(dev, dinfo);
 }
 
-static uint16_t
-pci_get_rid_method(device_t dev, device_t child)
+static int
+pci_get_id_method(device_t dev, device_t child, enum pci_id_type type,
+uintptr_t *id)
 {
 
-   return (PCIB_GET_RID(device_get_parent(dev), child));
+   return (PCIB_GET_ID(device_get_parent(dev), child, type, id));
 }
 
 /* Find the upstream port of a given PCI device in a root complex. */

Modified: head/sys/dev/pci/pci_if.m
==
--- head/sys/dev/pci/pci_if.m   Wed May 11 17:06:03 2016(r299466)
+++ head/sys/dev/pci/pci_if.m   

svn commit: r299535 - head/sys/arm64/arm64

2016-05-12 Thread Andrew Turner
Author: andrew
Date: Thu May 12 15:24:36 2016
New Revision: 299535
URL: https://svnweb.freebsd.org/changeset/base/299535

Log:
  Rename the internal BUC_DMA_* flags to BF_* so they won't conflict with
  the flags in sys/bus_dma.h.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/busdma_bounce.c

Modified: head/sys/arm64/arm64/busdma_bounce.c
==
--- head/sys/arm64/arm64/busdma_bounce.cThu May 12 15:18:36 2016
(r299534)
+++ head/sys/arm64/arm64/busdma_bounce.cThu May 12 15:24:36 2016
(r299535)
@@ -59,9 +59,9 @@ __FBSDID("$FreeBSD$");
 #define MAX_BPAGES 4096
 
 enum {
-   BUS_DMA_COULD_BOUNCE= 0x01,
-   BUS_DMA_MIN_ALLOC_COMP  = 0x02,
-   BUS_DMA_KMEM_ALLOC  = 0x04,
+   BF_COULD_BOUNCE = 0x01,
+   BF_MIN_ALLOC_COMP   = 0x02,
+   BF_KMEM_ALLOC   = 0x04,
 };
 
 struct bounce_zone;
@@ -172,14 +172,14 @@ bounce_bus_dma_tag_create(bus_dma_tag_t 
newtag->segments = NULL;
 
if (parent != NULL && ((newtag->common.filter != NULL) ||
-   ((parent->bounce_flags & BUS_DMA_COULD_BOUNCE) != 0)))
-   newtag->bounce_flags |= BUS_DMA_COULD_BOUNCE;
+   ((parent->bounce_flags & BF_COULD_BOUNCE) != 0)))
+   newtag->bounce_flags |= BF_COULD_BOUNCE;
 
if (newtag->common.lowaddr < ptoa((vm_paddr_t)Maxmem) ||
newtag->common.alignment > 1)
-   newtag->bounce_flags |= BUS_DMA_COULD_BOUNCE;
+   newtag->bounce_flags |= BF_COULD_BOUNCE;
 
-   if (((newtag->bounce_flags & BUS_DMA_COULD_BOUNCE) != 0) &&
+   if (((newtag->bounce_flags & BF_COULD_BOUNCE) != 0) &&
(flags & BUS_DMA_ALLOCNOW) != 0) {
struct bounce_zone *bz;
 
@@ -200,7 +200,7 @@ bounce_bus_dma_tag_create(bus_dma_tag_t 
error = ENOMEM;
}
/* Performed initial allocation */
-   newtag->bounce_flags |= BUS_DMA_MIN_ALLOC_COMP;
+   newtag->bounce_flags |= BF_MIN_ALLOC_COMP;
} else
error = 0;
 
@@ -300,7 +300,7 @@ bounce_bus_dmamap_create(bus_dma_tag_t d
 * exclusion region, a data alignment that is stricter than 1, and/or
 * an active address boundary.
 */
-   if (dmat->bounce_flags & BUS_DMA_COULD_BOUNCE) {
+   if (dmat->bounce_flags & BF_COULD_BOUNCE) {
/* Must bounce */
if (dmat->bounce_zone == NULL) {
if ((error = alloc_bounce_zone(dmat)) != 0) {
@@ -321,18 +321,18 @@ bounce_bus_dmamap_create(bus_dma_tag_t d
else
maxpages = MIN(MAX_BPAGES, Maxmem -
atop(dmat->common.lowaddr));
-   if ((dmat->bounce_flags & BUS_DMA_MIN_ALLOC_COMP) == 0 ||
+   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 = MIN(maxpages - bz->total_bpages, pages);
pages = MAX(pages, 1);
if (alloc_bounce_pages(dmat, pages) < pages)
error = ENOMEM;
-   if ((dmat->bounce_flags & BUS_DMA_MIN_ALLOC_COMP)
+   if ((dmat->bounce_flags & BF_MIN_ALLOC_COMP)
== 0) {
if (error == 0) {
dmat->bounce_flags |=
-   BUS_DMA_MIN_ALLOC_COMP;
+   BF_MIN_ALLOC_COMP;
}
} else
error = 0;
@@ -450,13 +450,13 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dm
*vaddr = (void *)kmem_alloc_attr(kernel_arena,
dmat->common.maxsize, mflags, 0ul, dmat->common.lowaddr,
attr);
-   dmat->bounce_flags |= BUS_DMA_KMEM_ALLOC;
+   dmat->bounce_flags |= BF_KMEM_ALLOC;
} else {
*vaddr = (void *)kmem_alloc_contig(kernel_arena,
dmat->common.maxsize, mflags, 0ul, dmat->common.lowaddr,
dmat->common.alignment != 0 ? dmat->common.alignment : 1ul,
dmat->common.boundary, attr);
-   dmat->bounce_flags |= BUS_DMA_KMEM_ALLOC;
+   dmat->bounce_flags |= BF_KMEM_ALLOC;
}
if (*vaddr == NULL) {
CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d",
@@ -482,12 +482,12 @@ bounce_bus_dmamem_free(bus_dma_tag_t dma
 
/*
 * Check the map came from bounce_bus_dmamem_alloc, so the map
-* should be NULL and the BUS_DMA_KMEM_ALLOC flag cleared if 

Re: svn commit: r299944 - in head/sys: arm64/arm64 conf

2016-05-17 Thread Andrew Turner
On Mon, 16 May 2016 18:08:49 +0200
Zbigniew Bodek <z...@semihalf.com> wrote:

> Hello Andrew,
> 
> I think committing this code should be preceded by at least brief
> review. Few remarks to the code found on the first glance below.

See below for comments.

> 
> Kind regards
> zbb
> 
> 2016-05-16 16:07 GMT+02:00 Andrew Turner <and...@freebsd.org>:
> 
> > Author: andrew
> > Date: Mon May 16 14:07:43 2016
> > New Revision: 299944
> > URL: https://svnweb.freebsd.org/changeset/base/299944
> >
> > Log:
> >   Add intrng support to the GICv3 driver. It lacks ITS support so
> > won't handle
> >   MSI or MSI-X interrupts, however this is enought to boot FreeBSD
> > under the
> >   ARM Foundation Model with a GICv3 interrupt controller.
> >
> >   Approved by:  ABT Systems Ltd
> >   Relnotes: yes
> >   Sponsored by: The FreeBSD Foundation
...
> > +#ifdef INTRNG
> > +int
> > +arm_gic_v3_intr(void *arg)
> > +{
> > +   struct gic_v3_softc *sc = arg;
> > +   struct gic_v3_irqsrc *gi;
> > +   uint64_t active_irq;
> > +   struct trapframe *tf;
> > +   bool first;
> > +
> > +   first = true;
> > +
> > +   while (1) {
> > +   if (CPU_MATCH_ERRATA_CAVIUM_THUNDER_1_1) {
> > +   /*
> > +* Hardware:Cavium ThunderX
> > +* Chip revision:   Pass 1.0 (early
> > version)
> > +*  Pass 1.1
> > (production)
> > +* ERRATUM: 22978, 23154
> > +*/
> > +   __asm __volatile(
> > +   "nop;nop;nop;nop;nop;nop;nop;nop;   \n"
> > +   "mrs %0, ICC_IAR1_EL1   \n"
> > +   "nop;nop;nop;nop;   \n"
> > +   "dsb sy \n"
> > +   : "=" (active_irq));
> > +   } else {
> > +   active_irq = gic_icc_read(IAR1);
> > +   }
> > +
> > +   if (__predict_false(active_irq >= sc->gic_nirqs))
> > +   return (FILTER_HANDLED);
> >  
> 
> IMHO this is not true. Active IRQ could be much bigger than number of
> supported IRQs. We are asking for debugging in the future when we
> enable ITS.

It is correct, the ITS change to this file is missing so we are unable
to enable ITS interrupts.

...
> > +
> > +#ifdef FDT
> > +static int
> > +gic_map_fdt(device_t dev, u_int ncells, pcell_t *cells, u_int
> > *irqp,
> > +enum intr_polarity *polp, enum intr_trigger *trigp)
> >  
> 
> All other functions are called gic_v3 and this one is just gic_
> Why can't we move as much FDT code to the dedicated file which is
> gic_v3_fdt.c?

Unfortunately due to the current code in subr_intr.c this is needed for
simplicity. It it my understanding there is work to fix this, so for
now I would prefer to keep this.

...
> > +   /* Set the trigger and polarity */
> > +   if (irq <= GIC_LAST_PPI)
> > +   reg = gic_r_read(sc, 4,
> > +   GICR_SGI_BASE_SIZE + GICD_ICFGR(irq));
> > +   else
> > +   reg = gic_d_read(sc, 4, GICD_ICFGR(irq));
> > +   if (trig == INTR_TRIGGER_LEVEL)
> > +   reg &= ~(2 << ((irq % 16) * 2));
> > +   else
> > +   reg |= 2 << ((irq % 16) * 2);
> >  
> 
> The rule of not using magic numbers does not apply here ;-) ?

This is partially why this is still disabled by default, the code still
needs a little polish, however it will be needed to help with a future
review for changes to subr_intr.c.

...
> > +static void
> > +gic_v3_disable_intr(device_t dev, struct intr_irqsrc *isrc)
> > +{
> > +   struct gic_v3_softc *sc;
> > +   struct gic_v3_irqsrc *gi;
> > +   u_int irq;
> > +
> > +   sc = device_get_softc(dev);
> > +   gi = (struct gic_v3_irqsrc *)isrc;
> > +   irq = gi->gi_irq;
> > +
> > +   if (irq <= GIC_LAST_PPI) {
> > +   /* SGIs and PPIs in corresponding Re-Distributor */
> > +   gic_r_write(sc, 4, GICR_SGI_BASE_SIZE +
> > GICD_ICENABLER(irq),
> > +   GICD_I_MASK(irq));
> > +   gic_

svn commit: r300048 - head/sys/arm64/arm64

2016-05-17 Thread Andrew Turner
Author: andrew
Date: Tue May 17 12:46:50 2016
New Revision: 300048
URL: https://svnweb.freebsd.org/changeset/base/300048

Log:
  Clean up the GICv3 intrng code:
   * In gic_v3_attach free the correct data on failure.
   * Implement gic_v3_teardown_intr.
   * Update the panic string when enabling/disabling an invalid interrupt.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/gic_v3.c

Modified: head/sys/arm64/arm64/gic_v3.c
==
--- head/sys/arm64/arm64/gic_v3.c   Tue May 17 12:04:39 2016
(r300047)
+++ head/sys/arm64/arm64/gic_v3.c   Tue May 17 12:46:50 2016
(r300048)
@@ -267,7 +267,7 @@ gic_v3_attach(device_t dev)
}
if (err != 0) {
/* XXX call intr_isrc_deregister() */
-   free(irqs, M_DEVBUF);
+   free(sc->gic_irqs, M_DEVBUF);
return (err);
}
}
@@ -611,8 +611,14 @@ static int
 gic_v3_teardown_intr(device_t dev, struct intr_irqsrc *isrc,
 struct resource *res, struct intr_map_data *data)
 {
+   struct gic_v3_irqsrc *gi = (struct gic_v3_irqsrc *)isrc;
+
+   if (isrc->isrc_handlers == 0) {
+   gi->gi_pol = INTR_POLARITY_CONFORM;
+   gi->gi_trig = INTR_TRIGGER_CONFORM;
+   }
 
-   panic("gic_v3_teardown_intr");
+   return (0);
 }
 
 static void
@@ -636,7 +642,7 @@ gic_v3_disable_intr(device_t dev, struct
gic_d_write(sc, 4, GICD_ICENABLER(irq), GICD_I_MASK(irq));
gic_v3_wait_for_rwp(sc, DIST);
} else
-   panic("gic_v3_disable_intr");
+   panic("%s: Unsupported IRQ %u", __func__, irq);
 }
 
 static void
@@ -660,7 +666,7 @@ gic_v3_enable_intr(device_t dev, struct 
gic_d_write(sc, 4, GICD_ISENABLER(irq), GICD_I_MASK(irq));
gic_v3_wait_for_rwp(sc, DIST);
} else
-   panic("gic_v3_enable_intr");
+   panic("%s: Unsupported IRQ %u", __func__, irq);
 }
 
 static void
___
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: r299944 - in head/sys: arm64/arm64 conf

2016-05-16 Thread Andrew Turner
Author: andrew
Date: Mon May 16 14:07:43 2016
New Revision: 299944
URL: https://svnweb.freebsd.org/changeset/base/299944

Log:
  Add intrng support to the GICv3 driver. It lacks ITS support so won't handle
  MSI or MSI-X interrupts, however this is enought to boot FreeBSD under the
  ARM Foundation Model with a GICv3 interrupt controller.
  
  Approved by:  ABT Systems Ltd
  Relnotes: yes
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/gic_v3.c
  head/sys/arm64/arm64/gic_v3_fdt.c
  head/sys/arm64/arm64/gic_v3_var.h
  head/sys/conf/files.arm64

Modified: head/sys/arm64/arm64/gic_v3.c
==
--- head/sys/arm64/arm64/gic_v3.c   Mon May 16 13:39:04 2016
(r299943)
+++ head/sys/arm64/arm64/gic_v3.c   Mon May 16 14:07:43 2016
(r299944)
@@ -1,7 +1,10 @@
 /*-
- * Copyright (c) 2015 The FreeBSD Foundation
+ * Copyright (c) 2015-2016 The FreeBSD Foundation
  * All rights reserved.
  *
+ * This software was developed by Andrew Turner under
+ * the sponsorship of the FreeBSD Foundation.
+ *
  * This software was developed by Semihalf under
  * the sponsorship of the FreeBSD Foundation.
  *
@@ -27,6 +30,8 @@
  * SUCH DAMAGE.
  */
 
+#include "opt_platform.h"
+
 #include 
 __FBSDID("$FreeBSD$");
 
@@ -58,6 +63,28 @@ __FBSDID("$FreeBSD$");
 #include "gic_v3_reg.h"
 #include "gic_v3_var.h"
 
+#ifdef INTRNG
+static pic_disable_intr_t gic_v3_disable_intr;
+static pic_enable_intr_t gic_v3_enable_intr;
+static pic_map_intr_t gic_v3_map_intr;
+static pic_setup_intr_t gic_v3_setup_intr;
+static pic_teardown_intr_t gic_v3_teardown_intr;
+static pic_post_filter_t gic_v3_post_filter;
+static pic_post_ithread_t gic_v3_post_ithread;
+static pic_pre_ithread_t gic_v3_pre_ithread;
+static pic_bind_intr_t gic_v3_bind_intr;
+#ifdef SMP
+static pic_init_secondary_t gic_v3_init_secondary;
+static pic_ipi_send_t gic_v3_ipi_send;
+static pic_ipi_setup_t gic_v3_ipi_setup;
+#endif
+
+static u_int gic_irq_cpu;
+#ifdef SMP
+static u_int sgi_to_ipi[GIC_LAST_SGI - GIC_FIRST_SGI + 1];
+static u_int sgi_first_unused = GIC_FIRST_SGI;
+#endif
+#else
 /* Device and PIC methods */
 static int gic_v3_bind(device_t, u_int, u_int);
 static void gic_v3_dispatch(device_t, struct trapframe *);
@@ -68,11 +95,29 @@ static void gic_v3_unmask_irq(device_t, 
 static void gic_v3_init_secondary(device_t);
 static void gic_v3_ipi_send(device_t, cpuset_t, u_int);
 #endif
+#endif
 
 static device_method_t gic_v3_methods[] = {
/* Device interface */
DEVMETHOD(device_detach,gic_v3_detach),
 
+#ifdef INTRNG
+   /* Interrupt controller interface */
+   DEVMETHOD(pic_disable_intr, gic_v3_disable_intr),
+   DEVMETHOD(pic_enable_intr,  gic_v3_enable_intr),
+   DEVMETHOD(pic_map_intr, gic_v3_map_intr),
+   DEVMETHOD(pic_setup_intr,   gic_v3_setup_intr),
+   DEVMETHOD(pic_teardown_intr,gic_v3_teardown_intr),
+   DEVMETHOD(pic_post_filter,  gic_v3_post_filter),
+   DEVMETHOD(pic_post_ithread, gic_v3_post_ithread),
+   DEVMETHOD(pic_pre_ithread,  gic_v3_pre_ithread),
+#ifdef SMP
+   DEVMETHOD(pic_bind_intr,gic_v3_bind_intr),
+   DEVMETHOD(pic_init_secondary,   gic_v3_init_secondary),
+   DEVMETHOD(pic_ipi_send, gic_v3_ipi_send),
+   DEVMETHOD(pic_ipi_setup,gic_v3_ipi_setup),
+#endif
+#else
/* PIC interface */
DEVMETHOD(pic_bind, gic_v3_bind),
DEVMETHOD(pic_dispatch, gic_v3_dispatch),
@@ -83,6 +128,8 @@ static device_method_t gic_v3_methods[] 
DEVMETHOD(pic_init_secondary,   gic_v3_init_secondary),
DEVMETHOD(pic_ipi_send, gic_v3_ipi_send),
 #endif
+#endif
+
/* End */
DEVMETHOD_END
 };
@@ -144,6 +191,10 @@ gic_v3_attach(device_t dev)
int rid;
int err;
size_t i;
+#ifdef INTRNG
+   u_int irq;
+   const char *name;
+#endif
 
sc = device_get_softc(dev);
sc->gic_registered = FALSE;
@@ -192,6 +243,36 @@ gic_v3_attach(device_t dev)
if (sc->gic_nirqs > GIC_I_NUM_MAX)
sc->gic_nirqs = GIC_I_NUM_MAX;
 
+#ifdef INTRNG
+   sc->gic_irqs = malloc(sizeof(*sc->gic_irqs) * sc->gic_nirqs,
+   M_GIC_V3, M_WAITOK | M_ZERO);
+   name = device_get_nameunit(dev);
+   for (irq = 0; irq < sc->gic_nirqs; irq++) {
+   struct intr_irqsrc *isrc;
+
+   sc->gic_irqs[irq].gi_irq = irq;
+   sc->gic_irqs[irq].gi_pol = INTR_POLARITY_CONFORM;
+   sc->gic_irqs[irq].gi_trig = INTR_TRIGGER_CONFORM;
+
+   isrc = >gic_irqs[irq].gi_isrc;
+   if (irq <= GIC_LAST_SGI) {
+   err = intr_isrc_register(isrc, sc->dev,
+   INTR_ISRCF_IPI, "%s,i%u", name, irq - 
GIC_FIRST_SGI);
+  

svn commit: r299928 - in head/sys: arm/arm conf dev/pci kern mips/mediatek sys

2016-05-16 Thread Andrew Turner
ns/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'u_char 
dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < 
/usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'u_char 
dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h" \
no-obj no-implicit-rule before-depend   \
clean   "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 
${SC_DFLT_FONT}-8x8"
+kern/msi_if.m  optionalintrng
 kern/pic_if.m  optionalintrng
 kern/subr_busdma_bufalloc.cstandard
 kern/subr_devmap.c standard

Modified: head/sys/dev/pci/pci_host_generic.c
==
--- head/sys/dev/pci/pci_host_generic.c Mon May 16 08:50:32 2016
(r299927)
+++ head/sys/dev/pci/pci_host_generic.c Mon May 16 09:11:40 2016
(r299928)
@@ -46,6 +46,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#if defined(INTRNG)
+#include 
+#endif
+
 #include 
 #include 
 #include 
@@ -158,6 +162,7 @@ pci_host_generic_attach(device_t dev)
uint64_t phys_base;
uint64_t pci_base;
uint64_t size;
+   phandle_t node;
int error;
int tuple;
int rid;
@@ -227,8 +232,12 @@ pci_host_generic_attach(device_t dev)
}
}
 
-   ofw_bus_setup_iinfo(ofw_bus_get_node(dev), >pci_iinfo,
-   sizeof(cell_t));
+   node = ofw_bus_get_node(dev);
+   ofw_bus_setup_iinfo(node, >pci_iinfo, sizeof(cell_t));
+
+   /* Find the MSI interrupt handler */
+   OF_searchencprop(node, "msi-parent", >msi_parent,
+   sizeof(sc->msi_parent));
 
device_add_child(dev, "pci", -1);
return (bus_generic_attach(dev));
@@ -661,8 +670,13 @@ static int
 generic_pcie_alloc_msi(device_t pci, device_t child, int count, int maxcount,
 int *irqs)
 {
+#if defined(INTRNG)
+   struct generic_pcie_softc *sc;
 
-#if defined(__aarch64__)
+   sc = device_get_softc(pci);
+   return (intr_alloc_msi(pci, child, sc->msi_parent, count, maxcount,
+   irqs));
+#elif defined(__aarch64__)
return (arm_alloc_msi(pci, child, count, maxcount, irqs));
 #else
return (ENXIO);
@@ -672,8 +686,12 @@ generic_pcie_alloc_msi(device_t pci, dev
 static int
 generic_pcie_release_msi(device_t pci, device_t child, int count, int *irqs)
 {
+#if defined(INTRNG)
+   struct generic_pcie_softc *sc;
 
-#if defined(__aarch64__)
+   sc = device_get_softc(pci);
+   return (intr_release_msi(pci, child, sc->msi_parent, count, irqs));
+#elif defined(__aarch64__)
return (arm_release_msi(pci, child, count, irqs));
 #else
return (ENXIO);
@@ -684,8 +702,12 @@ static int
 generic_pcie_map_msi(device_t pci, device_t child, int irq, uint64_t *addr,
 uint32_t *data)
 {
+#if defined(INTRNG)
+   struct generic_pcie_softc *sc;
 
-#if defined(__aarch64__)
+   sc = device_get_softc(pci);
+   return (intr_map_msi(pci, child, sc->msi_parent, irq, addr, data));
+#elif defined(__aarch64__)
return (arm_map_msi(pci, child, irq, addr, data));
 #else
return (ENXIO);
@@ -695,8 +717,12 @@ generic_pcie_map_msi(device_t pci, devic
 static int
 generic_pcie_alloc_msix(device_t pci, device_t child, int *irq)
 {
+#if defined(INTRNG)
+   struct generic_pcie_softc *sc;
 
-#if defined(__aarch64__)
+   sc = device_get_softc(pci);
+   return (intr_alloc_msix(pci, child, sc->msi_parent, irq));
+#elif defined(__aarch64__)
return (arm_alloc_msix(pci, child, irq));
 #else
return (ENXIO);
@@ -706,8 +732,12 @@ generic_pcie_alloc_msix(device_t pci, de
 static int
 generic_pcie_release_msix(device_t pci, device_t child, int irq)
 {
+#if defined(INTRNG)
+   struct generic_pcie_softc *sc;
 
-#if defined(__aarch64__)
+   sc = device_get_softc(pci);
+   return (intr_release_msix(pci, child, sc->msi_parent, irq));
+#elif defined(__aarch64__)
return (arm_release_msix(pci, child, irq));
 #else
return (ENXIO);

Modified: head/sys/dev/pci/pci_host_generic.h
==
--- head/sys/dev/pci/pci_host_generic.h Mon May 16 08:50:32 2016
(r299927)
+++ head/sys/dev/pci/pci_host_generic.h Mon May 16 09:11:40 2016
(r299928)
@@ -60,6 +60,7 @@ struct generic_pcie_softc {
bus_space_handle_t  ioh;
 #ifdef FDT
struct ofw_bus_iinfopci_iinfo;
+   phandle_t   msi_parent;
 #endif
 };
 

Added: head/sys/kern/msi_if.m
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/kern/msi_if.m  Mon May 16 09:11:40 2016(r299928)
@@ -0,0 +1,74 @@
+#-
+# Copyright (c) 2016 The FreeBSD Foundation
+# All r

svn commit: r299929 - in head: share/man/man9 sys/dev/pci

2016-05-16 Thread Andrew Turner
Author: andrew
Date: Mon May 16 09:15:50 2016
New Revision: 299929
URL: https://svnweb.freebsd.org/changeset/base/299929

Log:
  Re-commit r299467 having fixed the build:
  
  Add a new get_id interface to pci and pcib. This will allow us to both
  detect failures, and get different PCI IDs.
  
  For the former the interface returns an int to signal an error. The ID is
  returned at a uintptr_t * argument.
  
  For the latter there is a type argument that allows selecting the ID type.
  This only specifies a single type, however a MSI type will be added
  to handle the need to find the ID the hardware passes to the ARM GICv3
  interrupt controller.
  
  A follow up commit will be made to remove pci_get_rid.
  
  Reviewed by:jhb, rstone (previous version)
  Obtained from:  ABT Systems Ltd
  Sponsored by:   The FreeBSD Foundation
  Differential Revision:  https://reviews.freebsd.org/D6239

Modified:
  head/share/man/man9/Makefile
  head/share/man/man9/pci.9
  head/sys/dev/pci/pci.c
  head/sys/dev/pci/pci_if.m
  head/sys/dev/pci/pci_pci.c
  head/sys/dev/pci/pcib_if.m
  head/sys/dev/pci/pcib_private.h
  head/sys/dev/pci/pcib_support.c
  head/sys/dev/pci/pcivar.h

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileMon May 16 09:11:40 2016
(r299928)
+++ head/share/man/man9/MakefileMon May 16 09:15:50 2016
(r299929)
@@ -1290,6 +1290,7 @@ MLINKS+=pci.9 pci_alloc_msi.9 \
pci.9 pci_find_extcap.9 \
pci.9 pci_find_htcap.9 \
pci.9 pci_find_pcie_root_port.9 \
+   pci.9 pci_get_id.9 \
pci.9 pci_get_max_read_req.9 \
pci.9 pci_get_powerstate.9 \
pci.9 pci_get_vpd_ident.9 \

Modified: head/share/man/man9/pci.9
==
--- head/share/man/man9/pci.9   Mon May 16 09:11:40 2016(r299928)
+++ head/share/man/man9/pci.9   Mon May 16 09:15:50 2016(r299929)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 23, 2015
+.Dd May 16, 2016
 .Dt PCI 9
 .Os
 .Sh NAME
@@ -43,6 +43,7 @@
 .Nm pci_find_extcap ,
 .Nm pci_find_htcap ,
 .Nm pci_find_pcie_root_port ,
+.Nm pci_get_id ,
 .Nm pci_get_max_read_req ,
 .Nm pci_get_powerstate ,
 .Nm pci_get_vpd_ident ,
@@ -97,6 +98,8 @@
 .Ft device_t
 .Fn pci_find_pcie_root_port "device_t dev"
 .Ft int
+.Fn pci_get_id "device_t dev" "enum pci_id_type type" "uintptr_t *id"
+.Ft int
 .Fn pci_get_max_read_req "device_t dev"
 .Ft int
 .Fn pci_get_powerstate "device_t dev"
@@ -357,6 +360,18 @@ returns
 .Dv NULL .
 .Pp
 The
+.Fn pci_get_id
+function is used to read an identifier from a device.
+The
+.Fa type
+flag is used to specify which identifier to read.
+The following flags are supported:
+.Bl -hang -width ".Dv PCI_ID_RID"
+.It Dv PCI_ID_RID
+Read the routing identifier for the device.
+.El
+.Pp
+The
 .Fn pci_get_vpd_ident
 function is used to fetch a device's Vital Product Data
 .Pq VPD

Modified: head/sys/dev/pci/pci.c
==
--- head/sys/dev/pci/pci.c  Mon May 16 09:11:40 2016(r299928)
+++ head/sys/dev/pci/pci.c  Mon May 16 09:15:50 2016(r299929)
@@ -122,7 +122,8 @@ static void pci_resume_msix(device_t de
 static int pci_remap_intr_method(device_t bus, device_t dev,
u_int irq);
 
-static uint16_tpci_get_rid_method(device_t dev, device_t 
child);
+static int pci_get_id_method(device_t dev, device_t child,
+   enum pci_id_type type, uintptr_t *rid);
 
 static struct pci_devinfo * pci_fill_devinfo(device_t pcib, device_t bus, int 
d,
 int b, int s, int f, uint16_t vid, uint16_t did);
@@ -190,7 +191,7 @@ static device_method_t pci_methods[] = {
DEVMETHOD(pci_msix_count,   pci_msix_count_method),
DEVMETHOD(pci_msix_pba_bar, pci_msix_pba_bar_method),
DEVMETHOD(pci_msix_table_bar,   pci_msix_table_bar_method),
-   DEVMETHOD(pci_get_rid,  pci_get_rid_method),
+   DEVMETHOD(pci_get_id,   pci_get_id_method),
DEVMETHOD(pci_alloc_devinfo,pci_alloc_devinfo_method),
DEVMETHOD(pci_child_added,  pci_child_added_method),
 #ifdef PCI_IOV
@@ -5823,11 +5824,12 @@ pci_restore_state(device_t dev)
pci_cfg_restore(dev, dinfo);
 }
 
-static uint16_t
-pci_get_rid_method(device_t dev, device_t child)
+static int
+pci_get_id_method(device_t dev, device_t child, enum pci_id_type type,
+uintptr_t *id)
 {
 
-   return (PCIB_GET_RID(device_get_parent(dev), child));
+   return (PCIB_GET_ID(device_get_parent(dev), child, type, id));
 }
 
 /* Find the upstream port of a given PCI device in a root complex. */

Modified: head/sys/dev/pci/pci_if.m
==
--- head/sys/dev/pci/pci_if.m   Mon May 16 

svn commit: r299932 - in head: share/man/man9 sys/arm64/arm64 sys/arm64/cavium sys/dev/ofw sys/dev/pci

2016-05-16 Thread Andrew Turner
Author: andrew
Date: Mon May 16 09:31:44 2016
New Revision: 299932
URL: https://svnweb.freebsd.org/changeset/base/299932

Log:
  Add a pcib interface for use by interrupt controllers that need to
  translate the pci rid to a controller ID. The translation could be based
  on the 'msi-map' OFW property, a similar ACPI option, or hard-coded for
  hardware lacking the above options.
  
  Reviewed by:  wma
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/share/man/man9/pci.9
  head/sys/arm64/arm64/gic_v3_its.c
  head/sys/arm64/arm64/gic_v3_var.h
  head/sys/arm64/cavium/thunder_pcie_fdt.c
  head/sys/arm64/cavium/thunder_pcie_pem.c
  head/sys/arm64/cavium/thunder_pcie_pem_fdt.c
  head/sys/dev/ofw/ofw_bus_subr.c
  head/sys/dev/ofw/ofw_bus_subr.h
  head/sys/dev/pci/pci_host_generic.c
  head/sys/dev/pci/pci_host_generic.h
  head/sys/dev/pci/pci_if.m
  head/sys/dev/pci/pci_pci.c

Modified: head/share/man/man9/pci.9
==
--- head/share/man/man9/pci.9   Mon May 16 09:25:56 2016(r299931)
+++ head/share/man/man9/pci.9   Mon May 16 09:31:44 2016(r299932)
@@ -369,6 +369,9 @@ The following flags are supported:
 .Bl -hang -width ".Dv PCI_ID_RID"
 .It Dv PCI_ID_RID
 Read the routing identifier for the device.
+.It Dv PCI_ID_MSI
+Read the MSI routing ID.
+This is needed by some interrupt controllers to route MSI and MSI-X interrupts.
 .El
 .Pp
 The

Modified: head/sys/arm64/arm64/gic_v3_its.c
==
--- head/sys/arm64/arm64/gic_v3_its.c   Mon May 16 09:25:56 2016
(r299931)
+++ head/sys/arm64/arm64/gic_v3_its.c   Mon May 16 09:31:44 2016
(r299932)
@@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
 #defineGIC_V3_ITS_QUIRK_THUNDERX_PEM_BUS_OFFSET88
 
 #include "pic_if.h"
+#include "pcib_if.h"
 
 /* Device and PIC methods */
 static int gic_v3_its_attach(device_t);
@@ -150,7 +151,6 @@ const char *its_ptab_type[] = {
 
 /* Cavium ThunderX PCI devid acquire function */
 static uint32_t its_get_devbits_thunder(device_t);
-static uint32_t its_get_devid_thunder(device_t);
 
 static const struct its_quirks its_quirks[] = {
{
@@ -160,7 +160,6 @@ static const struct its_quirks its_quirk
 */
.cpuid =CPU_ID_RAW(CPU_IMPL_CAVIUM, CPU_PART_THUNDER, 
0, 0),
.cpuid_mask =   CPU_IMPL_MASK | CPU_PART_MASK,
-   .devid_func =   its_get_devid_thunder,
.devbits_func = its_get_devbits_thunder,
},
 };
@@ -1569,46 +1568,6 @@ its_device_asign_lpi_locked(struct gic_v
  * Add vendor specific PCI devid function here.
  */
 static uint32_t
-its_get_devid_thunder(device_t pci_dev)
-{
-   int bsf;
-   int pem;
-   uint32_t bus;
-
-   bus = pci_get_bus(pci_dev);
-   bsf = pci_get_rid(pci_dev);
-
-   /* Check if accessing internal PCIe (low bus numbers) */
-   if (bus < GIC_V3_ITS_QUIRK_THUNDERX_PEM_BUS_OFFSET) {
-   return ((pci_get_domain(pci_dev) << PCI_RID_DOMAIN_SHIFT) |
-   bsf);
-   /* PEM otherwise */
-   } else {
-   /* PEM (PCIe MAC/root complex) number is equal to domain */
-   pem = pci_get_domain(pci_dev);
-
-   /*
-* Set appropriate device ID (passed by the HW along with
-* the transaction to memory) for different root complex
-* numbers using hard-coded domain portion for each group.
-*/
-   if (pem < 3)
-   return ((0x1 << PCI_RID_DOMAIN_SHIFT) | bsf);
-
-   if (pem < 6)
-   return ((0x3 << PCI_RID_DOMAIN_SHIFT) | bsf);
-
-   if (pem < 9)
-   return ((0x9 << PCI_RID_DOMAIN_SHIFT) | bsf);
-
-   if (pem < 12)
-   return ((0xB << PCI_RID_DOMAIN_SHIFT) | bsf);
-   }
-
-   return (0);
-}
-
-static uint32_t
 its_get_devbits_thunder(device_t dev)
 {
uint32_t devid_bits;
@@ -1670,28 +1629,15 @@ its_get_devbits(device_t dev)
return (its_get_devbits_default(dev));
 }
 
-static __inline uint32_t
-its_get_devid_default(device_t pci_dev)
-{
-
-   return (PCI_DEVID_GENERIC(pci_dev));
-}
-
 static uint32_t
 its_get_devid(device_t pci_dev)
 {
-   const struct its_quirks *quirk;
-   size_t i;
+   uintptr_t id;
 
-   for (i = 0; i < nitems(its_quirks); i++) {
-   quirk = _quirks[i];
-   if (CPU_MATCH_RAW(quirk->cpuid_mask, quirk->cpuid)) {
-   if (quirk->devid_func != NULL)
-   return ((*quirk->devid_func)(pci_dev));
-   }
-   }
+   if (pci_get_id(pci_dev, PCI_ID_MSI, ) != 0)
+   panic("its_get_devid: Unable to get the MSI DeviceID");
 
-   return (its_get_devid_default(pci_dev));
+   return (id);

svn commit: r299936 - in head/sys: arm64/arm64 arm64/include conf

2016-05-16 Thread Andrew Turner
Author: andrew
Date: Mon May 16 10:48:51 2016
New Revision: 299936
URL: https://svnweb.freebsd.org/changeset/base/299936

Log:
  Add support for intrng to arm64. As the GICv3 drivers will need to be
  updated, and until further testing can be done, this is disabled for now.
  
  It is expected arm64 will switch to this interface, and the old interface
  will be removed before 11.0 is released.
  
  Obtained from:ABT Systems Ltd
  Relnotes: yes
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/autoconf.c
  head/sys/arm64/arm64/mp_machdep.c
  head/sys/arm64/arm64/nexus.c
  head/sys/arm64/include/intr.h
  head/sys/conf/files.arm64
  head/sys/conf/options.arm64

Modified: head/sys/arm64/arm64/autoconf.c
==
--- head/sys/arm64/arm64/autoconf.c Mon May 16 10:34:55 2016
(r299935)
+++ head/sys/arm64/arm64/autoconf.c Mon May 16 10:48:51 2016
(r299936)
@@ -80,7 +80,13 @@ configure(void *dummy)
 static void
 configure_final(void *dummy)
 {
+
+#ifdef INTRNG
+   /* Enable interrupt reception on this CPU */
+   intr_enable();
+#else
arm_enable_intr();
+#endif
cninit_finish(); 
 
if (bootverbose)

Modified: head/sys/arm64/arm64/mp_machdep.c
==
--- head/sys/arm64/arm64/mp_machdep.c   Mon May 16 10:34:55 2016
(r299935)
+++ head/sys/arm64/arm64/mp_machdep.c   Mon May 16 10:48:51 2016
(r299936)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2015 The FreeBSD Foundation
+ * Copyright (c) 2015-2016 The FreeBSD Foundation
  * All rights reserved.
  *
  * This software was developed by Andrew Turner under
@@ -65,6 +65,29 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#ifdef INTRNG
+#include "pic_if.h"
+
+typedef void intr_ipi_send_t(void *, cpuset_t, u_int);
+typedef void intr_ipi_handler_t(void *);
+
+#define INTR_IPI_NAMELEN   (MAXCOMLEN + 1)
+struct intr_ipi {
+   intr_ipi_handler_t *ii_handler;
+   void *  ii_handler_arg;
+   intr_ipi_send_t *   ii_send;
+   void *  ii_send_arg;
+   charii_name[INTR_IPI_NAMELEN];
+   u_long *ii_count;
+};
+
+static struct intr_ipi ipi_sources[INTR_IPI_COUNT];
+
+static struct intr_ipi *intr_ipi_lookup(u_int);
+static void intr_pic_ipi_setup(u_int, const char *, intr_ipi_handler_t *,
+void *);
+#endif /* INTRNG */
+
 boolean_t ofw_cpu_reg(phandle_t node, u_int, cell_t *);
 
 extern struct pcpu __pcpu[];
@@ -184,9 +207,18 @@ release_aps(void *dummy __unused)
 {
int cpu, i;
 
+#ifdef INTRNG
+   intr_pic_ipi_setup(IPI_AST, "ast", ipi_ast, NULL);
+   intr_pic_ipi_setup(IPI_PREEMPT, "preempt", ipi_preempt, NULL);
+   intr_pic_ipi_setup(IPI_RENDEZVOUS, "rendezvous", ipi_rendezvous, NULL);
+   intr_pic_ipi_setup(IPI_STOP, "stop", ipi_stop, NULL);
+   intr_pic_ipi_setup(IPI_STOP_HARD, "stop hard", ipi_stop, NULL);
+   intr_pic_ipi_setup(IPI_HARDCLOCK, "hardclock", ipi_hardclock, NULL);
+#else
/* Setup the IPI handler */
for (i = 0; i < INTR_IPI_COUNT; i++)
arm_setup_ipihandler(ipi_handler, i);
+#endif
 
atomic_store_rel_int(_ready, 1);
/* Wake up the other CPUs */
@@ -214,7 +246,9 @@ void
 init_secondary(uint64_t cpu)
 {
struct pcpu *pcpup;
+#ifndef INTRNG
int i;
+#endif
 
pcpup = &__pcpu[cpu];
/*
@@ -241,11 +275,13 @@ init_secondary(uint64_t cpu)
 */
identify_cpu();
 
+#ifndef INTRNG
/* Configure the interrupt controller */
arm_init_secondary();
 
for (i = 0; i < INTR_IPI_COUNT; i++)
arm_unmask_ipi(i);
+#endif
 
/* Start per-CPU event timers. */
cpu_initclocks_ap();
@@ -270,6 +306,10 @@ init_secondary(uint64_t cpu)
 
mtx_unlock_spin(_boot_mtx);
 
+#ifdef INTRNG
+   intr_pic_init_secondary();
+#endif
+
/* Enter the scheduler */
sched_throw(NULL);
 
@@ -277,6 +317,64 @@ init_secondary(uint64_t cpu)
/* NOTREACHED */
 }
 
+#ifdef INTRNG
+/*
+ *  Send IPI thru interrupt controller.
+ */
+static void
+pic_ipi_send(void *arg, cpuset_t cpus, u_int ipi)
+{
+
+   KASSERT(intr_irq_root_dev != NULL, ("%s: no root attached", __func__));
+   PIC_IPI_SEND(intr_irq_root_dev, arg, cpus, ipi);
+}
+
+/*
+ *  Setup IPI handler on interrupt controller.
+ *
+ *  Not SMP coherent.
+ */
+static void
+intr_pic_ipi_setup(u_int ipi, const char *name, intr_ipi_handler_t *hand,
+void *arg)
+{
+   struct intr_irqsrc *isrc;
+   struct intr_ipi *ii;
+   int error;
+
+   KASSERT(intr_irq_root_dev != NULL, ("%s: no root attached", __func__));
+   KASSERT(hand != NULL, ("%s: ipi %u no handler", __func__, ipi));
+

svn commit: r299934 - head/sys/arm64/cavium

2016-05-16 Thread Andrew Turner
Author: andrew
Date: Mon May 16 10:03:57 2016
New Revision: 299934
URL: https://svnweb.freebsd.org/changeset/base/299934

Log:
  Teach the ThunderX PCI PEM driver about intrng. This will be used later
  when arm64 is supported by intrng.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/cavium/thunder_pcie_pem_fdt.c

Modified: head/sys/arm64/cavium/thunder_pcie_pem_fdt.c
==
--- head/sys/arm64/cavium/thunder_pcie_pem_fdt.cMon May 16 09:56:48 
2016(r299933)
+++ head/sys/arm64/cavium/thunder_pcie_pem_fdt.cMon May 16 10:03:57 
2016(r299934)
@@ -109,6 +109,60 @@ thunder_pem_fdt_probe(device_t dev)
return (ENXIO);
 }
 
+#ifdef INTRNG
+static int
+thunder_pem_fdt_alloc_msi(device_t pci, device_t child, int count, int 
maxcount,
+int *irqs)
+{
+   phandle_t msi_parent;
+
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
+   NULL);
+   return (intr_alloc_msi(pci, child, msi_parent, count, maxcount,
+   irqs));
+}
+
+static int
+thunder_pem_fdt_release_msi(device_t pci, device_t child, int count, int *irqs)
+{
+   phandle_t msi_parent;
+
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
+   NULL);
+   return (intr_release_msi(pci, child, msi_parent, count, irqs));
+}
+
+static int
+thunder_pem_fdt_alloc_msix(device_t pci, device_t child, int *irq)
+{
+   phandle_t msi_parent;
+
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
+   NULL);
+   return (intr_alloc_msix(pci, child, msi_parent, irq));
+}
+
+static int
+thunder_pem_fdt_release_msix(device_t pci, device_t child, int irq)
+{
+   phandle_t msi_parent;
+
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
+   NULL);
+   return (intr_release_msix(pci, child, msi_parent, irq));
+}
+
+static int
+thunder_pem_fdt_map_msi(device_t pci, device_t child, int irq, uint64_t *addr,
+uint32_t *data)
+{
+   phandle_t msi_parent;
+
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
+   NULL);
+   return (intr_map_msi(pci, child, msi_parent, irq, addr, data));
+}
+#else
 static int
 thunder_pem_fdt_alloc_msi(device_t pci, device_t child, int count, int 
maxcount,
 int *irqs)
@@ -145,6 +199,7 @@ thunder_pem_fdt_map_msi(device_t pci, de
 
return (arm_map_msi(pci, child, irq, addr, data));
 }
+#endif
 
 static int
 thunder_pem_fdt_get_id(device_t dev, device_t child, enum pci_id_type type,
___
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: r299939 - head/sys/arm64/arm64

2016-05-16 Thread Andrew Turner
Author: andrew
Date: Mon May 16 12:02:06 2016
New Revision: 299939
URL: https://svnweb.freebsd.org/changeset/base/299939

Log:
  Move the call to intr_pic_init_secondary to the same place as in the
  non-intrng case.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/mp_machdep.c

Modified: head/sys/arm64/arm64/mp_machdep.c
==
--- head/sys/arm64/arm64/mp_machdep.c   Mon May 16 11:48:43 2016
(r299938)
+++ head/sys/arm64/arm64/mp_machdep.c   Mon May 16 12:02:06 2016
(r299939)
@@ -275,7 +275,9 @@ init_secondary(uint64_t cpu)
 */
identify_cpu();
 
-#ifndef INTRNG
+#ifdef INTRNG
+   intr_pic_init_secondary();
+#else
/* Configure the interrupt controller */
arm_init_secondary();
 
@@ -306,10 +308,6 @@ init_secondary(uint64_t cpu)
 
mtx_unlock_spin(_boot_mtx);
 
-#ifdef INTRNG
-   intr_pic_init_secondary();
-#endif
-
/* Enter the scheduler */
sched_throw(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: r299941 - head/sys/dev/pci

2016-05-16 Thread Andrew Turner
Author: andrew
Date: Mon May 16 12:18:30 2016
New Revision: 299941
URL: https://svnweb.freebsd.org/changeset/base/299941

Log:
  Call ofw_bus_msimap to find the parent MSI controller, it may not use the
  msi-parent property.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/pci/pci_host_generic.c
  head/sys/dev/pci/pci_host_generic.h

Modified: head/sys/dev/pci/pci_host_generic.c
==
--- head/sys/dev/pci/pci_host_generic.c Mon May 16 12:15:19 2016
(r299940)
+++ head/sys/dev/pci/pci_host_generic.c Mon May 16 12:18:30 2016
(r299941)
@@ -235,10 +235,6 @@ pci_host_generic_attach(device_t dev)
node = ofw_bus_get_node(dev);
ofw_bus_setup_iinfo(node, >pci_iinfo, sizeof(cell_t));
 
-   /* Find the MSI interrupt handler */
-   OF_searchencprop(node, "msi-parent", >msi_parent,
-   sizeof(sc->msi_parent));
-
device_add_child(dev, "pci", -1);
return (bus_generic_attach(dev));
 }
@@ -671,10 +667,11 @@ generic_pcie_alloc_msi(device_t pci, dev
 int *irqs)
 {
 #if defined(INTRNG)
-   struct generic_pcie_softc *sc;
+   phandle_t msi_parent;
 
-   sc = device_get_softc(pci);
-   return (intr_alloc_msi(pci, child, sc->msi_parent, count, maxcount,
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
+   NULL);
+   return (intr_alloc_msi(pci, child, msi_parent, count, maxcount,
irqs));
 #elif defined(__aarch64__)
return (arm_alloc_msi(pci, child, count, maxcount, irqs));
@@ -687,10 +684,11 @@ static int
 generic_pcie_release_msi(device_t pci, device_t child, int count, int *irqs)
 {
 #if defined(INTRNG)
-   struct generic_pcie_softc *sc;
+   phandle_t msi_parent;
 
-   sc = device_get_softc(pci);
-   return (intr_release_msi(pci, child, sc->msi_parent, count, irqs));
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
+   NULL);
+   return (intr_release_msi(pci, child, msi_parent, count, irqs));
 #elif defined(__aarch64__)
return (arm_release_msi(pci, child, count, irqs));
 #else
@@ -703,10 +701,11 @@ generic_pcie_map_msi(device_t pci, devic
 uint32_t *data)
 {
 #if defined(INTRNG)
-   struct generic_pcie_softc *sc;
+   phandle_t msi_parent;
 
-   sc = device_get_softc(pci);
-   return (intr_map_msi(pci, child, sc->msi_parent, irq, addr, data));
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
+   NULL);
+   return (intr_map_msi(pci, child, msi_parent, irq, addr, data));
 #elif defined(__aarch64__)
return (arm_map_msi(pci, child, irq, addr, data));
 #else
@@ -718,10 +717,11 @@ static int
 generic_pcie_alloc_msix(device_t pci, device_t child, int *irq)
 {
 #if defined(INTRNG)
-   struct generic_pcie_softc *sc;
+   phandle_t msi_parent;
 
-   sc = device_get_softc(pci);
-   return (intr_alloc_msix(pci, child, sc->msi_parent, irq));
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
+   NULL);
+   return (intr_alloc_msix(pci, child, msi_parent, irq));
 #elif defined(__aarch64__)
return (arm_alloc_msix(pci, child, irq));
 #else
@@ -733,10 +733,11 @@ static int
 generic_pcie_release_msix(device_t pci, device_t child, int irq)
 {
 #if defined(INTRNG)
-   struct generic_pcie_softc *sc;
+   phandle_t msi_parent;
 
-   sc = device_get_softc(pci);
-   return (intr_release_msix(pci, child, sc->msi_parent, irq));
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
+   NULL);
+   return (intr_release_msix(pci, child, msi_parent, irq));
 #elif defined(__aarch64__)
return (arm_release_msix(pci, child, irq));
 #else

Modified: head/sys/dev/pci/pci_host_generic.h
==
--- head/sys/dev/pci/pci_host_generic.h Mon May 16 12:15:19 2016
(r299940)
+++ head/sys/dev/pci/pci_host_generic.h Mon May 16 12:18:30 2016
(r299941)
@@ -60,7 +60,6 @@ struct generic_pcie_softc {
bus_space_handle_t  ioh;
 #ifdef FDT
struct ofw_bus_iinfopci_iinfo;
-   phandle_t   msi_parent;
 #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: r299683 - in head/sys/arm64: arm64 include

2016-05-13 Thread Andrew Turner
Author: andrew
Date: Fri May 13 16:03:50 2016
New Revision: 299683
URL: https://svnweb.freebsd.org/changeset/base/299683

Log:
  Add support to the arm64 busdma to handle the cache. For now this is
  disabled, however when we enable it it will default to assume memory is
  not cache-coherent, unless either the tag was created or the parent was
  marked as cache-coherent.
  
  Obtained from:ABT Systems Ltd
  Relnotes: yes
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/busdma_bounce.c
  head/sys/arm64/include/cpufunc.h

Modified: head/sys/arm64/arm64/busdma_bounce.c
==
--- head/sys/arm64/arm64/busdma_bounce.cFri May 13 15:57:55 2016
(r299682)
+++ head/sys/arm64/arm64/busdma_bounce.cFri May 13 16:03:50 2016
(r299683)
@@ -1,8 +1,11 @@
 /*-
  * Copyright (c) 1997, 1998 Justin T. Gibbs.
- * Copyright (c) 2015 The FreeBSD Foundation
+ * Copyright (c) 2015-2016 The FreeBSD Foundation
  * All rights reserved.
  *
+ * Portions of this software were developed by Andrew Turner
+ * under sponsorship of the FreeBSD Foundation.
+ *
  * Portions of this software were developed by Semihalf
  * under sponsorship of the FreeBSD Foundation.
  *
@@ -62,6 +65,7 @@ enum {
BF_COULD_BOUNCE = 0x01,
BF_MIN_ALLOC_COMP   = 0x02,
BF_KMEM_ALLOC   = 0x04,
+   BF_COHERENT = 0x10,
 };
 
 struct bounce_zone;
@@ -113,6 +117,13 @@ static SYSCTL_NODE(_hw, OID_AUTO, busdma
 SYSCTL_INT(_hw_busdma, OID_AUTO, total_bpages, CTLFLAG_RD, _bpages, 0,
   "Total bounce pages");
 
+struct sync_list {
+   vm_offset_t vaddr;  /* kva of client data */
+   bus_addr_t  paddr;  /* physical address */
+   vm_page_t   pages;  /* starting page of client data */
+   bus_size_t  datacount;  /* client data count */
+};
+
 struct bus_dmamap {
struct bp_list bpages;
intpagesneeded;
@@ -125,6 +136,8 @@ struct bus_dmamap {
u_int   flags;
 #defineDMAMAP_COULD_BOUNCE (1 << 0)
 #defineDMAMAP_FROM_DMAMEM  (1 << 1)
+   int sync_count;
+   struct sync_listslist[];
 };
 
 static STAILQ_HEAD(, bus_dmamap) bounce_map_waitinglist;
@@ -171,9 +184,19 @@ bounce_bus_dma_tag_create(bus_dma_tag_t 
newtag->map_count = 0;
newtag->segments = NULL;
 
-   if (parent != NULL && ((newtag->common.filter != NULL) ||
-   ((parent->bounce_flags & BF_COULD_BOUNCE) != 0)))
-   newtag->bounce_flags |= BF_COULD_BOUNCE;
+#ifdef notyet
+   if ((flags & BUS_DMA_COHERENT) != 0)
+   newtag->bounce_flags |= BF_COHERENT;
+#endif
+
+   if (parent != NULL) {
+   if ((newtag->common.filter != NULL ||
+   (parent->bounce_flags & BF_COULD_BOUNCE) != 0))
+   newtag->bounce_flags |= BF_COULD_BOUNCE;
+
+   /* Copy some flags from the parent */
+   newtag->bounce_flags |= parent->bounce_flags & BF_COHERENT;
+   }
 
if (newtag->common.lowaddr < ptoa((vm_paddr_t)Maxmem) ||
newtag->common.alignment > 1)
@@ -251,11 +274,14 @@ out:
 }
 
 static bus_dmamap_t
-alloc_dmamap(int flags)
+alloc_dmamap(bus_dma_tag_t dmat, int flags)
 {
+   u_long mapsize;
bus_dmamap_t map;
 
-   map = malloc(sizeof(*map), M_DEVBUF, flags | M_ZERO);
+   mapsize = sizeof(*map);
+   mapsize += sizeof(struct sync_list) * dmat->common.nsegments;
+   map = malloc(mapsize, M_DEVBUF, flags | M_ZERO);
if (map == NULL)
return (NULL);
 
@@ -288,7 +314,7 @@ bounce_bus_dmamap_create(bus_dma_tag_t d
}
}
 
-   *mapp = alloc_dmamap(M_NOWAIT);
+   *mapp = alloc_dmamap(dmat, M_NOWAIT);
if (*mapp == NULL) {
CTR3(KTR_BUSDMA, "%s: tag %p error %d",
__func__, dmat, ENOMEM);
@@ -360,7 +386,7 @@ bounce_bus_dmamap_destroy(bus_dma_tag_t 
if ((map->flags & DMAMAP_FROM_DMAMEM) != 0)
panic("bounce_bus_dmamap_destroy: Invalid map freed\n");
 
-   if (STAILQ_FIRST(>bpages) != NULL) {
+   if (STAILQ_FIRST(>bpages) != NULL || map->sync_count != 0) {
CTR3(KTR_BUSDMA, "%s: tag %p error %d", __func__, dmat, EBUSY);
return (EBUSY);
}
@@ -421,7 +447,7 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dm
 * Create the map, but don't set the could bounce flag as
 * this allocation should never bounce;
 */
-   *mapp = alloc_dmamap(mflags);
+   *mapp = alloc_dmamap(dmat, mflags);
if (*mapp == NULL) {
CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %

svn commit: r299679 - head/sys/dev/mmc/host

2016-05-13 Thread Andrew Turner
Author: andrew
Date: Fri May 13 15:15:54 2016
New Revision: 299679
URL: https://svnweb.freebsd.org/changeset/base/299679

Log:
  Add DMA sync operations around accessing the dwmmc descriptor ring. Even
  with it maps as cache-coherent we still need to call bus_dmamap_sync.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/mmc/host/dwmmc.c

Modified: head/sys/dev/mmc/host/dwmmc.c
==
--- head/sys/dev/mmc/host/dwmmc.c   Fri May 13 15:11:17 2016
(r299678)
+++ head/sys/dev/mmc/host/dwmmc.c   Fri May 13 15:15:54 2016
(r299679)
@@ -722,6 +722,9 @@ dma_done(struct dwmmc_softc *sc, struct 
bus_dmamap_sync(sc->buf_tag, sc->buf_map,
BUS_DMASYNC_POSTREAD);
 
+   bus_dmamap_sync(sc->desc_tag, sc->desc_map,
+   BUS_DMASYNC_POSTWRITE);
+
bus_dmamap_unload(sc->buf_tag, sc->buf_map);
 
return (0);
@@ -766,6 +769,10 @@ dma_prepare(struct dwmmc_softc *sc, stru
if (err != 0)
panic("dmamap_load failed\n");
 
+   /* Ensure the device can see the desc */
+   bus_dmamap_sync(sc->desc_tag, sc->desc_map,
+   BUS_DMASYNC_PREWRITE);
+
if (data->flags & MMC_DATA_WRITE)
bus_dmamap_sync(sc->buf_tag, sc->buf_map,
BUS_DMASYNC_PREWRITE);
___
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: r300144 - head/sys/arm/include

2016-05-18 Thread Andrew Turner
Author: andrew
Date: Wed May 18 13:09:52 2016
New Revision: 300144
URL: https://svnweb.freebsd.org/changeset/base/300144

Log:
  Implement atomic_cmpset_acq_64 and atomic_cmpset_rel_64 on arm and armeb.
  This should allow r300113 to build there.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/include/atomic-v4.h

Modified: head/sys/arm/include/atomic-v4.h
==
--- head/sys/arm/include/atomic-v4.hWed May 18 12:53:21 2016
(r300143)
+++ head/sys/arm/include/atomic-v4.hWed May 18 13:09:52 2016
(r300144)
@@ -372,6 +372,8 @@ atomic_swap_32(volatile u_int32_t *p, u_
 
 #define atomic_cmpset_rel_32   atomic_cmpset_32
 #define atomic_cmpset_acq_32   atomic_cmpset_32
+#define atomic_cmpset_rel_64   atomic_cmpset_64
+#define atomic_cmpset_acq_64   atomic_cmpset_64
 #define atomic_set_rel_32  atomic_set_32
 #define atomic_set_acq_32  atomic_set_32
 #define atomic_clear_rel_32atomic_clear_32
___
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: r300149 - in head/sys: arm/allwinner arm/allwinner/a10 arm/arm arm/broadcom/bcm2835 arm/mv arm/nvidia arm/ti arm/ti/omap4 arm64/arm64 kern mips/mediatek mips/mips sys

2016-05-18 Thread Andrew Turner
Author: andrew
Date: Wed May 18 15:05:44 2016
New Revision: 300149
URL: https://svnweb.freebsd.org/changeset/base/300149

Log:
  Return the struct intr_pic pointer from intr_pic_register. This will be
  needed in later changes where we may not be able to lock the pic list lock
  to perform a lookup, e.g. from within interrupt context.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm/allwinner/a10/a10_intc.c
  head/sys/arm/allwinner/aw_nmi.c
  head/sys/arm/arm/gic.c
  head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
  head/sys/arm/broadcom/bcm2835/bcm2835_intr.c
  head/sys/arm/broadcom/bcm2835/bcm2836.c
  head/sys/arm/mv/mpic.c
  head/sys/arm/nvidia/tegra_gpio.c
  head/sys/arm/nvidia/tegra_lic.c
  head/sys/arm/ti/aintc.c
  head/sys/arm/ti/omap4/omap4_wugen.c
  head/sys/arm/ti/ti_gpio.c
  head/sys/arm64/arm64/gic_v3_fdt.c
  head/sys/kern/subr_intr.c
  head/sys/mips/mediatek/mtk_gpio_v1.c
  head/sys/mips/mediatek/mtk_gpio_v2.c
  head/sys/mips/mediatek/mtk_intr_gic.c
  head/sys/mips/mediatek/mtk_intr_v1.c
  head/sys/mips/mediatek/mtk_intr_v2.c
  head/sys/mips/mediatek/mtk_pcie.c
  head/sys/mips/mips/mips_pic.c
  head/sys/sys/intr.h

Modified: head/sys/arm/allwinner/a10/a10_intc.c
==
--- head/sys/arm/allwinner/a10/a10_intc.c   Wed May 18 14:43:17 2016
(r300148)
+++ head/sys/arm/allwinner/a10/a10_intc.c   Wed May 18 15:05:44 2016
(r300149)
@@ -250,6 +250,7 @@ a10_intr(void *arg)
 static int
 a10_intr_pic_attach(struct a10_aintc_softc *sc)
 {
+   struct intr_pic *pic;
int error;
uint32_t irq;
const char *name;
@@ -266,9 +267,9 @@ a10_intr_pic_attach(struct a10_aintc_sof
}
 
xref = OF_xref_from_node(ofw_bus_get_node(sc->sc_dev));
-   error = intr_pic_register(sc->sc_dev, xref);
-   if (error != 0)
-   return (error);
+   pic = intr_pic_register(sc->sc_dev, xref);
+   if (pic == NULL)
+   return (ENXIO);
 
return (intr_pic_claim_root(sc->sc_dev, xref, a10_intr, sc, 0));
 }

Modified: head/sys/arm/allwinner/aw_nmi.c
==
--- head/sys/arm/allwinner/aw_nmi.c Wed May 18 14:43:17 2016
(r300148)
+++ head/sys/arm/allwinner/aw_nmi.c Wed May 18 15:05:44 2016
(r300149)
@@ -362,7 +362,7 @@ aw_nmi_attach(device_t dev)
  device_get_nameunit(sc->dev), sc->intr.irq) != 0)
goto error;
 
-   if (intr_pic_register(dev, (intptr_t)xref) != 0) {
+   if (intr_pic_register(dev, (intptr_t)xref) == NULL) {
device_printf(dev, "could not register pic\n");
goto error;
}

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Wed May 18 14:43:17 2016(r300148)
+++ head/sys/arm/arm/gic.c  Wed May 18 15:05:44 2016(r300149)
@@ -711,7 +711,7 @@ arm_gic_attach(device_t dev)
 * Now, when everything is initialized, it's right time to
 * register interrupt controller to interrupt framefork.
 */
-   if (intr_pic_register(dev, xref) != 0) {
+   if (intr_pic_register(dev, xref) == NULL) {
device_printf(dev, "could not register PIC\n");
goto cleanup;
}

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_gpio.cWed May 18 14:43:17 
2016(r300148)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_gpio.cWed May 18 15:05:44 
2016(r300149)
@@ -1045,8 +1045,11 @@ bcm_gpio_pic_attach(struct bcm_gpio_soft
if (error != 0)
return (error); /* XXX deregister ISRCs */
}
-   return (intr_pic_register(sc->sc_dev,
-   OF_xref_from_node(ofw_bus_get_node(sc->sc_dev;
+   if (intr_pic_register(sc->sc_dev,
+   OF_xref_from_node(ofw_bus_get_node(sc->sc_dev))) == NULL)
+   return (ENXIO);
+
+   return (0);
 }
 
 static int

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_intr.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_intr.cWed May 18 14:43:17 
2016(r300148)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_intr.cWed May 18 15:05:44 
2016(r300149)
@@ -341,7 +341,10 @@ bcm_intc_pic_register(struct bcm_intc_so
if (error != 0)
return (error);
}
-   return (intr_pic_register(sc->sc_dev, xref));
+   if (intr_pic_register(sc->sc_dev, xref) == NULL)
+   return (ENXIO);
+
+   return (0);
 }
 #endif
 

Modified: head/sys/arm/broadcom/bcm2835/bcm2836.c

Re: svn commit: r300149 - in head/sys: arm/allwinner arm/allwinner/a10 arm/arm arm/broadcom/bcm2835 arm/mv arm/nvidia arm/ti arm/ti/omap4 arm64/arm64 kern mips/mediatek mips/mips sys

2016-05-18 Thread Andrew Turner
On Wed, 18 May 2016 17:15:10 +0200
Zbigniew Bodek <z...@semihalf.com> wrote:

> 2016-05-18 17:05 GMT+02:00 Andrew Turner <and...@freebsd.org>:
...
> >  #ifdef INTRNG
> > xref = OF_xref_from_node(ofw_bus_get_node(dev));
> > -   if (intr_pic_register(dev, xref) != 0) {
> > +   if (intr_pic_register(dev, xref) == NULL) {
> > device_printf(dev, "could not register PIC\n");
> > goto error;
> > }
> > @@ -172,7 +172,7 @@ error:
> > /* Failure so free resources */
> > gic_v3_detach(dev);
> >
> > -   return (err);
> > +   return (ENXIO);
> >  
> 
> 
> Few line above we have:
> err = gic_v3_attach(dev);
> if (err != 0)
> goto error;
> 
> So now we would not return error code from gic_v3_attach() but always
> ENXIO...

The error value doesn't matter, as long as it's non-zero. This also
fixes the return value in the intrng case if either of
intr_pic_register or intr_pic_claim_root fail. You might get a little
information from the return value being printed, however it would be
more useful to have verbose logging to print an error message.

In all of these failure cases there isn't much we can do as there is no
root interrupt controller, the boot will fail later on when we enable
interrupts.

Andrew
___
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: r299478 - in head/sys/arm64: arm64 include

2016-05-11 Thread Andrew Turner
Author: andrew
Date: Wed May 11 18:48:47 2016
New Revision: 299478
URL: https://svnweb.freebsd.org/changeset/base/299478

Log:
  Call busdma_swi from swi_vm as is done from other architectures.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/vm_machdep.c
  head/sys/arm64/include/md_var.h

Modified: head/sys/arm64/arm64/vm_machdep.c
==
--- head/sys/arm64/arm64/vm_machdep.c   Wed May 11 18:20:02 2016
(r299477)
+++ head/sys/arm64/arm64/vm_machdep.c   Wed May 11 18:48:47 2016
(r299478)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -256,5 +257,6 @@ void
 swi_vm(void *v)
 {
 
-   /* Nothing to do here - busdma bounce buffers are not implemented. */
+   if (busdma_swi_pending != 0)
+   busdma_swi();
 }

Modified: head/sys/arm64/include/md_var.h
==
--- head/sys/arm64/include/md_var.h Wed May 11 18:20:02 2016
(r299477)
+++ head/sys/arm64/include/md_var.h Wed May 11 18:48:47 2016
(r299478)
@@ -41,6 +41,7 @@ extern int vm_page_dump_size;
 
 struct dumperinfo;
 
+extern int busdma_swi_pending;
 void busdma_swi(void);
 void dump_add_page(vm_paddr_t);
 void dump_drop_page(vm_paddr_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: r299532 - head/sys/arm64/arm64

2016-05-12 Thread Andrew Turner
Author: andrew
Date: Thu May 12 12:13:28 2016
New Revision: 299532
URL: https://svnweb.freebsd.org/changeset/base/299532

Log:
  Restrict the memory barriers in bus_dmamap_sync to just the operations
  where it's needed.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/busdma_bounce.c

Modified: head/sys/arm64/arm64/busdma_bounce.c
==
--- head/sys/arm64/arm64/busdma_bounce.cThu May 12 12:03:27 2016
(r299531)
+++ head/sys/arm64/arm64/busdma_bounce.cThu May 12 12:13:28 2016
(r299532)
@@ -799,12 +799,6 @@ bounce_bus_dmamap_sync(bus_dma_tag_t dma
struct bounce_page *bpage;
vm_offset_t datavaddr, tempvaddr;
 
-   if ((bpage = STAILQ_FIRST(>bpages)) == NULL) {
-   /* Wait for any memory access to complete */
-   dsb(sy);
-   return;
-   }
-
/*
 * XXX ARM64TODO:
 * This bus_dma implementation requires IO-Coherent architecutre.
@@ -812,56 +806,63 @@ bounce_bus_dmamap_sync(bus_dma_tag_t dma
 * added to this function.
 */
 
-   CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x op 0x%x "
-   "performing bounce", __func__, dmat, dmat->common.flags, op);
-
-   if ((op & BUS_DMASYNC_PREWRITE) != 0) {
-   while (bpage != NULL) {
-   tempvaddr = 0;
-   datavaddr = bpage->datavaddr;
-   if (datavaddr == 0) {
-   tempvaddr =
-   pmap_quick_enter_page(bpage->datapage);
-   datavaddr = tempvaddr | bpage->dataoffs;
-   }
-
-   bcopy((void *)datavaddr,
-   (void *)bpage->vaddr, bpage->datacount);
-   if (tempvaddr != 0)
-   pmap_quick_remove_page(tempvaddr);
-   bpage = STAILQ_NEXT(bpage, links);
-   }
-   dmat->bounce_zone->total_bounced++;
-
-   /*
-* Wait for the bcopy to complete before any DMA operations.
-*/
-   dsb(sy);
-   }
-
if ((op & BUS_DMASYNC_POSTREAD) != 0) {
/*
 * Wait for any DMA operations to complete before the bcopy.
 */
dsb(sy);
+   }
 
-   while (bpage != NULL) {
-   tempvaddr = 0;
-   datavaddr = bpage->datavaddr;
-   if (datavaddr == 0) {
-   tempvaddr =
-   pmap_quick_enter_page(bpage->datapage);
-   datavaddr = tempvaddr | bpage->dataoffs;
+   if ((bpage = STAILQ_FIRST(>bpages)) != NULL) {
+   CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x op 0x%x "
+   "performing bounce", __func__, dmat, dmat->common.flags,
+   op);
+
+   if ((op & BUS_DMASYNC_PREWRITE) != 0) {
+   while (bpage != NULL) {
+   tempvaddr = 0;
+   datavaddr = bpage->datavaddr;
+   if (datavaddr == 0) {
+   tempvaddr = pmap_quick_enter_page(
+   bpage->datapage);
+   datavaddr = tempvaddr | bpage->dataoffs;
+   }
+
+   bcopy((void *)datavaddr,
+   (void *)bpage->vaddr, bpage->datacount);
+   if (tempvaddr != 0)
+   pmap_quick_remove_page(tempvaddr);
+   bpage = STAILQ_NEXT(bpage, links);
}
+   dmat->bounce_zone->total_bounced++;
+   }
 
-   bcopy((void *)bpage->vaddr,
-   (void *)datavaddr, bpage->datacount);
-
-   if (tempvaddr != 0)
-   pmap_quick_remove_page(tempvaddr);
-   bpage = STAILQ_NEXT(bpage, links);
+   if ((op & BUS_DMASYNC_POSTREAD) != 0) {
+   while (bpage != NULL) {
+   tempvaddr = 0;
+   datavaddr = bpage->datavaddr;
+   if (datavaddr == 0) {
+   tempvaddr = pmap_quick_enter_page(
+   bpage->datapage);
+   datavaddr = tempvaddr | bpage->dataoffs;
+   }
+
+   bcopy((void *)bpage->vaddr,
+   (void *)datavaddr, 

svn commit: r299370 - head/sys/arm64/cavium

2016-05-10 Thread Andrew Turner
Author: andrew
Date: Tue May 10 15:45:59 2016
New Revision: 299370
URL: https://svnweb.freebsd.org/changeset/base/299370

Log:
  Push the logic to talk with the MSI/MSI-X interrupt controller to the FDT
  attachment. This is where it will live when we import intrng as it will
  need to look at either the msi-parent or msi-map FDT properties.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/cavium/thunder_pcie_pem.c
  head/sys/arm64/cavium/thunder_pcie_pem_fdt.c

Modified: head/sys/arm64/cavium/thunder_pcie_pem.c
==
--- head/sys/arm64/cavium/thunder_pcie_pem.cTue May 10 15:04:24 2016
(r299369)
+++ head/sys/arm64/cavium/thunder_pcie_pem.cTue May 10 15:45:59 2016
(r299370)
@@ -128,9 +128,9 @@ static struct resource * thunder_pem_all
 int *, rman_res_t, rman_res_t, rman_res_t, u_int);
 static int thunder_pem_alloc_msi(device_t, device_t, int, int, int *);
 static int thunder_pem_release_msi(device_t, device_t, int, int *);
-static int thunder_pem_map_msi(device_t, device_t, int, uint64_t *, uint32_t 
*);
 static int thunder_pem_alloc_msix(device_t, device_t, int *);
 static int thunder_pem_release_msix(device_t, device_t, int);
+static int thunder_pem_map_msi(device_t, device_t, int, uint64_t *, uint32_t 
*);
 static int thunder_pem_attach(device_t);
 static int thunder_pem_deactivate_resource(device_t, device_t, int, int,
 struct resource *);
@@ -177,11 +177,11 @@ static device_method_t thunder_pem_metho
DEVMETHOD(pcib_maxslots,thunder_pem_maxslots),
DEVMETHOD(pcib_read_config, thunder_pem_read_config),
DEVMETHOD(pcib_write_config,thunder_pem_write_config),
-   DEVMETHOD(pcib_map_msi, thunder_pem_map_msi),
DEVMETHOD(pcib_alloc_msix,  thunder_pem_alloc_msix),
DEVMETHOD(pcib_release_msix,thunder_pem_release_msix),
DEVMETHOD(pcib_alloc_msi,   thunder_pem_alloc_msi),
DEVMETHOD(pcib_release_msi, thunder_pem_release_msi),
+   DEVMETHOD(pcib_map_msi, thunder_pem_map_msi),
 
DEVMETHOD_END
 };
@@ -327,37 +327,48 @@ static int
 thunder_pem_alloc_msi(device_t pci, device_t child, int count, int maxcount,
 int *irqs)
 {
+   device_t bus;
 
-   return (arm_alloc_msi(pci, child, count, maxcount, irqs));
+   bus = device_get_parent(pci);
+   return (PCIB_ALLOC_MSI(device_get_parent(bus), child, count, maxcount,
+   irqs));
 }
 
 static int
 thunder_pem_release_msi(device_t pci, device_t child, int count, int *irqs)
 {
+   device_t bus;
 
-   return (arm_release_msi(pci, child, count, irqs));
+   bus = device_get_parent(pci);
+   return (PCIB_RELEASE_MSI(device_get_parent(bus), child, count, irqs));
 }
 
 static int
-thunder_pem_map_msi(device_t pci, device_t child, int irq, uint64_t *addr,
-uint32_t *data)
+thunder_pem_alloc_msix(device_t pci, device_t child, int *irq)
 {
+   device_t bus;
 
-   return (arm_map_msi(pci, child, irq, addr, data));
+   bus = device_get_parent(pci);
+   return (PCIB_ALLOC_MSIX(device_get_parent(bus), child, irq));
 }
 
 static int
-thunder_pem_alloc_msix(device_t pci, device_t child, int *irq)
+thunder_pem_release_msix(device_t pci, device_t child, int irq)
 {
+   device_t bus;
 
-   return (arm_alloc_msix(pci, child, irq));
+   bus = device_get_parent(pci);
+   return (PCIB_RELEASE_MSIX(device_get_parent(bus), child, irq));
 }
 
 static int
-thunder_pem_release_msix(device_t pci, device_t child, int irq)
+thunder_pem_map_msi(device_t pci, device_t child, int irq, uint64_t *addr,
+uint32_t *data)
 {
+   device_t bus;
 
-   return (arm_release_msix(pci, child, irq));
+   bus = device_get_parent(pci);
+   return (PCIB_MAP_MSI(device_get_parent(bus), child, irq, addr, data));
 }
 
 static int

Modified: head/sys/arm64/cavium/thunder_pcie_pem_fdt.c
==
--- head/sys/arm64/cavium/thunder_pcie_pem_fdt.cTue May 10 15:04:24 
2016(r299369)
+++ head/sys/arm64/cavium/thunder_pcie_pem_fdt.cTue May 10 15:45:59 
2016(r299370)
@@ -51,15 +51,32 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include "thunder_pcie_common.h"
 #include "thunder_pcie_pem.h"
 
+#include "pcib_if.h"
+
 static int thunder_pem_fdt_probe(device_t);
+static int thunder_pem_fdt_alloc_msix(device_t, device_t, int *);
+static int thunder_pem_fdt_release_msix(device_t, device_t, int);
+static int thunder_pem_fdt_alloc_msi(device_t, device_t, int, int, int *);
+static int thunder_pem_fdt_release_msi(device_t, device_t, int, int *);
+static int thunder_pem_fdt_map_msi(device_t, device_t, int, uint64_t *,
+uint32_t *);
 
 static device_method_t 

svn commit: r298068 - in head/sys: arm/allwinner arm/altera/socfpga arm/amlogic/aml8726 arm/annapurna/alpine arm/arm arm/at91 arm/broadcom/bcm2835 arm/conf arm/freescale/imx arm/freescale/vybrid ar...

2016-04-15 Thread Andrew Turner
Author: andrew
Date: Fri Apr 15 16:05:41 2016
New Revision: 298068
URL: https://svnweb.freebsd.org/changeset/base/298068

Log:
  Rename ARM_INTRNG and MIPS_INTRNG to INTRNG. This will help with machine
  independent code that needs to know about INTRNG such as PCI drivers.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm/allwinner/a10_common.c
  head/sys/arm/altera/socfpga/socfpga_common.c
  head/sys/arm/amlogic/aml8726/aml8726_machdep.c
  head/sys/arm/annapurna/alpine/common.c
  head/sys/arm/arm/gic.c
  head/sys/arm/arm/machdep_intr.c
  head/sys/arm/arm/mp_machdep.c
  head/sys/arm/arm/nexus.c
  head/sys/arm/at91/at91_common.c
  head/sys/arm/broadcom/bcm2835/bcm2835_common.c
  head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
  head/sys/arm/broadcom/bcm2835/bcm2835_intr.c
  head/sys/arm/broadcom/bcm2835/bcm2836.c
  head/sys/arm/broadcom/bcm2835/bcm2836.h
  head/sys/arm/broadcom/bcm2835/bcm2836_mp.c
  head/sys/arm/conf/A20
  head/sys/arm/conf/ALPINE
  head/sys/arm/conf/ARMADA38X
  head/sys/arm/conf/BEAGLEBONE
  head/sys/arm/conf/EXYNOS5.common
  head/sys/arm/conf/IMX6
  head/sys/arm/conf/ODROIDC1
  head/sys/arm/conf/PANDABOARD
  head/sys/arm/conf/RK3188
  head/sys/arm/conf/RPI-B
  head/sys/arm/conf/RPI2
  head/sys/arm/conf/SOCKIT.common
  head/sys/arm/conf/VIRT
  head/sys/arm/conf/VSATV102
  head/sys/arm/conf/VYBRID
  head/sys/arm/conf/ZEDBOARD
  head/sys/arm/freescale/imx/imx6_machdep.c
  head/sys/arm/freescale/imx/imx_common.c
  head/sys/arm/freescale/imx/imx_gpio.c
  head/sys/arm/freescale/vybrid/vf_common.c
  head/sys/arm/include/intr.h
  head/sys/arm/include/smp.h
  head/sys/arm/lpc/lpc_intc.c
  head/sys/arm/mv/mpic.c
  head/sys/arm/mv/mv_common.c
  head/sys/arm/nvidia/tegra124/std.tegra124
  head/sys/arm/qemu/virt_common.c
  head/sys/arm/rockchip/rk30xx_common.c
  head/sys/arm/samsung/exynos/exynos5_common.c
  head/sys/arm/ti/aintc.c
  head/sys/arm/ti/ti_common.c
  head/sys/arm/ti/ti_gpio.c
  head/sys/arm/ti/ti_gpio.h
  head/sys/arm/versatile/versatile_common.c
  head/sys/arm/xilinx/zy7_machdep.c
  head/sys/conf/files.arm
  head/sys/conf/options.arm
  head/sys/conf/options.mips
  head/sys/dev/fdt/fdt_common.h
  head/sys/mips/include/intr.h
  head/sys/mips/include/smp.h
  head/sys/mips/mips/exception.S
  head/sys/mips/mips/nexus.c
  head/sys/mips/mips/tick.c

Modified: head/sys/arm/allwinner/a10_common.c
==
--- head/sys/arm/allwinner/a10_common.c Fri Apr 15 15:50:13 2016
(r298067)
+++ head/sys/arm/allwinner/a10_common.c Fri Apr 15 16:05:41 2016
(r298068)
@@ -42,7 +42,7 @@ struct fdt_fixup_entry fdt_fixup_table[]
{ NULL, NULL }
 };
 
-#ifndef ARM_INTRNG
+#ifndef INTRNG
 
 static int
 fdt_aintc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
@@ -69,4 +69,4 @@ fdt_pic_decode_t fdt_pic_table[] = {
NULL
 };
 
-#endif /* ARM_INTRNG */
+#endif /* INTRNG */

Modified: head/sys/arm/altera/socfpga/socfpga_common.c
==
--- head/sys/arm/altera/socfpga/socfpga_common.cFri Apr 15 15:50:13 
2016(r298067)
+++ head/sys/arm/altera/socfpga/socfpga_common.cFri Apr 15 16:05:41 
2016(r298068)
@@ -74,7 +74,7 @@ struct fdt_fixup_entry fdt_fixup_table[]
{ NULL, NULL }
 };
 
-#ifndef ARM_INTRNG
+#ifndef INTRNG
 static int
 fdt_pic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
 int *pol)

Modified: head/sys/arm/amlogic/aml8726/aml8726_machdep.c
==
--- head/sys/arm/amlogic/aml8726/aml8726_machdep.c  Fri Apr 15 15:50:13 
2016(r298067)
+++ head/sys/arm/amlogic/aml8726/aml8726_machdep.c  Fri Apr 15 16:05:41 
2016(r298068)
@@ -184,7 +184,7 @@ struct fdt_fixup_entry fdt_fixup_table[]
{ NULL, NULL }
 };
 
-#ifndef ARM_INTRNG
+#ifndef INTRNG
 #ifndef DEV_GIC
 static int
 fdt_pic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
@@ -213,4 +213,4 @@ fdt_pic_decode_t fdt_pic_table[] = {
 #endif
NULL
 };
-#endif /* ARM_INTRNG */
+#endif /* INTRNG */

Modified: head/sys/arm/annapurna/alpine/common.c
==
--- head/sys/arm/annapurna/alpine/common.c  Fri Apr 15 15:50:13 2016
(r298067)
+++ head/sys/arm/annapurna/alpine/common.c  Fri Apr 15 16:05:41 2016
(r298068)
@@ -136,7 +136,7 @@ infinite:
while (1) {}
 }
 
-#ifndef ARM_INTRNG
+#ifndef INTRNG
 static int
 alpine_pic_decode_fdt(uint32_t iparent, uint32_t *intr, int *interrupt,
 int *trig, int *pol)

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Fri Apr 15 15:50:13 2016(r298067)
+++ head/sys/arm/arm/gic.c  Fri Apr 15 16:05:41 

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

2016-04-15 Thread Andrew Turner
Author: andrew
Date: Fri Apr 15 14:28:34 2016
New Revision: 298054
URL: https://svnweb.freebsd.org/changeset/base/298054

Log:
  Add a flag field to struct gic_irqsrc and use it to mark when we should
  write to the End of Interrupt (EOI) register before handling the interrupt.
  This should be a noop as it will be set for all edge triggered interrupts,
  however this will not be the case for MSI interrupts. These are also edge
  triggered, however we should not write to the EOI register until later in
  arm_gic_pre_ithread.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Fri Apr 15 14:26:24 2016(r298053)
+++ head/sys/arm/arm/gic.c  Fri Apr 15 14:28:34 2016(r298054)
@@ -122,6 +122,8 @@ struct gic_irqsrc {
uint32_tgi_irq;
enum intr_polarity  gi_pol;
enum intr_trigger   gi_trig;
+#define GI_FLAG_EARLY_EOI  (1 << 0)
+   u_int   gi_flags;
 };
 
 static u_int gic_irq_cpu;
@@ -853,12 +855,12 @@ dispatch_irq:
 #ifdef GIC_DEBUG_SPURIOUS
sc->last_irq[PCPU_GET(cpuid)] = irq;
 #endif
-   if (gi->gi_trig == INTR_TRIGGER_EDGE)
+   if ((gi->gi_flags & GI_FLAG_EARLY_EOI) == GI_FLAG_EARLY_EOI)
gic_c_write_4(sc, GICC_EOIR, irq_active_reg);
 
if (intr_isrc_dispatch(>gi_isrc, tf) != 0) {
gic_irq_mask(sc, irq);
-   if (gi->gi_trig != INTR_TRIGGER_EDGE)
+   if ((gi->gi_flags & GI_FLAG_EARLY_EOI) != GI_FLAG_EARLY_EOI)
gic_c_write_4(sc, GICC_EOIR, irq_active_reg);
device_printf(sc->gic_dev, "Stray irq %u disabled\n", irq);
}
@@ -1087,6 +1089,9 @@ arm_gic_setup_intr(device_t dev, struct 
 
gi->gi_pol = pol;
gi->gi_trig = trig;
+   /* Edge triggered interrupts need an early EOI sent */
+   if (gi->gi_pol == INTR_TRIGGER_EDGE)
+   gi->gi_flags |= GI_FLAG_EARLY_EOI;
 
/*
 * XXX - In case that per CPU interrupt is going to be enabled in time
@@ -1160,7 +1165,7 @@ arm_gic_post_filter(device_t dev, struct
struct gic_irqsrc *gi = (struct gic_irqsrc *)isrc;
 
 /* EOI for edge-triggered done earlier. */
-   if (gi->gi_trig == INTR_TRIGGER_EDGE)
+   if ((gi->gi_flags & GI_FLAG_EARLY_EOI) == GI_FLAG_EARLY_EOI)
return;
 
arm_irq_memory_barrier(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: r298051 - head/sys/arm/arm

2016-04-15 Thread Andrew Turner
Author: andrew
Date: Fri Apr 15 14:19:25 2016
New Revision: 298051
URL: https://svnweb.freebsd.org/changeset/base/298051

Log:
  Add initial GICv2m support to the arm GIC driver. This will be used to
  support MSI and MSI-X interrupts, however intrng needs updates before this
  can happen.
  
  For now we just attach the driver until the MSI API is ready.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D5950

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

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Fri Apr 15 13:34:59 2016(r298050)
+++ head/sys/arm/arm/gic.c  Fri Apr 15 14:19:25 2016(r298051)
@@ -134,6 +134,19 @@ u_int sgi_first_unused = GIC_FIRST_SGI;
 #endif
 #endif
 
+#ifdef ARM_INTRNG
+struct arm_gic_range {
+   uint64_t bus;
+   uint64_t host;
+   uint64_t size;
+};
+
+struct arm_gic_devinfo {
+   struct ofw_bus_devinfo  obdinfo;
+   struct resource_listrl;
+};
+#endif
+
 struct arm_gic_softc {
device_tgic_dev;
 #ifdef ARM_INTRNG
@@ -151,6 +164,14 @@ struct arm_gic_softc {
 #ifdef GIC_DEBUG_SPURIOUS
uint32_tlast_irq[MAXCPU];
 #endif
+
+#ifdef ARM_INTRNG
+   /* FDT child data */
+   pcell_t addr_cells;
+   pcell_t size_cells;
+   int nranges;
+   struct arm_gic_range *  ranges;
+#endif
 };
 
 #ifdef ARM_INTRNG
@@ -195,6 +216,7 @@ static struct ofw_compat_data compat_dat
{"arm,cortex-a7-gic",   true},
{"arm,arm11mp-gic", true},
{"brcm,brahma-b15-gic", true},
+   {"qcom,msm-qgic2",  true},
{NULL,  false}
 };
 
@@ -437,6 +459,107 @@ arm_gic_register_isrcs(struct arm_gic_so
sc->nirqs = num;
return (0);
 }
+
+static int
+arm_gic_fill_ranges(phandle_t node, struct arm_gic_softc *sc)
+{
+   pcell_t host_cells;
+   cell_t *base_ranges;
+   ssize_t nbase_ranges;
+   int i, j, k;
+
+   host_cells = 1;
+   OF_getencprop(OF_parent(node), "#address-cells", _cells,
+   sizeof(host_cells));
+   sc->addr_cells = 2;
+   OF_getencprop(node, "#address-cells", >addr_cells,
+   sizeof(sc->addr_cells));
+   sc->size_cells = 2;
+   OF_getencprop(node, "#size-cells", >size_cells,
+   sizeof(sc->size_cells));
+
+   nbase_ranges = OF_getproplen(node, "ranges");
+   if (nbase_ranges < 0)
+   return (-1);
+   sc->nranges = nbase_ranges / sizeof(cell_t) /
+   (sc->addr_cells + host_cells + sc->size_cells);
+   if (sc->nranges == 0)
+   return (0);
+
+   sc->ranges = malloc(sc->nranges * sizeof(sc->ranges[0]),
+   M_DEVBUF, M_WAITOK);
+   base_ranges = malloc(nbase_ranges, M_DEVBUF, M_WAITOK);
+   OF_getencprop(node, "ranges", base_ranges, nbase_ranges);
+
+   for (i = 0, j = 0; i < sc->nranges; i++) {
+   sc->ranges[i].bus = 0;
+   for (k = 0; k < sc->addr_cells; k++) {
+   sc->ranges[i].bus <<= 32;
+   sc->ranges[i].bus |= base_ranges[j++];
+   }
+   sc->ranges[i].host = 0;
+   for (k = 0; k < host_cells; k++) {
+   sc->ranges[i].host <<= 32;
+   sc->ranges[i].host |= base_ranges[j++];
+   }
+   sc->ranges[i].size = 0;
+   for (k = 0; k < sc->size_cells; k++) {
+   sc->ranges[i].size <<= 32;
+   sc->ranges[i].size |= base_ranges[j++];
+   }
+   }
+
+   free(base_ranges, M_DEVBUF);
+   return (sc->nranges);
+}
+
+static bool
+arm_gic_add_children(device_t dev)
+{
+   struct arm_gic_softc *sc;
+   struct arm_gic_devinfo *dinfo;
+   phandle_t child, node;
+   device_t cdev;
+
+   sc = device_get_softc(dev);
+   node = ofw_bus_get_node(dev);
+
+   /* If we have no children don't probe for them */
+   child = OF_child(node);
+   if (child == 0)
+   return (false);
+
+   if (arm_gic_fill_ranges(node, sc) < 0) {
+   device_printf(dev, "Have a child, but no ranges\n");
+   return (false);
+   }
+
+   for (; child != 0; child = OF_peer(child)) {
+   dinfo = malloc(sizeof(*dinfo), M_DEVBUF, M_WAITOK | M_ZERO);
+
+   if (ofw_bus_gen_setup_devinfo(>obdinfo, child) != 0) {
+   free(dinfo, M_DEVBUF);
+   continue;
+   }
+
+   resource_list_init(>rl);
+   ofw_bus_reg_to_rl(dev, child, sc->addr_cells,
+   sc->size_cells, >rl);
+
+   cdev = device_add_child(dev, NULL, -1);
+   if (cdev == NULL) {
+   device_printf(dev, 

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

2016-04-18 Thread Andrew Turner
Author: andrew
Date: Mon Apr 18 10:37:50 2016
New Revision: 298202
URL: https://svnweb.freebsd.org/changeset/base/298202

Log:
  Pull the MSI/MSI-X handling functions out to help with INTRNG integration.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/pci/pci_host_generic.c

Modified: head/sys/dev/pci/pci_host_generic.c
==
--- head/sys/dev/pci/pci_host_generic.c Mon Apr 18 09:56:41 2016
(r298201)
+++ head/sys/dev/pci/pci_host_generic.c Mon Apr 18 10:37:50 2016
(r298202)
@@ -656,6 +656,63 @@ generic_pcie_deactivate_resource(device_
return (res);
 }
 
+static int
+generic_pcie_alloc_msi(device_t pci, device_t child, int count, int maxcount,
+int *irqs)
+{
+
+#if defined(__aarch64__)
+   return (arm_alloc_msi(pci, child, count, maxcount, irqs));
+#else
+   return (ENXIO);
+#endif
+}
+
+static int
+generic_pcie_release_msi(device_t pci, device_t child, int count, int *irqs)
+{
+
+#if defined(__aarch64__)
+   return (arm_release_msi(pci, child, count, irqs));
+#else
+   return (ENXIO);
+#endif
+}
+
+static int
+generic_pcie_map_msi(device_t pci, device_t child, int irq, uint64_t *addr,
+uint32_t *data)
+{
+
+#if defined(__aarch64__)
+   return (arm_map_msi(pci, child, irq, addr, data));
+#else
+   return (ENXIO);
+#endif
+}
+
+static int
+generic_pcie_alloc_msix(device_t pci, device_t child, int *irq)
+{
+
+#if defined(__aarch64__)
+   return (arm_alloc_msix(pci, child, irq));
+#else
+   return (ENXIO);
+#endif
+}
+
+static int
+generic_pcie_release_msix(device_t pci, device_t child, int irq)
+{
+
+#if defined(__aarch64__)
+   return (arm_release_msix(pci, child, irq));
+#else
+   return (ENXIO);
+#endif
+}
+
 static device_method_t generic_pcie_methods[] = {
DEVMETHOD(device_probe, generic_pcie_probe),
DEVMETHOD(device_attach,pci_host_generic_attach),
@@ -674,13 +731,11 @@ static device_method_t generic_pcie_meth
DEVMETHOD(pcib_route_interrupt, generic_pcie_route_interrupt),
DEVMETHOD(pcib_read_config, generic_pcie_read_config),
DEVMETHOD(pcib_write_config,generic_pcie_write_config),
-#if defined(__aarch64__)
-   DEVMETHOD(pcib_alloc_msi,   arm_alloc_msi),
-   DEVMETHOD(pcib_release_msi, arm_release_msi),
-   DEVMETHOD(pcib_alloc_msix,  arm_alloc_msix),
-   DEVMETHOD(pcib_release_msix,arm_release_msix),
-   DEVMETHOD(pcib_map_msi, arm_map_msi),
-#endif
+   DEVMETHOD(pcib_alloc_msi,   generic_pcie_alloc_msi),
+   DEVMETHOD(pcib_release_msi, generic_pcie_release_msi),
+   DEVMETHOD(pcib_alloc_msix,  generic_pcie_alloc_msix),
+   DEVMETHOD(pcib_release_msix,generic_pcie_release_msix),
+   DEVMETHOD(pcib_map_msi, generic_pcie_map_msi),
 
/* ofw_bus interface */
DEVMETHOD(ofw_bus_get_devinfo,  generic_pcie_ofw_get_devinfo),
___
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: r298344 - head/sys/arm64/cavium

2016-04-20 Thread Andrew Turner
Author: andrew
Date: Wed Apr 20 14:12:40 2016
New Revision: 298344
URL: https://svnweb.freebsd.org/changeset/base/298344

Log:
  Group the ThunderX PCIe PEM newbus methods to help find them.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/cavium/thunder_pcie_pem.c

Modified: head/sys/arm64/cavium/thunder_pcie_pem.c
==
--- head/sys/arm64/cavium/thunder_pcie_pem.cWed Apr 20 13:23:06 2016
(r298343)
+++ head/sys/arm64/cavium/thunder_pcie_pem.cWed Apr 20 14:12:40 2016
(r298344)
@@ -161,9 +161,8 @@ static device_method_t thunder_pem_metho
DEVMETHOD(device_probe, thunder_pem_probe),
DEVMETHOD(device_attach,thunder_pem_attach),
DEVMETHOD(device_detach,thunder_pem_detach),
-   DEVMETHOD(pcib_maxslots,thunder_pem_maxslots),
-   DEVMETHOD(pcib_read_config, thunder_pem_read_config),
-   DEVMETHOD(pcib_write_config,thunder_pem_write_config),
+
+   /* Bus interface */
DEVMETHOD(bus_read_ivar,thunder_pem_read_ivar),
DEVMETHOD(bus_write_ivar,   thunder_pem_write_ivar),
DEVMETHOD(bus_alloc_resource,   thunder_pem_alloc_resource),
@@ -174,6 +173,10 @@ static device_method_t thunder_pem_metho
DEVMETHOD(bus_setup_intr,   bus_generic_setup_intr),
DEVMETHOD(bus_teardown_intr,bus_generic_teardown_intr),
 
+   /* pcib interface */
+   DEVMETHOD(pcib_maxslots,thunder_pem_maxslots),
+   DEVMETHOD(pcib_read_config, thunder_pem_read_config),
+   DEVMETHOD(pcib_write_config,thunder_pem_write_config),
DEVMETHOD(pcib_map_msi, thunder_pem_map_msi),
DEVMETHOD(pcib_alloc_msix,  thunder_pem_alloc_msix),
DEVMETHOD(pcib_release_msix,thunder_pem_release_msix),
___
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: r297954 - in head/sys: boot/efi/loader/arch/amd64 boot/i386/libi386 x86/acpica

2016-04-14 Thread Andrew Turner
On Thu, 14 Apr 2016 04:59:51 + (UTC)
Warner Losh  wrote:

> Author: imp
> Date: Thu Apr 14 04:59:51 2016
> New Revision: 297954
> URL: https://svnweb.freebsd.org/changeset/base/297954
> 
> Log:
>   Deprecate using hints.acpi.0.rsdp to communicate the RSDP to the
>   system. This uses the hints mechnanism. This mostly works today
>   because when there's no static hints (the default), this value can
> be fetched from the hint. When there is a static hints file, the hint
>   passed from the boot loader to the kernel is ignored, but for the
> BIOS case we're able to find it anyway. However, with UEFI, the
> fallback doesn't work, so we get a panic instead.
>   
>   Switch to acpi.rsdp and use TUNABLE_ULONG_FETCH instead. Continue to
>   generate the old values to allow for transitions. In addition, fall
>   back to the old method if the new method isn't present.
>   
>   Add comments about all this.
>   
>   Differential Revision: https://reviews.freebsd.org/D5866

Why not pass it in using module data as we do with the DTB? It would
fix issues where we have either or both static hints and a stat env.

Whatever method is decided we will also need it on arm64 as we claim to
support ACPI there, although no backwards compatibility will be needed
as the code is most likely broken as it's only partially been tested.

Andrew
___
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: r297969 - head/sys/arm64/arm64

2016-04-14 Thread Andrew Turner
Author: andrew
Date: Thu Apr 14 14:44:23 2016
New Revision: 297969
URL: https://svnweb.freebsd.org/changeset/base/297969

Log:
  Fix the types for the start, end, and count arguments to
  arm_gic_fdt_alloc_resource. These were the old u_long where they should be
  rman_res_t. Both of these are the same size on arm64 so this is just for
  correctness, and would not have led to incorrect behaviour.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/gic_fdt.c

Modified: head/sys/arm64/arm64/gic_fdt.c
==
--- head/sys/arm64/arm64/gic_fdt.c  Thu Apr 14 14:11:32 2016
(r297968)
+++ head/sys/arm64/arm64/gic_fdt.c  Thu Apr 14 14:44:23 2016
(r297969)
@@ -198,7 +198,7 @@ arm_gic_fdt_attach(device_t dev)
 
 static struct resource *
 arm_gic_fdt_alloc_resource(device_t bus, device_t child, int type, int *rid,
-u_long start, u_long end, u_long count, u_int flags)
+rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
 {
struct arm_gic_fdt_softc *sc = device_get_softc(bus);
struct gic_devinfo *di;
___
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: r297972 - head/sys/conf

2016-04-14 Thread Andrew Turner
Author: andrew
Date: Thu Apr 14 15:52:11 2016
New Revision: 297972
URL: https://svnweb.freebsd.org/changeset/base/297972

Log:
  Sort so pic_if.m is in the correct location with the other kern files.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/conf/files.arm

Modified: head/sys/conf/files.arm
==
--- head/sys/conf/files.arm Thu Apr 14 15:31:05 2016(r297971)
+++ head/sys/conf/files.arm Thu Apr 14 15:52:11 2016(r297972)
@@ -57,7 +57,6 @@ arm/arm/mpcore_timer.coptionalmpcore_
 arm/arm/nexus.cstandard
 arm/arm/ofw_machdep.c  optionalfdt
 arm/arm/physmem.c  standard
-kern/pic_if.m  optionalarm_intrng
 arm/arm/pl190.coptionalpl190
 arm/arm/pl310.coptionalpl310
 arm/arm/platform.c optionalplatform
@@ -116,6 +115,7 @@ font.h  optionalsc  
\
compile-with"uudecode < 
/usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'u_char 
dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < 
/usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'u_char 
dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < 
/usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'u_char 
dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h" \
no-obj no-implicit-rule before-depend   \
clean   "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 
${SC_DFLT_FONT}-8x8"
+kern/pic_if.m  optionalarm_intrng
 kern/subr_busdma_bufalloc.cstandard
 kern/subr_sfbuf.c  standard
 libkern/arm/aeabi_unwind.c standard
___
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: r298403 - head/sys/arm/arm

2016-04-21 Thread Andrew Turner
Author: andrew
Date: Thu Apr 21 14:04:56 2016
New Revision: 298403
URL: https://svnweb.freebsd.org/changeset/base/298403

Log:
  Make the GIC SGI global variables static, they are only ever used within
  within this file.
  
  Approved by:  ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Thu Apr 21 13:14:55 2016(r298402)
+++ head/sys/arm/arm/gic.c  Thu Apr 21 14:04:56 2016(r298403)
@@ -131,8 +131,8 @@ static int arm_gic_intr(void *);
 static int arm_gic_bind_intr(device_t dev, struct intr_irqsrc *isrc);
 
 #ifdef SMP
-u_int sgi_to_ipi[GIC_LAST_SGI - GIC_FIRST_SGI + 1];
-u_int sgi_first_unused = GIC_FIRST_SGI;
+static u_int sgi_to_ipi[GIC_LAST_SGI - GIC_FIRST_SGI + 1];
+static u_int sgi_first_unused = GIC_FIRST_SGI;
 #endif
 #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: r299257 - head/sys/kern

2016-05-09 Thread Andrew Turner
Author: andrew
Date: Mon May  9 12:24:39 2016
New Revision: 299257
URL: https://svnweb.freebsd.org/changeset/base/299257

Log:
  Check malloc succeeded in pic_create, with M_NOWAIT it may return NULL.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/subr_intr.c

Modified: head/sys/kern/subr_intr.c
==
--- head/sys/kern/subr_intr.c   Mon May  9 11:52:57 2016(r299256)
+++ head/sys/kern/subr_intr.c   Mon May  9 12:24:39 2016(r299257)
@@ -871,6 +871,10 @@ pic_create(device_t dev, intptr_t xref)
return (pic);
}
pic = malloc(sizeof(*pic), M_INTRNG, M_NOWAIT | M_ZERO);
+   if (pic == NULL) {
+   mtx_unlock(_list_lock);
+   return (NULL);
+   }
pic->pic_xref = xref;
pic->pic_dev = dev;
SLIST_INSERT_HEAD(_list, pic, pic_next);
___
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: r302601 - in head/sys: arm/include arm64/include

2016-07-12 Thread Andrew Turner
On Tue, 12 Jul 2016 00:37:48 + (UTC)
"Andrey A. Chernov"  wrote:

> Author: ache
> Date: Tue Jul 12 00:37:48 2016
> New Revision: 302601
> URL: https://svnweb.freebsd.org/changeset/base/302601
> 
> Log:
>   I don't know why unsigned int is choosed for wchar_t here, but
> WCHAR_MAX should be <= WINT_MAX. It is bigger, __UINT_MAX > INT32_MAX

Because the ABI either requires us to use an unsigned int [1], or the
preferred type is unsigned int [2]. In the latter case the other choice
is unsigned short, it would seem this is for Windows.

Andrew

[1]
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055c/IHI0055C_beta_aapcs64.pdf
[2]
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042f/IHI0042F_aapcs.pdf
___
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: r302849 - head/sys/arm64/arm64

2016-07-14 Thread Andrew Turner
Author: andrew
Date: Thu Jul 14 17:10:54 2016
New Revision: 302849
URL: https://svnweb.freebsd.org/changeset/base/302849

Log:
  Move structures only used by the GICv3 ITS driver from a shared header to
  the ITS driver file. There is no need for other drivers to need to know
  about these structures.
  
  Obtained from:ABT Systems Ltd
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/gic_v3_var.h
  head/sys/arm64/arm64/gicv3_its.c

Modified: head/sys/arm64/arm64/gic_v3_var.h
==
--- head/sys/arm64/arm64/gic_v3_var.h   Thu Jul 14 17:05:25 2016
(r302848)
+++ head/sys/arm64/arm64/gic_v3_var.h   Thu Jul 14 17:10:54 2016
(r302849)
@@ -108,87 +108,6 @@ void gic_r_write_4(device_t, bus_size_t,
 void gic_r_write_8(device_t, bus_size_t, uint64_t var);
 
 /*
- * ITS
- */
-
-/* LPI chunk owned by ITS device */
-struct lpi_chunk {
-   u_int   lpi_base;
-   u_int   lpi_free;   /* First free LPI in set */
-   u_int   lpi_num;/* Total number of LPIs in chunk */
-   u_int   lpi_busy;   /* Number of busy LPIs in chink */
-};
-
-/* ITS device */
-struct its_dev {
-   TAILQ_ENTRY(its_dev)entry;
-   /* PCI device */
-   device_tpci_dev;
-   /* Device ID (i.e. PCI device ID) */
-   uint32_tdevid;
-   /* List of assigned LPIs */
-   struct lpi_chunklpis;
-   /* Virtual address of ITT */
-   vm_offset_t itt;
-   size_t  itt_size;
-};
-
-/*
- * ITS command descriptor.
- * Idea for command description passing taken from Linux.
- */
-struct its_cmd_desc {
-   uint8_t cmd_type;
-
-   union {
-   struct {
-   struct its_dev *its_dev;
-   struct its_col *col;
-   uint32_t id;
-   } cmd_desc_movi;
-
-   struct {
-   struct its_col *col;
-   } cmd_desc_sync;
-
-   struct {
-   struct its_col *col;
-   uint8_t valid;
-   } cmd_desc_mapc;
-
-   struct {
-   struct its_dev *its_dev;
-   struct its_col *col;
-   uint32_t pid;
-   uint32_t id;
-   } cmd_desc_mapvi;
-
-   struct {
-   struct its_dev *its_dev;
-   struct its_col *col;
-   uint32_t pid;
-   } cmd_desc_mapi;
-
-   struct {
-   struct its_dev *its_dev;
-   uint8_t valid;
-   } cmd_desc_mapd;
-
-   struct {
-   struct its_dev *its_dev;
-   struct its_col *col;
-   uint32_t pid;
-   } cmd_desc_inv;
-
-   struct {
-   struct its_col *col;
-   } cmd_desc_invall;
-   };
-};
-
-#defineITS_TARGET_NONE 0xFBADBEEF
-
-/*
  * GIC Distributor accessors.
  * Notice that only GIC sofc can be passed.
  */

Modified: head/sys/arm64/arm64/gicv3_its.c
==
--- head/sys/arm64/arm64/gicv3_its.cThu Jul 14 17:05:25 2016
(r302848)
+++ head/sys/arm64/arm64/gicv3_its.cThu Jul 14 17:10:54 2016
(r302849)
@@ -123,6 +123,83 @@ MALLOC_DEFINE(M_GICV3_ITS, "GICv3 ITS",
 #defineCMD_VALID_SHIFT (63)
 #defineCMD_VALID_MASK  (1UL << CMD_VALID_SHIFT)
 
+#defineITS_TARGET_NONE 0xFBADBEEF
+
+/* LPI chunk owned by ITS device */
+struct lpi_chunk {
+   u_int   lpi_base;
+   u_int   lpi_free;   /* First free LPI in set */
+   u_int   lpi_num;/* Total number of LPIs in chunk */
+   u_int   lpi_busy;   /* Number of busy LPIs in chink */
+};
+
+/* ITS device */
+struct its_dev {
+   TAILQ_ENTRY(its_dev)entry;
+   /* PCI device */
+   device_tpci_dev;
+   /* Device ID (i.e. PCI device ID) */
+   uint32_tdevid;
+   /* List of assigned LPIs */
+   struct lpi_chunklpis;
+   /* Virtual address of ITT */
+   vm_offset_t itt;
+   size_t  itt_size;
+};
+
+/*
+ * ITS command descriptor.
+ * Idea for command description passing taken from Linux.
+ */
+struct its_cmd_desc {
+   uint8_t cmd_type;
+
+   union {
+   struct {
+   struct its_dev *its_dev;
+   struct its_col *col;
+   uint32_t id;
+   } cmd_desc_movi;
+
+   struct {
+   struct its_col *col;
+   } cmd_desc_sync;
+
+   struct {
+   struct its_col *col;

svn commit: r302851 - head/sys/arm64/arm64

2016-07-14 Thread Andrew Turner
Author: andrew
Date: Thu Jul 14 17:16:51 2016
New Revision: 302851
URL: https://svnweb.freebsd.org/changeset/base/302851

Log:
  Move gic_v3_irqsrc into the GICv3 driver source as it's only needed there.
  Remove unused macros from the GICv3 header.
  
  Obtained from:ABT Systems Ltd
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/gic_v3.c
  head/sys/arm64/arm64/gic_v3_var.h

Modified: head/sys/arm64/arm64/gic_v3.c
==
--- head/sys/arm64/arm64/gic_v3.c   Thu Jul 14 17:16:10 2016
(r302850)
+++ head/sys/arm64/arm64/gic_v3.c   Thu Jul 14 17:16:51 2016
(r302851)
@@ -134,6 +134,13 @@ enum gic_v3_xdist {
REDIST,
 };
 
+struct gic_v3_irqsrc {
+   struct intr_irqsrc  gi_isrc;
+   uint32_tgi_irq;
+   enum intr_polarity  gi_pol;
+   enum intr_trigger   gi_trig;
+};
+
 /* Helper routines starting with gic_v3_ */
 static int gic_v3_dist_init(struct gic_v3_softc *);
 static int gic_v3_redist_alloc(struct gic_v3_softc *);

Modified: head/sys/arm64/arm64/gic_v3_var.h
==
--- head/sys/arm64/arm64/gic_v3_var.h   Thu Jul 14 17:16:10 2016
(r302850)
+++ head/sys/arm64/arm64/gic_v3_var.h   Thu Jul 14 17:16:51 2016
(r302851)
@@ -36,12 +36,7 @@
 
 DECLARE_CLASS(gic_v3_driver);
 
-struct gic_v3_irqsrc {
-   struct intr_irqsrc  gi_isrc;
-   uint32_tgi_irq;
-   enum intr_polarity  gi_pol;
-   enum intr_trigger   gi_trig;
-};
+struct gic_v3_irqsrc;
 
 struct redist_lpis {
vm_offset_t conf_base;
@@ -140,27 +135,4 @@ void gic_r_write_8(device_t, bus_size_t,
reg, val);  \
 })
 
-#definePCI_DEVID_GENERIC(pci_dev)  \
-({ \
-   ((pci_get_domain(pci_dev) << PCI_RID_DOMAIN_SHIFT) |\
-   (pci_get_bus(pci_dev) << PCI_RID_BUS_SHIFT) |   \
-   (pci_get_slot(pci_dev) << PCI_RID_SLOT_SHIFT) | \
-   (pci_get_function(pci_dev) << PCI_RID_FUNC_SHIFT)); \
-})
-
-/*
- * Request number of maximum MSI-X vectors for this device.
- * Device can ask for less vectors than maximum supported but not more.
- */
-#definePCI_MSIX_NUM(pci_dev)   \
-({ \
-   struct pci_devinfo *dinfo;  \
-   pcicfgregs *cfg;\
-   \
-   dinfo = device_get_ivars(pci_dev);  \
-   cfg = >cfg;  \
-   \
-   cfg->msix.msix_msgnum;  \
-})
-
 #endif /* _GIC_V3_VAR_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: r302847 - head/sys/dev/pci

2016-07-14 Thread Andrew Turner
Author: andrew
Date: Thu Jul 14 16:52:18 2016
New Revision: 302847
URL: https://svnweb.freebsd.org/changeset/base/302847

Log:
  Remove support for the arm64 pre-INTRNG interrupt framework from the PCI
  driver. Support for this was removed in r302375.
  
  Obtained from:ABT Systems Ltd
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/pci/pci_host_generic.c

Modified: head/sys/dev/pci/pci_host_generic.c
==
--- head/sys/dev/pci/pci_host_generic.c Thu Jul 14 15:39:31 2016
(r302846)
+++ head/sys/dev/pci/pci_host_generic.c Thu Jul 14 16:52:18 2016
(r302847)
@@ -724,8 +724,6 @@ generic_pcie_alloc_msi(device_t pci, dev
NULL);
return (intr_alloc_msi(pci, child, msi_parent, count, maxcount,
irqs));
-#elif defined(__aarch64__)
-   return (arm_alloc_msi(pci, child, count, maxcount, irqs));
 #else
return (ENXIO);
 #endif
@@ -740,8 +738,6 @@ generic_pcie_release_msi(device_t pci, d
ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
NULL);
return (intr_release_msi(pci, child, msi_parent, count, irqs));
-#elif defined(__aarch64__)
-   return (arm_release_msi(pci, child, count, irqs));
 #else
return (ENXIO);
 #endif
@@ -757,8 +753,6 @@ generic_pcie_map_msi(device_t pci, devic
ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
NULL);
return (intr_map_msi(pci, child, msi_parent, irq, addr, data));
-#elif defined(__aarch64__)
-   return (arm_map_msi(pci, child, irq, addr, data));
 #else
return (ENXIO);
 #endif
@@ -773,8 +767,6 @@ generic_pcie_alloc_msix(device_t pci, de
ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
NULL);
return (intr_alloc_msix(pci, child, msi_parent, irq));
-#elif defined(__aarch64__)
-   return (arm_alloc_msix(pci, child, irq));
 #else
return (ENXIO);
 #endif
@@ -789,8 +781,6 @@ generic_pcie_release_msix(device_t pci, 
ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
NULL);
return (intr_release_msix(pci, child, msi_parent, irq));
-#elif defined(__aarch64__)
-   return (arm_release_msix(pci, child, irq));
 #else
return (ENXIO);
 #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: r302848 - head/sys/arm64/arm64

2016-07-14 Thread Andrew Turner
Author: andrew
Date: Thu Jul 14 17:05:25 2016
New Revision: 302848
URL: https://svnweb.freebsd.org/changeset/base/302848

Log:
  Remove the non-INTRNG support from the GICv3 interrupt controller driver.
  This is no longer needed.
  
  Obtained from:ABT Systems Ltd
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/gic_v3.c
  head/sys/arm64/arm64/gic_v3_fdt.c
  head/sys/arm64/arm64/gic_v3_var.h

Modified: head/sys/arm64/arm64/gic_v3.c
==
--- head/sys/arm64/arm64/gic_v3.c   Thu Jul 14 16:52:18 2016
(r302847)
+++ head/sys/arm64/arm64/gic_v3.c   Thu Jul 14 17:05:25 2016
(r302848)
@@ -69,7 +69,6 @@ __FBSDID("$FreeBSD$");
 
 static bus_read_ivar_t gic_v3_read_ivar;
 
-#ifdef INTRNG
 static pic_disable_intr_t gic_v3_disable_intr;
 static pic_enable_intr_t gic_v3_enable_intr;
 static pic_map_intr_t gic_v3_map_intr;
@@ -90,18 +89,6 @@ static u_int gic_irq_cpu;
 static u_int sgi_to_ipi[GIC_LAST_SGI - GIC_FIRST_SGI + 1];
 static u_int sgi_first_unused = GIC_FIRST_SGI;
 #endif
-#else
-/* Device and PIC methods */
-static int gic_v3_bind(device_t, u_int, u_int);
-static void gic_v3_dispatch(device_t, struct trapframe *);
-static void gic_v3_eoi(device_t, u_int);
-static void gic_v3_mask_irq(device_t, u_int);
-static void gic_v3_unmask_irq(device_t, u_int);
-#ifdef SMP
-static void gic_v3_init_secondary(device_t);
-static void gic_v3_ipi_send(device_t, cpuset_t, u_int);
-#endif
-#endif
 
 static device_method_t gic_v3_methods[] = {
/* Device interface */
@@ -110,7 +97,6 @@ static device_method_t gic_v3_methods[] 
/* Bus interface */
DEVMETHOD(bus_read_ivar,gic_v3_read_ivar),
 
-#ifdef INTRNG
/* Interrupt controller interface */
DEVMETHOD(pic_disable_intr, gic_v3_disable_intr),
DEVMETHOD(pic_enable_intr,  gic_v3_enable_intr),
@@ -126,18 +112,6 @@ static device_method_t gic_v3_methods[] 
DEVMETHOD(pic_ipi_send, gic_v3_ipi_send),
DEVMETHOD(pic_ipi_setup,gic_v3_ipi_setup),
 #endif
-#else
-   /* PIC interface */
-   DEVMETHOD(pic_bind, gic_v3_bind),
-   DEVMETHOD(pic_dispatch, gic_v3_dispatch),
-   DEVMETHOD(pic_eoi,  gic_v3_eoi),
-   DEVMETHOD(pic_mask, gic_v3_mask_irq),
-   DEVMETHOD(pic_unmask,   gic_v3_unmask_irq),
-#ifdef SMP
-   DEVMETHOD(pic_init_secondary,   gic_v3_init_secondary),
-   DEVMETHOD(pic_ipi_send, gic_v3_ipi_send),
-#endif
-#endif
 
/* End */
DEVMETHOD_END
@@ -188,7 +162,6 @@ static gic_v3_initseq_t gic_v3_secondary
 };
 #endif
 
-#ifdef INTRNG
 uint32_t
 gic_r_read_4(device_t dev, bus_size_t offset)
 {
@@ -224,7 +197,6 @@ gic_r_write_8(device_t dev, bus_size_t o
sc = device_get_softc(dev);
bus_write_8(sc->gic_redists.pcpu[PCPU_GET(cpuid)], offset, val);
 }
-#endif
 
 /*
  * Device interface.
@@ -238,10 +210,8 @@ gic_v3_attach(device_t dev)
int rid;
int err;
size_t i;
-#ifdef INTRNG
u_int irq;
const char *name;
-#endif
 
sc = device_get_softc(dev);
sc->gic_registered = FALSE;
@@ -290,7 +260,6 @@ gic_v3_attach(device_t dev)
if (sc->gic_nirqs > GIC_I_NUM_MAX)
sc->gic_nirqs = GIC_I_NUM_MAX;
 
-#ifdef INTRNG
sc->gic_irqs = malloc(sizeof(*sc->gic_irqs) * sc->gic_nirqs,
M_GIC_V3, M_WAITOK | M_ZERO);
name = device_get_nameunit(dev);
@@ -318,7 +287,6 @@ gic_v3_attach(device_t dev)
return (err);
}
}
-#endif
 
/* Get the number of supported interrupt identifier bits */
sc->gic_idbits = GICD_TYPER_IDBITS(typer);
@@ -334,14 +302,6 @@ gic_v3_attach(device_t dev)
if (err != 0)
return (err);
}
-   /*
-* Full success.
-* Now register PIC to the interrupts handling layer.
-*/
-#ifndef INTRNG
-   arm_register_root_pic(dev, sc->gic_nirqs);
-   sc->gic_registered = TRUE;
-#endif
 
return (0);
 }
@@ -394,7 +354,6 @@ gic_v3_read_ivar(device_t dev, device_t 
return (ENOENT);
 }
 
-#ifdef INTRNG
 int
 arm_gic_v3_intr(void *arg)
 {
@@ -914,215 +873,6 @@ gic_v3_ipi_setup(device_t dev, u_int ipi
return (0);
 }
 #endif /* SMP */
-#else /* INTRNG */
-/*
- * PIC interface.
- */
-
-static int
-gic_v3_bind(device_t dev, u_int irq, u_int cpuid)
-{
-   uint64_t aff;
-   struct gic_v3_softc *sc;
-
-   sc = device_get_softc(dev);
-
-   if (irq <= GIC_LAST_PPI) {
-   /* Can't bind PPI to another CPU but it's not an error */
-   return (0);
-   } else if (irq >= GIC_FIRST_SPI && irq <= GIC_LAST_SPI) {
-   aff = CPU_AFFINITY(cpuid);
-   gic_d_write(sc, 4, GICD_IROUTER(irq), aff);
-   return (0);
-   } else if (irq >= 

svn commit: r302852 - head/sys/arm64/cavium

2016-07-14 Thread Andrew Turner
Author: andrew
Date: Thu Jul 14 17:23:49 2016
New Revision: 302852
URL: https://svnweb.freebsd.org/changeset/base/302852

Log:
  Remove the non-INTRNG support from the ThunderX PCIe drivers.
  
  Obtained from:ABT Systems Ltd
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/cavium/thunder_pcie_pem_fdt.c

Modified: head/sys/arm64/cavium/thunder_pcie_pem_fdt.c
==
--- head/sys/arm64/cavium/thunder_pcie_pem_fdt.cThu Jul 14 17:16:51 
2016(r302851)
+++ head/sys/arm64/cavium/thunder_pcie_pem_fdt.cThu Jul 14 17:23:49 
2016(r302852)
@@ -109,7 +109,6 @@ thunder_pem_fdt_probe(device_t dev)
return (ENXIO);
 }
 
-#ifdef INTRNG
 static int
 thunder_pem_fdt_alloc_msi(device_t pci, device_t child, int count, int 
maxcount,
 int *irqs)
@@ -162,44 +161,6 @@ thunder_pem_fdt_map_msi(device_t pci, de
NULL);
return (intr_map_msi(pci, child, msi_parent, irq, addr, data));
 }
-#else
-static int
-thunder_pem_fdt_alloc_msi(device_t pci, device_t child, int count, int 
maxcount,
-int *irqs)
-{
-
-   return (arm_alloc_msi(pci, child, count, maxcount, irqs));
-}
-
-static int
-thunder_pem_fdt_release_msi(device_t pci, device_t child, int count, int *irqs)
-{
-
-   return (arm_release_msi(pci, child, count, irqs));
-}
-
-static int
-thunder_pem_fdt_alloc_msix(device_t pci, device_t child, int *irq)
-{
-
-   return (arm_alloc_msix(pci, child, irq));
-}
-
-static int
-thunder_pem_fdt_release_msix(device_t pci, device_t child, int irq)
-{
-
-   return (arm_release_msix(pci, child, irq));
-}
-
-static int
-thunder_pem_fdt_map_msi(device_t pci, device_t child, int irq, uint64_t *addr,
-uint32_t *data)
-{
-
-   return (arm_map_msi(pci, child, irq, addr, data));
-}
-#endif
 
 static int
 thunder_pem_fdt_get_id(device_t dev, device_t child, enum pci_id_type type,
___
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: r302853 - in head/sys/arm64: arm64 include

2016-07-14 Thread Andrew Turner
Author: andrew
Date: Thu Jul 14 17:31:29 2016
New Revision: 302853
URL: https://svnweb.freebsd.org/changeset/base/302853

Log:
  Finish removing the non-INTRNG support from sys/arm64.
  
  Obtained from:ABT Systems Ltd
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/autoconf.c
  head/sys/arm64/arm64/mp_machdep.c
  head/sys/arm64/arm64/nexus.c
  head/sys/arm64/include/intr.h

Modified: head/sys/arm64/arm64/autoconf.c
==
--- head/sys/arm64/arm64/autoconf.c Thu Jul 14 17:23:49 2016
(r302852)
+++ head/sys/arm64/arm64/autoconf.c Thu Jul 14 17:31:29 2016
(r302853)
@@ -81,12 +81,8 @@ static void
 configure_final(void *dummy)
 {
 
-#ifdef INTRNG
/* Enable interrupt reception on this CPU */
intr_enable();
-#else
-   arm_enable_intr();
-#endif
cninit_finish(); 
 
if (bootverbose)

Modified: head/sys/arm64/arm64/mp_machdep.c
==
--- head/sys/arm64/arm64/mp_machdep.c   Thu Jul 14 17:23:49 2016
(r302852)
+++ head/sys/arm64/arm64/mp_machdep.c   Thu Jul 14 17:31:29 2016
(r302853)
@@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#ifdef INTRNG
 #include "pic_if.h"
 
 typedef void intr_ipi_send_t(void *, cpuset_t, u_int);
@@ -86,7 +85,6 @@ static struct intr_ipi ipi_sources[INTR_
 static struct intr_ipi *intr_ipi_lookup(u_int);
 static void intr_pic_ipi_setup(u_int, const char *, intr_ipi_handler_t *,
 void *);
-#endif /* INTRNG */
 
 boolean_t ofw_cpu_reg(phandle_t node, u_int, cell_t *);
 
@@ -214,18 +212,12 @@ release_aps(void *dummy __unused)
 {
int cpu, i;
 
-#ifdef INTRNG
intr_pic_ipi_setup(IPI_AST, "ast", ipi_ast, NULL);
intr_pic_ipi_setup(IPI_PREEMPT, "preempt", ipi_preempt, NULL);
intr_pic_ipi_setup(IPI_RENDEZVOUS, "rendezvous", ipi_rendezvous, NULL);
intr_pic_ipi_setup(IPI_STOP, "stop", ipi_stop, NULL);
intr_pic_ipi_setup(IPI_STOP_HARD, "stop hard", ipi_stop, NULL);
intr_pic_ipi_setup(IPI_HARDCLOCK, "hardclock", ipi_hardclock, NULL);
-#else
-   /* Setup the IPI handler */
-   for (i = 0; i < INTR_IPI_COUNT; i++)
-   arm_setup_ipihandler(ipi_handler, i);
-#endif
 
atomic_store_rel_int(_ready, 1);
/* Wake up the other CPUs */
@@ -253,9 +245,6 @@ void
 init_secondary(uint64_t cpu)
 {
struct pcpu *pcpup;
-#ifndef INTRNG
-   int i;
-#endif
 
pcpup = &__pcpu[cpu];
/*
@@ -282,15 +271,7 @@ init_secondary(uint64_t cpu)
 */
identify_cpu();
 
-#ifdef INTRNG
intr_pic_init_secondary();
-#else
-   /* Configure the interrupt controller */
-   arm_init_secondary();
-
-   for (i = 0; i < INTR_IPI_COUNT; i++)
-   arm_unmask_ipi(i);
-#endif
 
/* Start per-CPU event timers. */
cpu_initclocks_ap();
@@ -322,7 +303,6 @@ init_secondary(uint64_t cpu)
/* NOTREACHED */
 }
 
-#ifdef INTRNG
 /*
  *  Send IPI thru interrupt controller.
  */
@@ -378,7 +358,6 @@ intr_ipi_send(cpuset_t cpus, u_int ipi)
 
ii->ii_send(ii->ii_send_arg, cpus, ipi);
 }
-#endif
 
 static void
 ipi_ast(void *dummy __unused)
@@ -432,44 +411,6 @@ ipi_stop(void *dummy __unused)
CTR0(KTR_SMP, "IPI_STOP (restart)");
 }
 
-#ifndef INTRNG
-static int
-ipi_handler(void *arg)
-{
-   u_int cpu, ipi;
-
-   arg = (void *)((uintptr_t)arg & ~(1 << 16));
-   KASSERT((uintptr_t)arg < INTR_IPI_COUNT,
-   ("Invalid IPI %ju", (uintptr_t)arg));
-
-   cpu = PCPU_GET(cpuid);
-   ipi = (uintptr_t)arg;
-
-   switch(ipi) {
-   case IPI_AST:
-   ipi_ast(NULL);
-   break;
-   case IPI_PREEMPT:
-   ipi_preempt(NULL);
-   break;
-   case IPI_RENDEZVOUS:
-   ipi_rendezvous(NULL);
-   break;
-   case IPI_STOP:
-   case IPI_STOP_HARD:
-   ipi_stop(NULL);
-   break;
-   case IPI_HARDCLOCK:
-   ipi_hardclock(NULL);
-   break;
-   default:
-   panic("Unknown IPI %#0x on cpu %d", ipi, curcpu);
-   }
-
-   return (FILTER_HANDLED);
-}
-#endif
-
 struct cpu_group *
 cpu_topo(void)
 {
@@ -624,7 +565,6 @@ cpu_mp_setmaxid(void)
mp_maxid = 0;
 }
 
-#ifdef INTRNG
 /*
  *  Lookup IPI source.
  */
@@ -768,4 +708,3 @@ ipi_selected(cpuset_t cpus, u_int ipi)
CTR2(KTR_SMP, "%s: ipi: %x", __func__, ipi);
intr_ipi_send(cpus, ipi);
 }
-#endif /* INTRNG */

Modified: head/sys/arm64/arm64/nexus.c
==
--- head/sys/arm64/arm64/nexus.cThu Jul 14 17:23:49 2016
(r302852)
+++ head/sys/arm64/arm64/nexus.cThu Jul 14 17:31:29 2016
(r302853)
@@ -271,13 +271,9 @@ nexus_config_intr(device_t dev, int irq,
 enum 

<    5   6   7   8   9   10   11   12   13   14   >