Subject: Re: bootloader for NetBSD/arc and MI arcbios.h changes
To: None <port-arc@NetBSD.org, port-sgimips@NetBSD.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-sgimips
Date: 04/17/2005 13:00:19
In article <050416184357.M0113079@mirage.ceres.dti.ne.jp>
I wrote:
> Currently MI arcbios.h uses paddr_t for values which are 64bit
> on some MIPS64 based sgimips machine (Octane etc.), but on arc port
> paddr_t is always 64bit even on 32bit ARCBIOS machines.
>
> Is it OK to change simply these paddr_t to long, or should we have
> some appropriate typedef (or macro) for them?
According to the ARC specification, these values are actually
defined as ULONG or LONG, and our paddr_t is an integer type
which represents physical address range (not equal to pointer
width or VA range), so I'll commit the attached changes.
(While here, I'll also change some unsigned long to u_long for consistency)
---
Izumi Tsutsui
Index: arch/sgimips/sgimips/arcemu.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sgimips/sgimips/arcemu.c,v
retrieving revision 1.9
diff -u -r1.9 arcemu.c
--- arch/sgimips/sgimips/arcemu.c 7 Apr 2005 23:36:48 -0000 1.9
+++ arch/sgimips/sgimips/arcemu.c 17 Apr 2005 03:21:15 -0000
@@ -177,7 +177,7 @@
struct seeprom_descriptor sd;
bus_space_handle_t bsh;
bus_space_tag_t tag;
- paddr_t reg;
+ u_int32_t reg;
tag = SGIMIPS_BUS_SPACE_NORMAL;
bus_space_map(tag, 0x1fa00000 + 0x1801bf, 1, 0, &bsh);
Index: arch/sgimips/stand/common/disk.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sgimips/stand/common/disk.c,v
retrieving revision 1.5
diff -u -r1.5 disk.c
--- arch/sgimips/stand/common/disk.c 4 Oct 2004 19:59:51 -0000 1.5
+++ arch/sgimips/stand/common/disk.c 17 Apr 2005 03:39:35 -0000
@@ -50,7 +50,7 @@
extern const struct arcbios_fv *ARCBIOS;
struct disk_softc {
- int sc_fd; /* PROM file id */
+ u_long sc_fd; /* PROM file id */
int sc_part; /* disk partition number */
struct disklabel sc_label; /* disk label for this disk */
};
@@ -69,7 +69,7 @@
struct partition *pp = &sc->sc_label.d_partitions[part];
int s;
int64_t offset;
- paddr_t count;
+ u_long count;
offset = bn;
@@ -112,7 +112,7 @@
char *msg, buf[DEV_BSIZE];
#endif
int i;
- paddr_t i_arg;
+ u_long fd;
char *device;
va_list ap;
@@ -135,17 +135,16 @@
if (part >= 16)
return (ENXIO);
- if (ARCBIOS->Open(device, 0, &i_arg)) {
+ if (ARCBIOS->Open(device, 0, &fd)) {
printf("open failed\n");
return (ENXIO);
}
- i = (int)i_arg;
sc = alloc(sizeof(struct disk_softc));
memset(sc, 0, sizeof(struct disk_softc));
f->f_devdata = (void *)sc;
- sc->sc_fd = i;
+ sc->sc_fd = fd;
sc->sc_part = part;
/* try to read disk label and partition table information */
Index: arch/sgimips/stand/common/getchar.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sgimips/stand/common/getchar.c,v
retrieving revision 1.3
diff -u -r1.3 getchar.c
--- arch/sgimips/stand/common/getchar.c 4 Oct 2004 19:59:51 -0000 1.3
+++ arch/sgimips/stand/common/getchar.c 17 Apr 2005 03:39:35 -0000
@@ -45,7 +45,7 @@
getchar()
{
char ch;
- paddr_t count;
+ u_long count;
(*ARCBIOS->Read)(0, &ch, 1, &count);
return(ch);
Index: arch/sgimips/stand/common/putchar.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sgimips/stand/common/putchar.c,v
retrieving revision 1.3
diff -u -r1.3 putchar.c
--- arch/sgimips/stand/common/putchar.c 4 Oct 2004 19:59:51 -0000 1.3
+++ arch/sgimips/stand/common/putchar.c 17 Apr 2005 03:39:35 -0000
@@ -46,7 +46,7 @@
int c;
{
static char ch[2] = "?\r";
- paddr_t count;
+ u_long count;
ch[0] = c;
(*ARCBIOS->Write)(1, &ch, c == '\n' ? 2 : 1, &count);
Index: dev/arcbios/arcbios.c
===================================================================
RCS file: /cvsroot/src/sys/dev/arcbios/arcbios.c,v
retrieving revision 1.9
diff -u -r1.9 arcbios.c
--- dev/arcbios/arcbios.c 27 Feb 2005 00:26:58 -0000 1.9
+++ dev/arcbios/arcbios.c 17 Apr 2005 03:21:33 -0000
@@ -196,7 +196,7 @@
int
arcbios_cngetc(dev_t dev)
{
- unsigned long count;
+ u_long count;
char c;
(*ARCBIOS->Read)(ARCBIOS_STDIN, &c, 1, &count);
@@ -206,7 +206,7 @@
void
arcbios_cnputc(dev_t dev, int c)
{
- unsigned long count;
+ u_long count;
char ch = c;
(*ARCBIOS->Write)(ARCBIOS_STDOUT, &ch, 1, &count);
Index: dev/arcbios/arcbios.h
===================================================================
RCS file: /cvsroot/src/sys/dev/arcbios/arcbios.h,v
retrieving revision 1.7
diff -u -r1.7 arcbios.h
--- dev/arcbios/arcbios.h 27 Feb 2005 00:26:58 -0000 1.7
+++ dev/arcbios/arcbios.h 17 Apr 2005 03:21:35 -0000
@@ -85,21 +85,21 @@
* 4.2.2: System Parameter Block
*/
struct arcbios_spb {
- paddr_t SPBSignature;
- paddr_t SPBLength;
+ u_long SPBSignature;
+ u_long SPBLength;
uint16_t Version;
uint16_t Revision;
void *RestartBlock;
void *DebugBlock;
void *GEVector;
void *UTLBMissVector;
- paddr_t FirmwareVectorLength;
+ u_long FirmwareVectorLength;
void *FirmwareVector;
- paddr_t PrivateVectorLength;
+ u_long PrivateVectorLength;
void *PrivateVector;
- paddr_t AdapterCount;
- paddr_t AdapterType;
- paddr_t AdapterVectorLength;
+ u_long AdapterCount;
+ u_long AdapterType;
+ u_long AdapterVectorLength;
void *AdapterVector;
};
@@ -115,10 +115,10 @@
uint32_t Flags;
uint16_t Version;
uint16_t Revision;
- unsigned long Key;
- unsigned long AffinityMask;
- unsigned long ConfigurationDataSize;
- unsigned long IdentifierLength;
+ u_long Key;
+ u_long AffinityMask;
+ u_long ConfigurationDataSize;
+ u_long IdentifierLength;
char *Identifier;
};
@@ -284,8 +284,8 @@
*/
struct arcbios_mem {
uint32_t Type;
- paddr_t BasePage;
- paddr_t PageCount;
+ u_long BasePage;
+ u_long PageCount;
};
#if defined(sgimips)
@@ -327,22 +327,22 @@
* ARC firmware vector
*/
struct arcbios_fv {
- paddr_t (*Load)(
+ long (*Load)(
char *, /* image to load */
- paddr_t, /* top address */
- paddr_t, /* entry address */
- paddr_t *); /* low address */
-
- paddr_t (*Invoke)(
- paddr_t, /* entry address */
- paddr_t, /* stack address */
- paddr_t, /* argc */
+ u_long, /* top address */
+ u_long, /* entry address */
+ u_long *); /* low address */
+
+ long (*Invoke)(
+ u_long, /* entry address */
+ u_long, /* stack address */
+ u_long, /* argc */
char **, /* argv */
char **); /* envp */
- paddr_t (*Execute)(
+ long (*Execute)(
char *, /* image path */
- paddr_t, /* argc */
+ u_long, /* argc */
char **, /* argv */
char **); /* envp */
@@ -375,7 +375,7 @@
void *(*GetParent)(
void *); /* component */
- paddr_t (*GetConfigurationData)(
+ long (*GetConfigurationData)(
void *, /* configuration data */
void *); /* component */
@@ -383,13 +383,13 @@
void *, /* component */
void *); /* new component */
- paddr_t (*DeleteComponent)(
+ long (*DeleteComponent)(
void *); /* component */
- paddr_t (*GetComponent)(
+ void *(*GetComponent)(
char *); /* path */
- paddr_t (*SaveConfiguration)(void);
+ long (*SaveConfiguration)(void);
void *(*GetSystemId)(void);
@@ -399,75 +399,75 @@
void *reserved1;
#else
void (*Signal)(
- paddr_t, /* signal number */
+ u_long, /* signal number */
void *); /* handler */
#endif
void *(*GetTime)(void);
- paddr_t (*GetRelativeTime)(void);
+ u_long (*GetRelativeTime)(void);
- paddr_t (*GetDirectoryEntry)(
- paddr_t, /* file ID */
+ long (*GetDirectoryEntry)(
+ u_long, /* file ID */
void *, /* directory entry */
- paddr_t, /* length */
- paddr_t *); /* count */
+ u_long, /* length */
+ u_long *); /* count */
- paddr_t (*Open)(
+ long (*Open)(
char *, /* path */
- paddr_t, /* open mode */
- paddr_t *); /* file ID */
+ u_long, /* open mode */
+ u_long *); /* file ID */
- paddr_t (*Close)(
- paddr_t); /* file ID */
+ long (*Close)(
+ u_long); /* file ID */
- paddr_t (*Read)(
- paddr_t, /* file ID */
+ long (*Read)(
+ u_long, /* file ID */
void *, /* buffer */
- paddr_t, /* length */
- paddr_t *); /* count */
+ u_long, /* length */
+ u_long *); /* count */
- paddr_t (*GetReadStatus)(
- paddr_t); /* file ID */
+ long (*GetReadStatus)(
+ u_long); /* file ID */
- paddr_t (*Write)(
- paddr_t, /* file ID */
+ long (*Write)(
+ u_long, /* file ID */
void *, /* buffer */
- paddr_t, /* length */
- paddr_t *); /* count */
+ u_long, /* length */
+ u_long *); /* count */
- paddr_t (*Seek)(
- paddr_t, /* file ID */
+ long (*Seek)(
+ u_long, /* file ID */
int64_t *, /* offset */
- paddr_t); /* whence */
+ u_long); /* whence */
- paddr_t (*Mount)(
+ long (*Mount)(
char *, /* path */
- paddr_t); /* operation */
+ u_long); /* operation */
char *(*GetEnvironmentVariable)(
char *); /* variable */
- paddr_t (*SetEnvironmentVariable)(
+ long (*SetEnvironmentVariable)(
char *, /* variable */
char *); /* contents */
- paddr_t (*GetFileInformation)(
- paddr_t, /* file ID */
+ long (*GetFileInformation)(
+ u_long, /* file ID */
void *); /* XXX */
- paddr_t (*SetFileInformation)(
- paddr_t, /* file ID */
- paddr_t, /* XXX */
- paddr_t); /* XXX */
+ long (*SetFileInformation)(
+ u_long, /* file ID */
+ u_long, /* XXX */
+ u_long); /* XXX */
void (*FlushAllCaches)(void);
#if !defined(sgimips)
paddr_t (*TestUnicode)(
- paddr_t, /* file ID */
+ u_long, /* file ID */
uint16_t); /* unicode character */
void *(*GetDisplayStatus)(
- paddr_t); /* file ID */
+ u_long); /* file ID */
#endif
};
Index: dev/arcbios/arcbios_tty.c
===================================================================
RCS file: /cvsroot/src/sys/dev/arcbios/arcbios_tty.c,v
retrieving revision 1.8
diff -u -r1.8 arcbios_tty.c
--- dev/arcbios/arcbios_tty.c 27 Feb 2005 00:26:58 -0000 1.8
+++ dev/arcbios/arcbios_tty.c 17 Apr 2005 03:21:35 -0000
@@ -174,7 +174,7 @@
void
arcbios_tty_start(struct tty *tp)
{
- unsigned long count;
+ u_long count;
int s;
s = spltty();
@@ -215,7 +215,7 @@
{
char c;
int32_t q;
- unsigned long count;
+ u_long count;
q = ARCBIOS->GetReadStatus(ARCBIOS_STDIN);