diff options
author | imp <imp@cvs.openbsd.org> | 1996-09-06 04:57:53 +0000 |
---|---|---|
committer | imp <imp@cvs.openbsd.org> | 1996-09-06 04:57:53 +0000 |
commit | 52cf277d2379b027b204f8c7d7b18f72c74326ac (patch) | |
tree | c77c2b2997ab4d71bd37a2af3c0cf19a237716f8 /sys/arch/arc | |
parent | 700e161ba362e86b77c24b80e9a47a8def3347b8 (diff) |
Implement bios_ident() which will identify each type of CPU that we
support. First cut at more complete ARC BIOS support. bios_ident() will
eventually be table driven as soon as I generate the tables.
Much information on the BIOS calls has come from the Linux/MIPS MILO
boot loader.
Diffstat (limited to 'sys/arch/arc')
-rw-r--r-- | sys/arch/arc/arc/arcbios.c | 49 | ||||
-rw-r--r-- | sys/arch/arc/arc/arcbios.h | 303 | ||||
-rw-r--r-- | sys/arch/arc/arc/machdep.c | 10 | ||||
-rw-r--r-- | sys/arch/arc/conf/files.arc | 4 |
4 files changed, 360 insertions, 6 deletions
diff --git a/sys/arch/arc/arc/arcbios.c b/sys/arch/arc/arc/arcbios.c new file mode 100644 index 00000000000..d6b9f0beded --- /dev/null +++ b/sys/arch/arc/arc/arcbios.c @@ -0,0 +1,49 @@ +/* $OpenBSD: arcbios.c,v 1.1 1996/09/06 04:57:51 imp Exp $ */ +/*- + * Copyright (c) 1996 M. Warner Losh. All rights reserved. + * + * 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. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 THE REGENTS OR CONTRIBUTORS 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. + */ + +#include <sys/types.h> +#include <machine/pte.h> +#include <machine/cpu.h> +#include <machine/memconf.h> +#include <machine/param.h> +#include <arc/arc/arcbios.h> +#include <arc/arc/arctype.h> + +arc_param_blk_t *bios_base = (arc_param_blk_t *) 0x80001000; + +extern int cputype; /* Mother board type */ + +/* + * Incomplate version of bios_ident + */ +void +bios_ident() +{ + cputype = DESKSTATION_TYNE; +} diff --git a/sys/arch/arc/arc/arcbios.h b/sys/arch/arc/arc/arcbios.h new file mode 100644 index 00000000000..12be71da3f5 --- /dev/null +++ b/sys/arch/arc/arc/arcbios.h @@ -0,0 +1,303 @@ +/* $OpenBSD: arcbios.h,v 1.1 1996/09/06 04:57:51 imp Exp $ */ +/*- + * Copyright (c) 1996 M. Warner Losh. All rights reserved. + * + * 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. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 THE REGENTS OR CONTRIBUTORS 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. + */ + +#include <sys/types.h> + +typedef struct arc_sid +{ + char vendor[8]; + char prodid[8]; +} arc_sid_t; + +typedef enum arc_config_class +{ + arc_SystemClass, + arc_ProcessorClass, + arc_CacheClass, + arc_AdapterClass, + arc_ControllerClass, + arc_PeripheralClass, + arc_MemoryClass +} arc_config_class_t; + +typedef enum arc_config_type +{ + arc_System, + + arc_CentralProcessor, + arc_FloatingPointProcessor, + + arc_PrimaryIcache, + arc_PrimaryDcache, + arc_SecondaryIcache, + arc_SecondaryDcache, + arc_SecondaryCache, + + arc_EisaAdapter, /* Eisa adapter */ + arc_TcAdapter, /* Turbochannel adapter */ + arc_ScsiAdapter, /* SCSI adapter */ + arc_DtiAdapter, /* AccessBus adapter */ + arc_MultiFunctionAdapter, + + arc_DiskController, + arc_TapeController, + arc_CdromController, + arc_WormController, + arc_SerialController, + arc_NetworkController, + arc_DisplayController, + arc_ParallelController, + arc_PointerController, + arc_KeyboardController, + arc_AudioController, + arc_OtherController, /* denotes a controller not otherwise defined */ + + arc_DiskPeripheral, + arc_FloppyDiskPeripheral, + arc_TapePeripheral, + arc_ModemPeripheral, + arc_MonitorPeripheral, + arc_PrinterPeripheral, + arc_PointerPeripheral, + arc_KeyboardPeripheral, + arc_TerminalPeripheral, + arc_OtherPeripheral, /* denotes a peripheral not otherwise defined */ + arc_LinePeripheral, + arc_NetworkPeripheral, + + arc_SystemMemory +} arc_config_type_t; + +typedef u_char arc_dev_flags_t; + +/* Wonder how this is aligned... */ +typedef struct arc_config +{ + arc_config_class_t class; /* Likely these three all */ + arc_config_type_t type; /* need to be uchar to make */ + arc_dev_flags_t flags; /* the alignment right */ + u_int16_t version; + u_int16_t revision; + u_int32_t key; + u_int32_t affinity_mask; + u_int32_t config_data_len; + u_int32_t id_len; + char *id; +} arc_config_t; + +typedef enum arc_status +{ + arc_ESUCCESS, /* Success */ + arc_E2BIG, /* Arg list too long */ + arc_EACCES, /* No such file or directory */ + arc_EAGAIN, /* Try again */ + arc_EBADF, /* Bad file number */ + arc_EBUSY, /* Device or resource busy */ + arc_EFAULT, /* Bad address */ + arc_EINVAL, /* Invalid argument */ + arc_EIO, /* I/O error */ + arc_EISDIR, /* Is a directory */ + arc_EMFILE, /* Too many open files */ + arc_EMLINK, /* Too many links */ + arc_ENAMETOOLONG, /* File name too long */ + arc_ENODEV, /* No such device */ + arc_ENOENT, /* No such file or directory */ + arc_ENOEXEC, /* Exec format error */ + arc_ENOMEM, /* Out of memory */ + arc_ENOSPC, /* No space left on device */ + arc_ENOTDIR, /* Not a directory */ + arc_ENOTTY, /* Not a typewriter */ + arc_ENXIO, /* No such device or address */ + arc_EROFS, /* Read-only file system */ +} arc_status_t; + +typedef caddr_t arc_mem_t; /* XXX */ +typedef caddr_t arc_time_t; /* XXX */ +typedef caddr_t arc_dsp_stat_t; /* XXX */ +typedef caddr_t arc_dirent_t; /* XXX */ +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_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 */ + + arc_status_t (*invoke)( /* Invoke 2 */ + u_int32_t, /* Entry Address */ + u_int32_t, /* Stack Address */ + u_int32_t, /* Argc */ + char **, /* argv */ + char **); /* envp */ + + arc_status_t (*execute)( /* Execute 3 */ + char *, /* Image path */ + u_int32_t, /* Argc */ + char **, /* argv */ + char **); /* envp */ + + volatile void (*halt)(void); /* Halt 4 */ + + volatile void (*power_down)(void); /* PowerDown 5 */ + + volatile void (*restart)(void); /* Restart 6 */ + + volatile void (*reboot)(void); /* Reboot 7 */ + + volatile void (*enter_interactive_mode)(void); /* EnterInteractiveMode 8 */ + + volatile void (*return_from_main)(void); /* ReturnFromMain 9 */ + + arc_config_t *(*get_peer)( /* GetPeer 10 */ + arc_config_t *); /* Component */ + + arc_config_t *(*get_child)( /* GetChild 11 */ + arc_config_t *); /* Component */ + + arc_config_t *(*get_parent)( /* GetParent 12 */ + arc_config_t *); /* Component */ + + arc_status_t (*get_config_data)( /* GetConfigurationData 13 */ + caddr_t, /* Configuration Data */ + arc_config_t *); /* Component */ + + arc_config_t *(*add_child)( /* AddChild 14 */ + arc_config_t *, /* Component */ + arc_config_t *); /* New Component */ + + arc_status_t (*delete_component)( /* DeleteComponent 15 */ + arc_config_t *); /* Component */ + + arc_config_t *(*get_component)( /* GetComponent 16 */ + char *); /* Path */ + + arc_status_t (*save_config)(void); /* SaveConfiguration 17 */ + + arc_sid_t *(*get_system_id)(void); /* GetSystemId 18 */ + + arc_mem_t *(*get_memory_descriptor)( /* GetMemoryDescriptor 19 */ + arc_mem_t *); /* MemoryDescriptor */ + + void (*signal)( /* Signal 20 */ + u_int32_t, /* Signal number */ +/**/ caddr_t); /* Handler */ + + arc_time_t *(*get_time)(void); /* GetTime 21 */ + + u_int32_t (*get_relative_time)(void); /* GetRelativeTime 22 */ + + arc_status_t (*get_dir_entry)( /* GetDirectoryEntry 23 */ + u_int32_t, /* FileId */ + arc_dirent_t *, /* Directory entry */ + u_int32_t, /* Length */ + u_int32_t *); /* Count */ + + arc_status_t (*open)( /* Open 24 */ + char *, /* Path */ + arc_open_mode_t, /* Open mode */ + u_int32_t *); /* FileId */ + + arc_status_t (*close)( /* Close 25 */ + u_int32_t); /* FileId */ + + arc_status_t (*read)( /* Read 26 */ + u_int32_t, /* FileId */ + caddr_t, /* Buffer */ + u_int32_t, /* Length */ + u_int32_t *); /* Count */ + + arc_status_t (*get_read_status)( /* GetReadStatus 27 */ + u_int32_t); /* FileId */ + + arc_status_t (*write)( /* Write 28 */ + u_int32_t, /* FileId */ + caddr_t, /* Buffer */ + u_int32_t, /* Length */ + u_int32_t *); /* Count */ + + arc_status_t (*seek)( /* Seek 29 */ + u_int32_t, /* FileId */ + int64_t *, /* Offset */ + arc_seek_mode_t); /* Mode */ + + arc_status_t (*mount)( /* Mount 30 */ + char *, /* Path */ + arc_mount_t); /* Operation */ + + char *(*getenv)( /* GetEnvironmentVariable 31 */ + char *); /* Variable */ + + arc_status_t (*putenv)( /* SetEnvironmentVariable 32 */ + char *, /* Variable */ + char *); /* Value */ + + arc_status_t (*get_file_info)(); /* GetFileInformation 33 */ + + arc_status_t (*set_file_info)(); /* SetFileInformation 34 */ + + void (*flush_all_caches)(void); /* FlushAllCaches 35 */ + + arc_status_t (*test_unicode)( /* TestUnicodeCharacter 36 */ + u_int32_t, /* FileId */ + u_int16_t); /* UnicodeCharacter */ + + arc_dsp_stat_t *(*get_display_status)( /* GetDisplayStatus 37 */ + u_int32_t); /* FileId */ +} arc_calls_t; + +#define ARC_PARAM_BLK_MAGIC 0x41524353 + +typedef struct arc_param_blk +{ + u_int32_t magic; /* Magic Number */ + u_int32_t length; /* Length of parameter block */ + u_int16_t version; /* ?? */ + u_int16_t revision; /* ?? */ +/**/ caddr_t restart_block; /* ?? */ +/**/ caddr_t debug_block; /* Debugging info -- unused */ +/**/ caddr_t general_exp_vect; /* ?? */ +/**/ caddr_t tlb_miss_exp_vect; /* ?? */ + u_int32_t firmware_length; /* Size of Firmware jumptable in bytes */ + arc_calls_t *firmware_vect; /* Firmware jumptable */ + u_int32_t vendor_length; /* Size of Vendor specific jumptable */ +/**/ caddr_t vendor_vect; /* Vendor specific jumptable */ + u_int32_t adapter_count; /* ?? */ + u_int32_t adapter0_type; /* ?? */ + u_int32_t adapter0_length; /* ?? */ +/**/ caddr_t adapter0_vect; /* ?? */ +} arc_param_blk_t; + +#define ArcBiosBase ((arc_param_blk_t *) 0x80001000) +#define ArcBios (ArcBiosBase->firmware_vect) + +extern void arcbios_ident(void); diff --git a/sys/arch/arc/arc/machdep.c b/sys/arch/arc/arc/machdep.c index 3c6d95d72b8..bc16dfda214 100644 --- a/sys/arch/arc/arc/machdep.c +++ b/sys/arch/arc/arc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.10 1996/09/05 08:04:14 pefo Exp $ */ +/* $OpenBSD: machdep.c,v 1.11 1996/09/06 04:57:52 imp Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1992, 1993 @@ -38,7 +38,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 8.3 (Berkeley) 1/12/94 - * $Id: machdep.c,v 1.10 1996/09/05 08:04:14 pefo Exp $ + * $Id: machdep.c,v 1.11 1996/09/06 04:57:52 imp Exp $ */ /* from: Utah Hdr: machdep.c 1.63 91/04/24 */ @@ -90,6 +90,7 @@ #include <dev/cons.h> #include <arc/arc/arctype.h> +#include <arc/arc/arcbios.h> #include <arc/pica/pica.h> #include <arc/dti/desktech.h> @@ -184,9 +185,8 @@ mips_init(argc, argv, code) v = (caddr_t)mips_round_page(end); bzero(edata, v - edata); - cputype = ACER_PICA_61; /* FIXME find systemtype */ - - cputype = DESKSTATION_TYNE; /* FIXME find systemtype */ + /* Initialize the CPU type */ + bios_ident(); /* * Get config register now as mapped from BIOS since we are diff --git a/sys/arch/arc/conf/files.arc b/sys/arch/arc/conf/files.arc index 24bc6c15356..d7b2d12754b 100644 --- a/sys/arch/arc/conf/files.arc +++ b/sys/arch/arc/conf/files.arc @@ -1,4 +1,4 @@ -# $OpenBSD: files.arc,v 1.2 1996/06/24 20:05:35 pefo Exp $ +# $OpenBSD: files.arc,v 1.3 1996/09/06 04:57:50 imp Exp $ # # maxpartitions must be first item in files.${ARCH} # @@ -23,6 +23,8 @@ file arch/arc/arc/sys_machdep.c file arch/arc/arc/trap.c file arch/arc/arc/vm_machdep.c +file arch/arc/arc/arcbios.c + # # Machine-independent ATAPI drivers # |