Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/arcbios (XXX this should be a library like libsa).



details:   https://anonhg.NetBSD.org/src/rev/62669a4f2325
branches:  trunk
changeset: 762373:62669a4f2325
user:      matt <matt%NetBSD.org@localhost>
date:      Sun Feb 20 08:02:46 2011 +0000

description:
(XXX this should be a library like libsa).
Deal with the need to save/restore T8 (CURLWP) across arcbios calls.
Call arcbios with O32 ABI conventions even if kernel/bootloader is N32/N64.

diffstat:

 sys/dev/arcbios/Makefile.inc    |   13 +
 sys/dev/arcbios/arcbios.c       |   18 +-
 sys/dev/arcbios/arcbios.h       |  269 +++++++++++++++------------------------
 sys/dev/arcbios/arcbios_calls.S |  193 ++++++++++++++++++++++++++++
 sys/dev/arcbios/arcbios_tty.c   |   10 +-
 sys/dev/arcbios/genassym.cf     |   73 ++++++++++
 6 files changed, 398 insertions(+), 178 deletions(-)

diffs (truncated from 710 to 300 lines):

diff -r f893cb37354d -r 62669a4f2325 sys/dev/arcbios/Makefile.inc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/arcbios/Makefile.inc      Sun Feb 20 08:02:46 2011 +0000
@@ -0,0 +1,13 @@
+#      $NetBSD: Makefile.inc,v 1.1 2011/02/20 08:02:46 matt Exp $
+
+GENASSYM_CONF= ${S}/dev/arcbios/genassym.cf
+
+.if !target(assym.h)
+assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRA}
+       ${_MKTARGET_CREATE}
+       cat ${GENASSYM_CONF} ${GENASSYM_EXTRA} | \
+           ${TOOL_GENASSYM} -- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
+           > assym.h.tmp && \
+       mv -f assym.h.tmp assym.h
+${SRCS:C/\.[Ss]/.o/} ${SRCS:C/\.[Ss]/.d/}: assym.h
+.endif
diff -r f893cb37354d -r 62669a4f2325 sys/dev/arcbios/arcbios.c
--- a/sys/dev/arcbios/arcbios.c Sun Feb 20 08:01:10 2011 +0000
+++ b/sys/dev/arcbios/arcbios.c Sun Feb 20 08:02:46 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arcbios.c,v 1.12 2008/04/28 20:23:47 martin Exp $      */
+/*     $NetBSD: arcbios.c,v 1.13 2011/02/20 08:02:46 matt Exp $        */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arcbios.c,v 1.12 2008/04/28 20:23:47 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arcbios.c,v 1.13 2011/02/20 08:02:46 matt Exp $");
 
 #include <sys/param.h>
 
@@ -87,7 +87,7 @@
        }
 
        /* Initialize our pointer to the firmware vector. */
-       ARCBIOS = ARCBIOS_SPB->FirmwareVector;
+       ARCBIOS = (void *)(intptr_t)ARCBIOS_SPB->FirmwareVector;
 
        /* Find the ARC BIOS console device major (needed by cnopen) */
        maj = cdevsw_lookup_major(&arcbios_cdevsw);
@@ -100,7 +100,7 @@
        /*
         * Fetch the system ID.
         */
-       sid = (*ARCBIOS->GetSystemId)();
+       sid = arcbios_GetSystemId();
        if (sid != NULL) {
                memcpy(arcbios_sysid_vendor, sid->VendorId,
                    sizeof(sid->VendorId));
@@ -148,9 +148,9 @@
     struct arcbios_treewalk_context *atc)
 {
 
-       for (node = (*ARCBIOS->GetChild)(node);
+       for (node = arcbios_GetChild(node);
             node != NULL && atc->atc_terminate == 0;
-            node = (*ARCBIOS->GetPeer)(node)) {
+            node = arcbios_GetPeer(node)) {
                (*func)(node, atc);
                if (atc->atc_terminate)
                        return;
@@ -178,7 +178,7 @@
        dstsize--;
        if (dstsize > node->IdentifierLength)
                dstsize = node->IdentifierLength;
-       memcpy(dst, node->Identifier, dstsize);
+       memcpy(dst, (void *)(intptr_t)node->Identifier, dstsize);
        dst[dstsize] = '\0';
 }
 
@@ -192,7 +192,7 @@
        u_long count;
        char c;
 
-       (*ARCBIOS->Read)(ARCBIOS_STDIN, &c, 1, &count);
+       arcbios_Read(ARCBIOS_STDIN, &c, 1, &count);
        return (c);
 }
 
@@ -202,5 +202,5 @@
        u_long count;
        char ch = c;
 
-       (*ARCBIOS->Write)(ARCBIOS_STDOUT, &ch, 1, &count);
+       arcbios_Write(ARCBIOS_STDOUT, &ch, 1, &count);
 }
