summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2009-05-09 18:09:00 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2009-05-09 18:09:00 +0000
commita0ea7ab6dfd0eb2a3747068fc5f4be10e2a2d20f (patch)
tree614107b3312028adec4fe51d0a66ea13a520e895 /sys/arch
parent5b2769fd2610db19e0f601aa68fb736aa17eb701 (diff)
Promote types in ARCBios function prototypes from int to long whenever
necessary, to allow the same C code to be used against 32 bit ARCBios, when compiled in 32 bit mode, or against 64 bit ARCBios, when compiled in native mode. Soon to be used by the boot blocks; this commit doesn't introduce any functional change yet.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/mips64/include/arcbios.h106
-rw-r--r--sys/arch/mips64/mips64/arcbios.c11
-rw-r--r--sys/arch/sgi/stand/boot/arcbios.c6
-rw-r--r--sys/arch/sgi/stand/boot/diskio.c15
4 files changed, 75 insertions, 63 deletions
diff --git a/sys/arch/mips64/include/arcbios.h b/sys/arch/mips64/include/arcbios.h
index 13af95cb95a..77b411fcc96 100644
--- a/sys/arch/mips64/include/arcbios.h
+++ b/sys/arch/mips64/include/arcbios.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: arcbios.h,v 1.11 2009/04/19 12:52:31 miod Exp $ */
+/* $OpenBSD: arcbios.h,v 1.12 2009/05/09 18:08:57 miod Exp $ */
/*-
* Copyright (c) 1996 M. Warner Losh. All rights reserved.
*
@@ -201,24 +201,34 @@ typedef u_int32_t arc_open_mode_t; /* XXX */
typedef u_int32_t arc_seek_mode_t; /* XXX */
typedef u_int32_t arc_mount_t; /* XXX */
+typedef struct arc_quad {
+#ifdef __MIPSEB__
+ long hi;
+ u_long lo;
+#else
+ u_long lo;
+ long hi;
+#endif
+} arc_quad_t;
+
typedef struct arc_calls
{
arc_status_t (*load)( /* Load 1 */
char *, /* Image to load */
- u_int32_t, /* top address */
- u_int32_t *, /* Entry address */
- u_int32_t *); /* Low address */
+ u_long, /* top address */
+ u_long *, /* Entry address */
+ u_long *); /* Low address */
arc_status_t (*invoke)( /* Invoke 2 */
- u_int32_t, /* Entry Address */
- u_int32_t, /* Stack Address */
- u_int32_t, /* Argc */
+ u_long, /* Entry Address */
+ u_long, /* Stack Address */
+ u_long, /* Argc */
char **, /* argv */
char **); /* envp */
arc_status_t (*execute)( /* Execute 3 */
char *, /* Image path */
- u_int32_t, /* Argc */
+ u_long, /* Argc */
char **, /* argv */
char **); /* envp */
@@ -274,40 +284,40 @@ typedef struct arc_calls
arc_time_t *(*get_time)(void); /* GetTime 21 */
- u_int32_t (*get_relative_time)(void); /* GetRelativeTime 22 */
+ u_long (*get_relative_time)(void); /* GetRelativeTime 22 */
arc_status_t (*get_dir_entry)( /* GetDirectoryEntry 23 */
- u_int32_t, /* FileId */
+ u_long, /* FileId */
arc_dirent_t *, /* Directory entry */
- u_int32_t, /* Length */
- u_int32_t *); /* Count */
+ u_long, /* Length */
+ u_long *); /* Count */
arc_status_t (*open)( /* Open 24 */
char *, /* Path */
arc_open_mode_t, /* Open mode */
- u_int32_t *); /* FileId */
+ u_long *); /* FileId */
arc_status_t (*close)( /* Close 25 */
- u_int32_t); /* FileId */
+ u_long); /* FileId */
arc_status_t (*read)( /* Read 26 */
- u_int32_t, /* FileId */
+ u_long, /* FileId */
caddr_t, /* Buffer */
- u_int32_t, /* Length */
- u_int32_t *); /* Count */
+ u_long, /* Length */
+ u_long *); /* Count */
arc_status_t (*get_read_status)( /* GetReadStatus 27 */
- u_int32_t); /* FileId */
+ u_long); /* FileId */
arc_status_t (*write)( /* Write 28 */
- u_int32_t, /* FileId */
+ u_long, /* FileId */
caddr_t, /* Buffer */
- u_int32_t, /* Length */
- u_int32_t *); /* Count */
+ u_long, /* Length */
+ u_long *); /* Count */
arc_status_t (*seek)( /* Seek 29 */
- u_int32_t, /* FileId */
- int64_t *, /* Offset */
+ u_long, /* FileId */
+ arc_quad_t *, /* Offset */
arc_seek_mode_t); /* Mode */
arc_status_t (*mount)( /* Mount 30 */
@@ -403,39 +413,39 @@ void bios_display_info(int *, int *, int *, int *);
/*
* Direct ARC-BIOS calls.
*/
-int Bios_Load(char *, u_int32_t, u_int32_t, u_int32_t *);
-int Bios_Invoke(uint32_t, uint32_t, uint32_t, char **, char **);
-int Bios_Execute(char *, u_int32_t, char **, char **);
+long Bios_Load(char *, u_long, u_long, u_long *);
+long Bios_Invoke(u_long, u_long, u_long, char **, char **);
+long Bios_Execute(char *, u_long, char **, char **);
void Bios_Halt(void);
void Bios_PowerDown(void);
void Bios_Restart(void);
void Bios_Reboot(void);
void Bios_EnterInteractiveMode(void);
-int Bios_GetPeer(void *);
+long Bios_GetPeer(void *);
arc_config_t *Bios_GetChild(void *);
-int Bios_GetParent(void *);
-int Bios_GetConfigurationData(void *, void *);
-int Bios_AddChild(void *, void *);
-int Bios_DeleteComponent(void *);
-int Bios_GetComponent(char *);
-int Bios_SaveConfiguration(void);
+long Bios_GetParent(void *);
+long Bios_GetConfigurationData(void *, void *);
+long Bios_AddChild(void *, void *);
+long Bios_DeleteComponent(void *);
+long Bios_GetComponent(char *);
+long Bios_SaveConfiguration(void);
arc_sid_t *Bios_GetSystemId(void);
arc_mem_t *Bios_GetMemoryDescriptor(void *);
-int Bios_GetTime(void);
-int Bios_GetRelativeTime(void);
-int Bios_GetDirectoryEntry(u_int32_t, void *, u_int32_t, u_int32_t *);
-int Bios_Open(char *, int, u_int *);
-int Bios_Close(u_int);
-int Bios_Read(int, char *, int, int *);
-int Bios_GetReadStatus(u_int);
-int Bios_Write(int, char *, int, int *);
-int Bios_Seek(int, int64_t *, int);
-int Bios_Mount(char *, void *);
+long Bios_GetTime(void);
+long Bios_GetRelativeTime(void);
+long Bios_GetDirectoryEntry(u_long, void *, u_long, u_long *);
+long Bios_Open(char *, int, long *);
+long Bios_Close(long);
+long Bios_Read(long, char *, long, long *);
+long Bios_GetReadStatus(u_long);
+long Bios_Write(long, char *, long, long *);
+long Bios_Seek(long, arc_quad_t *, int);
+long Bios_Mount(char *, void *);
char *Bios_GetEnvironmentVariable(const char *);
-int Bios_SetEnvironmentVariable(char *, char *);
-int Bios_GetFileInformation(u_int32_t, u_int32_t, u_int32_t);
-int Bios_SetFileInformation(u_int32_t, u_int32_t, u_int32_t);
+long Bios_SetEnvironmentVariable(char *, char *);
+long Bios_GetFileInformation(u_long, u_long, u_long);
+long Bios_SetFileInformation(u_long, u_long, u_long);
void Bios_FlushAllCaches(void);
-int Bios_TestUnicodeCharacter(u_int32_t, u_int16_t);
-arc_dsp_stat_t *Bios_GetDisplayStatus(u_int32_t);
+long Bios_TestUnicodeCharacter(u_long, u_int16_t);
+arc_dsp_stat_t *Bios_GetDisplayStatus(u_long);
diff --git a/sys/arch/mips64/mips64/arcbios.c b/sys/arch/mips64/mips64/arcbios.c
index b00fe24f816..1c1a3576ee7 100644
--- a/sys/arch/mips64/mips64/arcbios.c
+++ b/sys/arch/mips64/mips64/arcbios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arcbios.c,v 1.18 2009/05/08 18:34:37 miod Exp $ */
+/* $OpenBSD: arcbios.c,v 1.19 2009/05/09 18:08:59 miod Exp $ */
/*-
* Copyright (c) 1996 M. Warner Losh. All rights reserved.
* Copyright (c) 1996-2004 Opsycon AB. All rights reserved.
@@ -41,7 +41,7 @@
#include <machine/mnode.h>
#endif
-int bios_is_32bit = 1;
+int bios_is_32bit;
/*
* If we cannot get the onboard Ethernet address to override this bogus
* value, ether_ifattach() will pick a valid address.
@@ -155,7 +155,7 @@ int
bios_getchar()
{
char buf[4];
- int cnt;
+ long cnt;
if (Bios_Read(0, &buf[0], 1, &cnt) != 0)
return(-1);
@@ -167,7 +167,7 @@ bios_putchar(c)
char c;
{
char buf[4];
- int cnt;
+ long cnt;
if (c == '\n') {
buf[0] = '\r';
@@ -382,7 +382,8 @@ bios_get_system_type()
int i;
/*
- * Figure out if this is an ARC Bios machine and if its 32 or 64 bits.
+ * Figure out if this is an ARC Bios machine and if it is, see if we're
+ * dealing with a 32 or 64 bit version.
*/
if ((ArcBiosBase32->magic == ARC_PARAM_BLK_MAGIC) ||
(ArcBiosBase32->magic == ARC_PARAM_BLK_MAGIC_BUG)) {
diff --git a/sys/arch/sgi/stand/boot/arcbios.c b/sys/arch/sgi/stand/boot/arcbios.c
index 6f24c367dd3..ada86b01d14 100644
--- a/sys/arch/sgi/stand/boot/arcbios.c
+++ b/sys/arch/sgi/stand/boot/arcbios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arcbios.c,v 1.7 2008/03/27 15:11:37 jsing Exp $ */
+/* $OpenBSD: arcbios.c,v 1.8 2009/05/09 18:08:59 miod Exp $ */
/*-
* Copyright (c) 1996 M. Warner Losh. All rights reserved.
* Copyright (c) 1996-2004 Opsycon AB. All rights reserved.
@@ -128,7 +128,7 @@ int
getchar()
{
char buf[4];
- int cnt;
+ long cnt;
if (Bios_Read(0, &buf[0], 1, &cnt) != 0)
return (-1);
@@ -140,7 +140,7 @@ void
putchar(int c)
{
char buf[4];
- int cnt;
+ long cnt;
if (c == '\n') {
buf[0] = '\r';
diff --git a/sys/arch/sgi/stand/boot/diskio.c b/sys/arch/sgi/stand/boot/diskio.c
index a1a151c8fd8..a136cd37630 100644
--- a/sys/arch/sgi/stand/boot/diskio.c
+++ b/sys/arch/sgi/stand/boot/diskio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diskio.c,v 1.3 2008/03/08 16:52:28 jsing Exp $ */
+/* $OpenBSD: diskio.c,v 1.4 2009/05/09 18:08:59 miod Exp $ */
/*
* Copyright (c) 2000 Opsycon AB (www.opsycon.se)
@@ -45,15 +45,16 @@ struct dio_softc {
};
int
-diostrategy(void *devdata, int rw, daddr_t bn, u_int reqcnt, char *addr,
- u_int *cnt)
+diostrategy(void *devdata, int rw, daddr_t bn, u_int reqcnt, void *addr,
+ size_t *cnt)
{
struct dio_softc *sc = (struct dio_softc *)devdata;
struct partition *pp = &sc->sc_label.d_partitions[sc->sc_part];
- int64_t offset;
- int result;
+ arc_quad_t offset;
+ long result;
- offset = (pp->p_offset + bn) * DEV_BSIZE;
+ offset.hi = 0;
+ offset.lo = (pp->p_offset + bn) * DEV_BSIZE;
if ((Bios_Seek(sc->sc_fd, &offset, 0) < 0) ||
(Bios_Read(sc->sc_fd, addr, reqcnt, &result) < 0))
@@ -71,7 +72,7 @@ dioopen(struct open_file *f, ...)
struct dio_softc *sc;
struct disklabel *lp;
- int fd;
+ long fd;
daddr_t labelsector;
va_list ap;