Some arm64 cleanup

2018-05-28 Thread Mark Kettenis
machine_reg.h is completely unused
swi.h is referenced from libc's SYS.h but nothing from that file is used
bootconfig.h has some junk that isn't really used

The MAX_BOOT_STRING define in bootconfig.h doesn't really serve a
purpose anymore.  Simply use a fixed-size buffer and strlcpy the
results into it using sizeof.

ok?

Index: sys/arch/arm64/include/bootconfig.h
===
RCS file: /cvs/src/sys/arch/arm64/include/bootconfig.h,v
retrieving revision 1.2
diff -u -p -r1.2 bootconfig.h
--- sys/arch/arm64/include/bootconfig.h 18 Dec 2016 14:40:25 -  1.2
+++ sys/arch/arm64/include/bootconfig.h 28 May 2018 09:03:07 -
@@ -32,9 +32,6 @@
 #ifndef _MACHINE_BOOTCONFIG_H_
 #define_MACHINE_BOOTCONFIG_H_
 
-#defineMAX_BOOT_STRING 255
-extern char bootstring[MAX_BOOT_STRING];
-
 struct arm64_bootparams {
vaddr_t modulep;
vaddr_t kern_l1pt;  /* L1 page table for the kernel */
@@ -45,14 +42,8 @@ struct arm64_bootparams {
void*arg2; // passed to kernel in R2
 };
 
-extern paddr_t physmap[];
-extern u_int physmap_idx;
-
-
 void initarm(struct arm64_bootparams *);
 
 extern char *boot_file;
 
 #endif /* _MACHINE_BOOTCONFIG_H_ */
-
-/* End of bootconfig.h */
Index: sys/arch/arm64/include/machine_reg.h
===
RCS file: sys/arch/arm64/include/machine_reg.h
diff -N sys/arch/arm64/include/machine_reg.h
--- sys/arch/arm64/include/machine_reg.h30 Apr 2017 13:04:49 -  
1.2
+++ /dev/null   1 Jan 1970 00:00:00 -
@@ -1,57 +0,0 @@
-/* $OpenBSD: machine_reg.h,v 1.2 2017/04/30 13:04:49 mpi Exp $ */
-
-/*
- * Copyright (c) 2002, 2003  Genetec Corporation.  All rights reserved.
- * Written by Hiroyuki Bessho for Genetec Corporation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- * 3. The name of Genetec Corporation may not be used to endorse or
- *promote products derived from this software without specific prior
- *written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GENETEC CORPORATION
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-#ifndef _MACHINE_REG_H
-#define _MACHINE_REG_H
-
-/*
- * Logical mapping for onboard/integrated peripherals
- */
-#defineMACHINE_IO_AREA_VBASE   0xfd00
-#define MACHINE_GPIO_VBASE 0xfd00
-#define MACHINE_CLKMAN_VBASE   0xfd10
-#define MACHINE_INTCTL_VBASE   0xfd20
-#define MACHINE_AGPIO_VBASE0xfd30
-#define MACHINE_VBASE_FREE 0xfd40
-/* FFUART and/or BTUART are mapped to this area when
-   used for console */
-
-#define ioreg_read(a)  (*(volatile unsigned *)(a))
-#define ioreg_write(a,v)  (*(volatile unsigned *)(a)=(v))
-
-#define ioreg16_read(a)  (*(volatile uint16_t *)(a))
-#define ioreg16_write(a,v)  (*(volatile uint16_t *)(a)=(v))
-
-#define ioreg8_read(a)  (*(volatile uint8_t *)(a))
-#define ioreg8_write(a,v)  (*(volatile uint8_t *)(a)=(v))
-
-#endif /* _MACHINE_REG_H */
Index: sys/arch/arm64/include/swi.h
===
RCS file: sys/arch/arm64/include/swi.h
diff -N sys/arch/arm64/include/swi.h
--- sys/arch/arm64/include/swi.h17 Dec 2016 23:38:33 -  1.1
+++ /dev/null   1 Jan 1970 00:00:00 -
@@ -1,23 +0,0 @@
-/* $OpenBSD: swi.h,v 1.1 2016/12/17 23:38:33 patrick Exp $ */
-/* $NetBSD: swi.h,v 1.1 2002/01/13 15:03:06 bjh21 Exp $*/
-
-/*
- * This file is in the Public Domain.
- * Ben Harris, 2002.
- */
-
-#ifndef _MACHINE_SWI_H_
-#define _MACHINE_SWI_H_
-
-#define SWI_OS_MASK0xf0
-#define SWI_OS_RISCOS  0x00
-#define SWI_OS_RISCIX  0x80
-#define SWI_OS_LINUX   0x90
-#define SWI_OS_NETBSD  0xa0
-#define SWI_OS_ARM 0xf0
-
-#define SWI_IMB0xf0
-#define SWI_IMBrange   0

Re: Some arm64 cleanup

2018-05-28 Thread Dale Rahn
ok drahn@
On Mon, May 28, 2018 at 11:07:29AM +0200, Mark Kettenis wrote:
> machine_reg.h is completely unused
> swi.h is referenced from libc's SYS.h but nothing from that file is used
> bootconfig.h has some junk that isn't really used
> 
> The MAX_BOOT_STRING define in bootconfig.h doesn't really serve a
> purpose anymore.  Simply use a fixed-size buffer and strlcpy the
> results into it using sizeof.
> 
> ok?
> 
> Index: sys/arch/arm64/include/bootconfig.h
> ===
> RCS file: /cvs/src/sys/arch/arm64/include/bootconfig.h,v
> retrieving revision 1.2
> diff -u -p -r1.2 bootconfig.h
> --- sys/arch/arm64/include/bootconfig.h   18 Dec 2016 14:40:25 -  
> 1.2
> +++ sys/arch/arm64/include/bootconfig.h   28 May 2018 09:03:07 -
> @@ -32,9 +32,6 @@
>  #ifndef _MACHINE_BOOTCONFIG_H_
>  #define  _MACHINE_BOOTCONFIG_H_
>  
> -#defineMAX_BOOT_STRING 255
> -extern char bootstring[MAX_BOOT_STRING];
> -
>  struct arm64_bootparams {
>   vaddr_t modulep;
>   vaddr_t kern_l1pt;  /* L1 page table for the kernel */
> @@ -45,14 +42,8 @@ struct arm64_bootparams {
>   void*arg2; // passed to kernel in R2
>  };
>  
> -extern paddr_t physmap[];
> -extern u_int physmap_idx;
> -
> -
>  void initarm(struct arm64_bootparams *);
>  
>  extern char *boot_file;
>  
>  #endif /* _MACHINE_BOOTCONFIG_H_ */
> -
> -/* End of bootconfig.h */
> Index: sys/arch/arm64/include/machine_reg.h
> ===
> RCS file: sys/arch/arm64/include/machine_reg.h
> diff -N sys/arch/arm64/include/machine_reg.h
> --- sys/arch/arm64/include/machine_reg.h  30 Apr 2017 13:04:49 -  
> 1.2
> +++ /dev/null 1 Jan 1970 00:00:00 -
> @@ -1,57 +0,0 @@
> -/*   $OpenBSD: machine_reg.h,v 1.2 2017/04/30 13:04:49 mpi Exp $ */
> -
> -/*
> - * Copyright (c) 2002, 2003  Genetec Corporation.  All rights reserved.
> - * Written by Hiroyuki Bessho for Genetec Corporation.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - * 1. Redistributions of source code must retain the above copyright
> - *notice, this list of conditions and the following disclaimer.
> - * 2. Redistributions in binary form must reproduce the above copyright
> - *notice, this list of conditions and the following disclaimer in the
> - *documentation and/or other materials provided with the distribution.
> - * 3. The name of Genetec Corporation may not be used to endorse or
> - *promote products derived from this software without specific prior
> - *written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
> - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
> - * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GENETEC CORPORATION
> - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> - * POSSIBILITY OF SUCH DAMAGE.
> - */
> -
> -
> -#ifndef _MACHINE_REG_H
> -#define _MACHINE_REG_H
> -
> -/*
> - * Logical mapping for onboard/integrated peripherals
> - */
> -#define  MACHINE_IO_AREA_VBASE   0xfd00
> -#define MACHINE_GPIO_VBASE   0xfd00
> -#define MACHINE_CLKMAN_VBASE 0xfd10
> -#define MACHINE_INTCTL_VBASE 0xfd20
> -#define MACHINE_AGPIO_VBASE  0xfd30
> -#define MACHINE_VBASE_FREE   0xfd40
> -/* FFUART and/or BTUART are mapped to this area when
> -   used for console */
> -
> -#define ioreg_read(a)  (*(volatile unsigned *)(a))
> -#define ioreg_write(a,v)  (*(volatile unsigned *)(a)=(v))
> -
> -#define ioreg16_read(a)  (*(volatile uint16_t *)(a))
> -#define ioreg16_write(a,v)  (*(volatile uint16_t *)(a)=(v))
> -
> -#define ioreg8_read(a)  (*(volatile uint8_t *)(a))
> -#define ioreg8_write(a,v)  (*(volatile uint8_t *)(a)=(v))
> -
> -#endif /* _MACHINE_REG_H */
> Index: sys/arch/arm64/include/swi.h
> ===
> RCS file: sys/arch/arm64/include/swi.h
> diff -N sys/arch/arm64/include/swi.h
> --- sys/arch/arm64/include/swi.h  17 Dec 2016 23:38:33 -  1.1
> +++ /dev/null 1 Jan 1970 00:00:00 -
> @@ -1,23 +0,0 @@
> -/*   $OpenBSD: swi.h,v 1.1 2016/12/17 23:38:33 patrick Exp $ */
> -/*   $NetBSD: swi.h,v 1.1 2002/01/13 15:03:06 bjh21 Exp $*/
> -
> -/*
> - * This file is in the Public Domain.
> - * Ben Harris, 2002.
> - */
> -
> -#