File:  [DragonFly] / src / sys / i386 / include / Attic / globaldata.h
Revision 1.23: download - view: text, annotated - select for diffs
Sat Feb 21 06:37:07 2004 UTC (10 years, 10 months ago) by dillon
Branches: MAIN
CVS tags: HEAD
Synchronize a bunch of things from FreeBSD-5 in preparation for the new
ACPICA driver support.

* Bring in a lot of new bus and pci DEV_METHODs from FreeBSD-5
* split apic.h into apicreg.h and apicio.h
* rename INTR_TYPE_FAST -> INTR_FAST and move the #define
* rename INTR_TYPE_EXCL -> INTR_EXCL and move the #define
* rename some PCIR_ registers and add additional macros from FreeBSD-5
* note: new pcib bus call, host_pcib_get_busno() imported.
* kern/subr_power.c no longer optional.

Other changes:

* machine/smp.h machine smp/smptests.h can now be #included unconditionally,
  and some APIC_IO vs SMP separation has been done as well.
* gd_acpi_id and gd_apic_id added to machine/globaldata.h prep for new
  ACPI code.

Despite all the changes, the generated code should be virtually the same.
These were mostly additions which the pre-existing code does not (yet) use.

    1: /*-
    2:  * Copyright (c) Peter Wemm <peter@netplex.com.au>
    3:  * All rights reserved.
    4:  *
    5:  * Redistribution and use in source and binary forms, with or without
    6:  * modification, are permitted provided that the following conditions
    7:  * are met:
    8:  * 1. Redistributions of source code must retain the above copyright
    9:  *    notice, this list of conditions and the following disclaimer.
   10:  * 2. Redistributions in binary form must reproduce the above copyright
   11:  *    notice, this list of conditions and the following disclaimer in the
   12:  *    documentation and/or other materials provided with the distribution.
   13:  *
   14:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   15:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   16:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   17:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   18:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   19:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   20:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   21:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   22:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   23:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   24:  * SUCH DAMAGE.
   25:  *
   26:  *	Only machine-dependant code should ever include this file.  MI
   27:  *	code and header files do NOT include this file.  e.g. sys/globaldata.h
   28:  *	should not include this file.
   29:  *
   30:  * $FreeBSD: src/sys/i386/include/globaldata.h,v 1.11.2.1 2000/05/16 06:58:10 dillon Exp $
   31:  * $DragonFly: src/sys/i386/include/globaldata.h,v 1.23 2004/02/21 06:37:07 dillon Exp $
   32:  */
   33: 
   34: #ifndef _MACHINE_GLOBALDATA_H_
   35: #define _MACHINE_GLOBALDATA_H_
   36: 
   37: #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
   38: 
   39: #ifndef _SYS_GLOBALDATA_H_
   40: #include <sys/globaldata.h>	/* struct globaldata */
   41: #endif
   42: #ifndef _SYS_THREAD_H_
   43: #include <sys/thread.h>		/* struct thread */
   44: #endif
   45: #ifndef _MACHINE_SEGMENTS_H_
   46: #include "segments.h"	/* struct segment_descriptor */
   47: #endif
   48: #ifndef _MACHINE_TSS_H_
   49: #include "tss.h"	/* struct i386tss */
   50: #endif
   51: 
   52: /*
   53:  * Note on interrupt control.  Pending interrupts not yet dispatched are
   54:  * marked in gd_fpending or gd_ipending.  Once dispatched the interrupt's
   55:  * pending bit is cleared and the interrupt is masked.  Upon completion
   56:  * the interrupt is unmasked.
   57:  *
   58:  * For edge triggered interrupts interrupts may be enabled again at this
   59:  * point and if they occur before the interrupt service routine is complete
   60:  * the service routine will loop.
   61:  *
   62:  * The current thread's cpl is stored in the thread structure.
   63:  */
   64: struct mdglobaldata {
   65: 	struct globaldata mi;
   66: 	struct segment_descriptor gd_common_tssd;
   67: 	struct segment_descriptor *gd_tss_gdt;
   68: 	struct thread   *gd_npxthread;
   69: 	struct i386tss  gd_common_tss;
   70: 	int		gd_fpending;	/* fast interrupt pending */
   71: 	int		gd_ipending;	/* normal interrupt pending */
   72: 	int		gd_idelayed;	/* delayed software ints */
   73: 	int		gd_currentldt;
   74: 	int		gd_private_tss;
   75: 	u_int		unused001;
   76: 	u_int		gd_other_cpus;
   77: 	u_int		gd_ss_eflags;
   78: 	pt_entry_t	*gd_CMAP1;
   79: 	pt_entry_t	*gd_CMAP2;
   80: 	pt_entry_t	*gd_CMAP3;
   81: 	pt_entry_t	*gd_PMAP1;
   82: 	caddr_t		gd_CADDR1;
   83: 	caddr_t		gd_CADDR2;
   84: 	caddr_t		gd_CADDR3;
   85: 	unsigned	*gd_PADDR1;
   86: 	u_int		gd_acpi_id;
   87: 	u_int		gd_apic_id;
   88: };
   89: 
   90: /*
   91:  * This is the upper (0xff800000) address space layout that is per-cpu.
   92:  * It is setup in locore.s and pmap.c for the BSP and in mp_machdep.c for
   93:  * each AP.  genassym helps export this to the assembler code.
   94:  *
   95:  * WARNING!  page-bounded fields are hardwired for SMPpt[] setup in
   96:  * i386/i386/mp_machdep.c and locore.s.
   97:  */
   98: struct privatespace {
   99: 	/* page 0 - data page */
  100: 	struct mdglobaldata mdglobaldata;
  101: 	char		__filler0[PAGE_SIZE - sizeof(struct mdglobaldata)];
  102: 
  103: 	/* page 1..4 - CPAGE1,CPAGE2,CPAGE3,PPAGE1 */
  104: 	char		CPAGE1[PAGE_SIZE];		/* SMPpt[1] */
  105: 	char		CPAGE2[PAGE_SIZE];		/* SMPpt[2] */
  106: 	char		CPAGE3[PAGE_SIZE];		/* SMPpt[3] */
  107: 	char		PPAGE1[PAGE_SIZE];		/* SMPpt[4] */
  108: 
  109: 	/* page 5..4+UPAGES - idle stack (UPAGES pages) */
  110: 	char		idlestack[UPAGES * PAGE_SIZE];	/* SMPpt[5..] */
  111: };
  112: #define mdcpu  		((struct mdglobaldata *)_get_mycpu())
  113: 
  114: #endif
  115: 
  116: #ifdef _KERNEL
  117: 
  118: extern struct privatespace CPU_prvspace[];
  119: 
  120: #endif
  121: 
  122: #endif