The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/pc98/pc98/pc98_machdep.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) KATO Takenori, 1996, 1997.
    3  *
    4  * All rights reserved.  Unpublished rights reserved under the copyright
    5  * laws of Japan.
    6  *
    7  * 
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer as
   13  *    the first lines of this file unmodified.
   14  * 2. Redistributions in binary form must reproduce the above copyright
   15  *    notice, this list of conditions and the following disclaimer in the
   16  *    documentation and/or other materials provided with the distribution.
   17  * 3. The name of the author may not be used to endorse or promote products
   18  *    derived from this software without specific prior written permission.
   19  * 
   20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   23  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   25  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   29  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   30  *
   31  * $FreeBSD: releng/6.0/sys/pc98/pc98/pc98_machdep.c 146049 2005-05-10 12:02:18Z nyan $
   32  */
   33 
   34 #include "opt_pc98.h"
   35 
   36 #include <sys/param.h>
   37 #include <sys/systm.h>
   38 
   39 #include <cam/cam.h>
   40 #include <cam/cam_ccb.h>
   41 #ifdef EPSON_MEMWIN
   42 #include <pc98/cbus/cbus.h>
   43 #endif
   44 #include <pc98/pc98/pc98_machdep.h>
   45 
   46 /*
   47  * Initialize DMA controller
   48  */
   49 void
   50 pc98_init_dmac(void)
   51 {
   52         outb(0x439, (inb(0x439) & 0xfb));       /* DMA Accsess Control over 1MB */
   53         outb(0x29, (0x0c | 0));                         /* Bank Mode Reg. 16M mode */
   54         outb(0x29, (0x0c | 1));                         /* Bank Mode Reg. 16M mode */
   55         outb(0x29, (0x0c | 2));                         /* Bank Mode Reg. 16M mode */
   56         outb(0x29, (0x0c | 3));                         /* Bank Mode Reg. 16M mode */
   57         outb(0x11, 0x50);
   58 }
   59 
   60 #ifdef EPSON_MEMWIN
   61 /*
   62  * Disconnect phisical memory in 15-16MB region.
   63  *
   64  * EPSON PC-486GR, P, SR, SE, HX, HG and HA only.  Other system support
   65  * this feature with software DIP switch.
   66  */
   67 static void
   68 init_epson_memwin(void)
   69 {
   70         /* Disable 15MB-16MB caching. */
   71         switch (epson_machine_id) {
   72         case 0x34:      /* PC486HX */
   73         case 0x35:      /* PC486HG */
   74         case 0x3B:      /* PC486HA */
   75                 /* Cache control start. */
   76                 outb(0x43f, 0x42);
   77                 outw(0xc40, 0x0033);
   78 
   79                 /* Disable 0xF00000-0xFFFFFF. */
   80                 outb(0xc48, 0x49);
   81                 outb(0xc4c, 0x00);
   82                 outb(0xc48, 0x48);
   83                 outb(0xc4c, 0xf0);
   84                 outb(0xc48, 0x4d);
   85                 outb(0xc4c, 0x00);
   86                 outb(0xc48, 0x4c);
   87                 outb(0xc4c, 0xff);
   88                 outb(0xc48, 0x4f);
   89                 outb(0xc4c, 0x00);
   90 
   91                 /* Cache control end. */
   92                 outb(0x43f, 0x40);
   93                 break;
   94 
   95         case 0x2B:      /* PC486GR/GF */
   96         case 0x30:      /* PC486P */
   97         case 0x31:      /* PC486GRSuper */
   98         case 0x32:      /* PC486GR+ */
   99         case 0x37:      /* PC486SE */
  100         case 0x38:      /* PC486SR */
  101                 /* Disable 0xF00000-0xFFFFFF. */
  102                 outb(0x43f, 0x42);
  103                 outb(0x467, 0xe0);
  104                 outb(0x567, 0xd8);
  105 
  106                 outb(0x43f, 0x40);
  107                 outb(0x467, 0xe0);
  108                 outb(0x567, 0xe0);
  109                 break;
  110         }
  111 
  112         /* Disable 15MB-16MB RAM and enable memory window. */
  113         outb(0x43b, inb(0x43b) & 0xfd); /* Clear bit1. */
  114 }
  115 #endif
  116 
  117 /*
  118  * Get physical memory size
  119  */
  120 unsigned int
  121 pc98_getmemsize(unsigned int *base, unsigned int *ext)
  122 {
  123         unsigned int under16, over16;
  124 
  125         /* available conventional memory size */
  126         *base = ((PC98_SYSTEM_PARAMETER(0x501) & 7) + 1) * 128;
  127 
  128         /* available protected memory size under 16MB */
  129         under16 = PC98_SYSTEM_PARAMETER(0x401) * 128 + 1024;
  130 #ifdef EPSON_MEMWIN
  131         if (pc98_machine_type & M_EPSON_PC98) {
  132                 if (under16 > (15 * 1024))
  133                         /* chop under16 memory to 15MB */
  134                         under16 = 15 * 1024;
  135                 init_epson_memwin();
  136         }
  137 #endif
  138 
  139         /* available protected memory size over 16MB / 1MB */
  140         over16  = PC98_SYSTEM_PARAMETER(0x594);
  141         over16 += PC98_SYSTEM_PARAMETER(0x595) * 256;
  142 
  143         if (over16 > 0)
  144                 *ext = (16 + over16) * 1024 - 1024;
  145         else
  146                 *ext = under16 - 1024;
  147 
  148         return (under16);
  149 }
  150 
  151 /*
  152  * Read a geometry information of SCSI HDD from BIOS work area.
  153  *
  154  * XXX - Before reading BIOS work area, we should check whether
  155  * host adapter support it.
  156  */
  157 int
  158 scsi_da_bios_params(struct ccb_calc_geometry *ccg)
  159 {
  160         u_char *tmp;
  161         int     target;
  162 
  163         target = ccg->ccb_h.target_id;
  164         tmp = (u_char *)&PC98_SYSTEM_PARAMETER(0x460 + target*4);
  165         if ((PC98_SYSTEM_PARAMETER(0x482) & ((1 << target)&0xff)) != 0) {
  166                 ccg->secs_per_track = *tmp;
  167                 ccg->cylinders = ((*(tmp+3)<<8)|*(tmp+2))&0xfff;
  168 #if 0
  169                 switch (*(tmp + 3) & 0x30) {
  170                 case 0x00:
  171                         disk_parms->secsiz = 256;
  172                         printf("Warning!: not supported.\n");
  173                         break;
  174                 case 0x10:
  175                         disk_parms->secsiz = 512;
  176                         break;
  177                 case 0x20:
  178                         disk_parms->secsiz = 1024;
  179                         break;
  180                 default:
  181                         disk_parms->secsiz = 512;
  182                         printf("Warning!: not supported. But force to 512\n");
  183                         break;
  184                 }
  185 #endif
  186                 if (*(tmp+3) & 0x40) {
  187                         ccg->cylinders += (*(tmp+1)&0xf0)<<8;
  188                         ccg->heads = *(tmp+1)&0x0f;
  189                 } else {
  190                         ccg->heads = *(tmp+1);
  191                 }
  192                 return (1);
  193         }
  194 
  195         return (0);
  196 }

Cache object: 00454b5de18f6e5a0065db5e56a59b44


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.