diff -r f893cb37354d -r 62669a4f2325 sys/dev/arcbios/arcbios.h
--- a/sys/dev/arcbios/arcbios.h Sun Feb 20 08:01:10 2011 +0000
+++ b/sys/dev/arcbios/arcbios.h Sun Feb 20 08:02:46 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arcbios.h,v 1.12 2008/04/28 20:23:47 martin Exp $      */
+/*     $NetBSD: arcbios.h,v 1.13 2011/02/20 08:02:46 matt Exp $        */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -78,22 +78,22 @@
  * 4.2.2: System Parameter Block
  */
 struct arcbios_spb {
-       u_long          SPBSignature;
-       u_long          SPBLength;
+       uint32_t        SPBSignature;
+       uint32_t        SPBLength;
        uint16_t        Version;
        uint16_t        Revision;
-       void            *RestartBlock;
-       void            *DebugBlock;
-       void            *GEVector;
-       void            *UTLBMissVector;
-       u_long          FirmwareVectorLength;
-       void            *FirmwareVector;
-       u_long          PrivateVectorLength;
-       void            *PrivateVector;
-       u_long          AdapterCount;
-       u_long          AdapterType;
-       u_long          AdapterVectorLength;
-       void            *AdapterVector;
+       int32_t         RestartBlock;
+       int32_t         DebugBlock;
+       int32_t         GEVector;
+       int32_t         UTLBMissVector;
+       uint32_t        FirmwareVectorLength;
+       int32_t         FirmwareVector;
+       uint32_t        PrivateVectorLength;
+       int32_t         PrivateVector;
+       uint32_t        AdapterCount;
+       uint32_t        AdapterType;
+       uint32_t        AdapterVectorLength;
+       int32_t         AdapterVector;
 };
 
 #define        ARCBIOS_SPB_SIGNATURE   0x53435241      /* A R C S */
@@ -108,11 +108,11 @@
        uint32_t        Flags;
        uint16_t        Version;
        uint16_t        Revision;
-       u_long          Key;
-       u_long          AffinityMask;
-       u_long          ConfigurationDataSize;
-       u_long          IdentifierLength;
-       char            *Identifier;
+       uint32_t        Key;
+       uint32_t        AffinityMask;
+       uint32_t        ConfigurationDataSize;
+       uint32_t        IdentifierLength;
+       int32_t         Identifier;
 };
 
 /*
@@ -277,8 +277,8 @@
  */
 struct arcbios_mem {
        uint32_t        Type;
-       u_long          BasePage;
-       u_long          PageCount;
+       uint32_t        BasePage;
+       uint32_t        PageCount;
 };
 
 #if defined(sgimips)
@@ -320,148 +320,89 @@
  * ARC firmware vector
  */
 struct arcbios_fv {
-       long            (*Load)(
-                           char *,             /* image to load */
-                           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 */
-
-       long            (*Execute)(
-                           char *,             /* image path */
-                           u_long,             /* argc */
-                           char **,            /* argv */
-                           char **);           /* envp */
-
-       void            (*Halt)(void)
-                           __dead;
-
-       void            (*PowerDown)(void)
-                           __dead;
-
-       void            (*Restart)(void)
-                           __dead;
-
-       void            (*Reboot)(void)
-                           __dead;
-
-       void            (*EnterInteractiveMode)(void)
-                           __dead;
-#if defined(sgimips)
-       void            *reserved0;
-#else
-       void            (*ReturnFromMain)(void)
-                           __dead;
-#endif
-       void            *(*GetPeer)(
-                           void *);            /* component */
-
-       void            *(*GetChild)(
-                           void *);            /* component */
-
-       void            *(*GetParent)(
-                           void *);            /* component */
-
-       long            (*GetConfigurationData)(
-                           void *,             /* configuration data */
-                           void *);            /* component */
-
-       void            *(*AddChild)(
-                           void *,             /* component */
-                           void *);            /* new component */
-
-       long            (*DeleteComponent)(
-                           void *);            /* component */
-
-       void            *(*GetComponent)(
-                           char *);            /* path */
-
-       long            (*SaveConfiguration)(void);
-
-       void            *(*GetSystemId)(void);
-
-       void            *(*GetMemoryDescriptor)(
-                           void *);            /* memory descriptor */
-#if defined(sgimips)
-       void            *reserved1;
-#else
-       void            (*Signal)(
-                           u_long,             /* signal number */
-                           void *);            /* handler */
-#endif
-       void            *(*GetTime)(void);
-
-       u_long          (*GetRelativeTime)(void);
-
-       long            (*GetDirectoryEntry)(
-                           u_long,             /* file ID */
-                           void *,             /* directory entry */
-                           u_long,             /* length */
-                           u_long *);  /* count */
-
-       long            (*Open)(
-                           char *,             /* path */
-                           u_long,             /* open mode */
-                           u_long *);          /* file ID */
-
-       long            (*Close)(
-                           u_long);            /* file ID */
-
-       long            (*Read)(
-                           u_long,             /* file ID */
-                           void *,             /* buffer */
-                           u_long,             /* length */
-                           u_long *);          /* count */
-
-       long            (*GetReadStatus)(
-                           u_long);            /* file ID */
-
-       long            (*Write)(
-                           u_long,             /* file ID */
-                           void *,             /* buffer */
-                           u_long,             /* length */
-                           u_long *);          /* count */
-
-       long            (*Seek)(
-                           u_long,             /* file ID */
-                           int64_t *,          /* offset */
-                           u_long);            /* whence */
-
-       long            (*Mount)(
-                           char *,             /* path */
-                           u_long);            /* operation */
-
-       const char      *(*GetEnvironmentVariable)(
-                           const char *);      /* variable */
-
-       long            (*SetEnvironmentVariable)(
-                           const char *,       /* variable */
-                           const char *);      /* contents */
-
-       long            (*GetFileInformation)(
-                           u_long,             /* file ID */
-                           void *);            /* XXX */
-
-       long            (*SetFileInformation)(
-                           u_long,             /* file ID */
-                           u_long,             /* XXX */
-                           u_long);            /* XXX */



Home | Main Index | Thread Index | Old Index