From f07a4c844da9f0ecae5bbee1ab94be56505f26f7 Mon Sep 17 00:00:00 2001 From: Thomas Bushnell Date: Tue, 25 Feb 1997 21:28:37 +0000 Subject: Initial source --- i386/imps/Makefile.in | 66 ++++++++++++++++++++++++++++++++++ i386/imps/apic.h | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++ i386/imps/cpu_number.h | 50 ++++++++++++++++++++++++++ i386/imps/cpus.h | 24 +++++++++++++ i386/imps/imps.c | 51 +++++++++++++++++++++++++++ i386/imps/impsasm.sym | 29 +++++++++++++++ 6 files changed, 316 insertions(+) create mode 100644 i386/imps/Makefile.in create mode 100644 i386/imps/apic.h create mode 100644 i386/imps/cpu_number.h create mode 100644 i386/imps/cpus.h create mode 100644 i386/imps/imps.c create mode 100644 i386/imps/impsasm.sym (limited to 'i386/imps') diff --git a/i386/imps/Makefile.in b/i386/imps/Makefile.in new file mode 100644 index 0000000..bf353f1 --- /dev/null +++ b/i386/imps/Makefile.in @@ -0,0 +1,66 @@ +# +# Copyright (c) 1994 The University of Utah and +# the Computer Systems Laboratory (CSL). All rights reserved. +# +# Permission to use, copy, modify and distribute this software and its +# documentation is hereby granted, provided that both the copyright +# notice and this permission notice appear in all copies of the +# software, derivative works or modified versions, and any portions +# thereof, and that both notices appear in supporting documentation. +# +# THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS +# IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF +# ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. +# +# CSL requests users of this software to return to csl-dist@cs.utah.edu any +# improvements that they make and grant CSL redistribution rights. +# +# Author: Bryan Ford, University of Utah CSL +# + + +# This makefile creates a microkernel +# that supports Intel MP specification-compliant machines. +#### Start of configuration section #### + +GSRCDIR = @top_gsrcdir@ +MSRCDIR = @top_srcdir@ +OBJDIR = @top_objdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +include $(OBJDIR)/Makeconf + +##### End of configuration section ##### + + +# Only build an MP kernel if the user asked for one. +ifeq ($(ENABLE_MP),yes) + + +# First define what we're trying to accomplish. +TARGET = kernel-imps.bmod + + +# For Intel MP spec support add the imps directory. +SRCDIRS += $(MSRCDIR)/kernel/imps + + +# Everything else is done in here. +include $(MSRCDIR)/kernel/Makerules + + +# Be sure and build the asm symbol file before anything else. +# This is sort of a bogus dependency, but it does the job. +i386asm.h: impsasm.h +CLEAN_FILES += impsasm.h + + +else + +all: +clean: +install: + +endif diff --git a/i386/imps/apic.h b/i386/imps/apic.h new file mode 100644 index 0000000..24a161a --- /dev/null +++ b/i386/imps/apic.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) 1994 The University of Utah and + * the Computer Systems Laboratory at the University of Utah (CSL). + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software is hereby + * granted provided that (1) source code retains these copyright, permission, + * and disclaimer notices, and (2) redistributions including binaries + * reproduce the notices in supporting documentation, and (3) all advertising + * materials mentioning features or use of this software display the following + * acknowledgement: ``This product includes software developed by the + * Computer Systems Laboratory at the University of Utah.'' + * + * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS + * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF + * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * CSL requests users of this software to return to csl-dist@cs.utah.edu any + * improvements that they make and grant CSL redistribution rights. + * + * Author: Bryan Ford, University of Utah CSL + */ +#ifndef _IMPS_APIC_ +#define _IMPS_APIC_ + +typedef struct ApicReg +{ + unsigned r; /* the actual register */ + unsigned p[3]; /* pad to the next 128-bit boundary */ +} ApicReg; + +typedef struct ApicIoUnit +{ + ApicReg select; + ApicReg window; +} ApicIoUnit; +#define APIC_IO_UNIT_ID 0x00 +#define APIC_IO_VERSION 0x01 +#define APIC_IO_REDIR_LOW(int_pin) (0x10+(int_pin)*2) +#define APIC_IO_REDIR_HIGH(int_pin) (0x11+(int_pin)*2) + +typedef struct ApicLocalUnit +{ + ApicReg reserved0; + ApicReg reserved1; + ApicReg unit_id; + ApicReg version; + ApicReg reserved4; + ApicReg reserved5; + ApicReg reserved6; + ApicReg reserved7; + ApicReg task_pri; + ApicReg reservedb; + ApicReg reservedc; + ApicReg eoi; + ApicReg remote; + ApicReg logical_dest; + ApicReg dest_format; + ApicReg spurious_vector; + ApicReg isr[8]; + ApicReg tmr[8]; + ApicReg irr[8]; + ApicReg reserved28[8]; + ApicReg int_command[2]; + ApicReg timer_vector; + ApicReg reserved33; + ApicReg reserved34; + ApicReg lint0_vector; + ApicReg lint1_vector; + ApicReg reserved37; + ApicReg init_count; + ApicReg cur_count; + ApicReg reserved3a; + ApicReg reserved3b; + ApicReg reserved3c; + ApicReg reserved3d; + ApicReg divider_config; + ApicReg reserved3f; +} ApicLocalUnit; + + +/* Address at which the local unit is mapped in kernel virtual memory. + Must be constant. */ +#define APIC_LOCAL_VA 0xc1000000 + +#define apic_local_unit (*((volatile ApicLocalUnit*)APIC_LOCAL_VA)) + + +/* Set or clear a bit in a 255-bit APIC mask register. + These registers are spread through eight 32-bit registers. */ +#define APIC_SET_MASK_BIT(reg, bit) \ + ((reg)[(bit) >> 5].r |= 1 << ((bit) & 0x1f)) +#define APIC_CLEAR_MASK_BIT(reg, bit) \ + ((reg)[(bit) >> 5].r &= ~(1 << ((bit) & 0x1f))) + +#endif _IMPS_APIC_ diff --git a/i386/imps/cpu_number.h b/i386/imps/cpu_number.h new file mode 100644 index 0000000..cae267b --- /dev/null +++ b/i386/imps/cpu_number.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 1994 The University of Utah and + * the Computer Systems Laboratory at the University of Utah (CSL). + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software is hereby + * granted provided that (1) source code retains these copyright, permission, + * and disclaimer notices, and (2) redistributions including binaries + * reproduce the notices in supporting documentation, and (3) all advertising + * materials mentioning features or use of this software display the following + * acknowledgement: ``This product includes software developed by the + * Computer Systems Laboratory at the University of Utah.'' + * + * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS + * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF + * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * CSL requests users of this software to return to csl-dist@cs.utah.edu any + * improvements that they make and grant CSL redistribution rights. + * + * Author: Bryan Ford, University of Utah CSL + */ +#ifndef _IMPS_CPU_NUMBER_ +#define _IMPS_CPU_NUMBER_ + + +#ifndef ASSEMBLER + +#include "apic.h" + +static inline int +cpu_number() +{ + return apic_local_unit.unit_id.r >> 24; +} + +#else ASSEMBLER + +#include "impsasm.h" + +#define CPU_NUMBER(reg) \ + movzbl APIC_LOCAL_VA+APIC_LOCAL_UNIT_ID+3,reg + +#endif ASSEMBLER + + +#include "i386/cpu_number.h" + + +#endif _IMPS_CPU_NUMBER_ diff --git a/i386/imps/cpus.h b/i386/imps/cpus.h new file mode 100644 index 0000000..f49d85e --- /dev/null +++ b/i386/imps/cpus.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 1994 The University of Utah and + * the Computer Systems Laboratory at the University of Utah (CSL). + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software is hereby + * granted provided that (1) source code retains these copyright, permission, + * and disclaimer notices, and (2) redistributions including binaries + * reproduce the notices in supporting documentation, and (3) all advertising + * materials mentioning features or use of this software display the following + * acknowledgement: ``This product includes software developed by the + * Computer Systems Laboratory at the University of Utah.'' + * + * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS + * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF + * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * CSL requests users of this software to return to csl-dist@cs.utah.edu any + * improvements that they make and grant CSL redistribution rights. + * + * Author: Bryan Ford, University of Utah CSL + */ +#define NCPUS 2 /* XXX make it unlimited */ +#define MULTIPROCESSOR 1 diff --git a/i386/imps/imps.c b/i386/imps/imps.c new file mode 100644 index 0000000..279ca3d --- /dev/null +++ b/i386/imps/imps.c @@ -0,0 +1,51 @@ +/* + * Copyright (c) 1994 The University of Utah and + * the Computer Systems Laboratory at the University of Utah (CSL). + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software is hereby + * granted provided that (1) source code retains these copyright, permission, + * and disclaimer notices, and (2) redistributions including binaries + * reproduce the notices in supporting documentation, and (3) all advertising + * materials mentioning features or use of this software display the following + * acknowledgement: ``This product includes software developed by the + * Computer Systems Laboratory at the University of Utah.'' + * + * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS + * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF + * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * CSL requests users of this software to return to csl-dist@cs.utah.edu any + * improvements that they make and grant CSL redistribution rights. + * + * Author: Bryan Ford, University of Utah CSL + */ + +#include + +void +interrupt_processor(int which_cpu) +{ + panic("interrupt_processor"); +} + +void +start_other_cpus() +{ +printf("start other CPUs please!!!\n"); +} + +kern_return_t +cpu_control(int cpu, int *info, int count) +{ +printf("cpu_control %d\n", cpu); + return KERN_FAILURE; +} + +kern_return_t +cpu_start(int cpu) +{ +printf("cpu_start %d\n", cpu); + return KERN_FAILURE; +} + diff --git a/i386/imps/impsasm.sym b/i386/imps/impsasm.sym new file mode 100644 index 0000000..4093d41 --- /dev/null +++ b/i386/imps/impsasm.sym @@ -0,0 +1,29 @@ +/* + * Copyright (c) 1994 The University of Utah and + * the Computer Systems Laboratory at the University of Utah (CSL). + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software is hereby + * granted provided that (1) source code retains these copyright, permission, + * and disclaimer notices, and (2) redistributions including binaries + * reproduce the notices in supporting documentation, and (3) all advertising + * materials mentioning features or use of this software display the following + * acknowledgement: ``This product includes software developed by the + * Computer Systems Laboratory at the University of Utah.'' + * + * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS + * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF + * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * CSL requests users of this software to return to csl-dist@cs.utah.edu any + * improvements that they make and grant CSL redistribution rights. + * + * Author: Bryan Ford, University of Utah CSL + */ + +#include "apic.h" + +expr APIC_LOCAL_VA + +offset ApicLocalUnit apic_local unit_id + -- cgit v1.2.3