pc.cc revision 5478
12SN/A/* 22188SN/A * Copyright (c) 2008 The Regents of The University of Michigan 32SN/A * All rights reserved. 42SN/A * 52SN/A * Redistribution and use in source and binary forms, with or without 62SN/A * modification, are permitted provided that the following conditions are 72SN/A * met: redistributions of source code must retain the above copyright 82SN/A * notice, this list of conditions and the following disclaimer; 92SN/A * redistributions in binary form must reproduce the above copyright 102SN/A * notice, this list of conditions and the following disclaimer in the 112SN/A * documentation and/or other materials provided with the distribution; 122SN/A * neither the name of the copyright holders nor the names of its 132SN/A * contributors may be used to endorse or promote products derived from 142SN/A * this software without specific prior written permission. 152SN/A * 162SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665SN/A * 282665SN/A * Authors: Gabe Black 292665SN/A */ 302665SN/A 312665SN/A/** @file 322SN/A * Implementation of PC platform. 332SN/A */ 342SN/A 352SN/A#include <deque> 362465SN/A#include <string> 377680Sgblack@eecs.umich.edu#include <vector> 386658Snate@binkert.org 391717SN/A#include "arch/x86/x86_traits.hh" 402683Sktlim@umich.edu#include "dev/intel_8254_timer.hh" 412680SN/A#include "cpu/intr_control.hh" 428761Sgblack@eecs.umich.edu#include "dev/terminal.hh" 435529Snate@binkert.org#include "dev/x86/pc.hh" 448767Sgblack@eecs.umich.edu#include "sim/system.hh" 452SN/A 461858SN/Ausing namespace std; 473565Sgblack@eecs.umich.eduusing namespace TheISA; 485529Snate@binkert.org 491917SN/APC::PC(const Params *p) 501070SN/A : Platform(p), system(p->system) 511917SN/A{ 522188SN/A southBridge = NULL; 531917SN/A // set the back pointer from the system to myself 542290SN/A system->platform = this; 551070SN/A} 561917SN/A 572SN/Avoid 585529Snate@binkert.orgPC::init() 592519SN/A{ 602SN/A assert(southBridge); 612SN/A Intel8254Timer & timer = southBridge->pit.pit; 622SN/A //Timer 0, mode 2, no bcd, 16 bit count 632SN/A timer.writeControl(0x34); 642SN/A //Timer 0, latch command 658766Sgblack@eecs.umich.edu timer.writeControl(0x00); 668766Sgblack@eecs.umich.edu //Write a 16 bit count of 0 678766Sgblack@eecs.umich.edu timer.counter0.write(0); 688766Sgblack@eecs.umich.edu timer.counter0.write(0); 698766Sgblack@eecs.umich.edu} 708766Sgblack@eecs.umich.edu 718766Sgblack@eecs.umich.eduTick 728766Sgblack@eecs.umich.eduPC::intrFrequency() 738766Sgblack@eecs.umich.edu{ 748766Sgblack@eecs.umich.edu panic("Need implementation\n"); 752683Sktlim@umich.edu M5_DUMMY_RETURN 766022Sgblack@eecs.umich.edu} 772683Sktlim@umich.edu 788766Sgblack@eecs.umich.eduvoid 796324Sgblack@eecs.umich.eduPC::postConsoleInt() 802521SN/A{ 812SN/A warn_once("Don't know what interrupt to post for console.\n"); 822683Sktlim@umich.edu //panic("Need implementation\n"); 832190SN/A} 842680SN/A 852290SN/Avoid 866316Sgblack@eecs.umich.eduPC::clearConsoleInt() 871917SN/A{ 885529Snate@binkert.org warn_once("Don't know what interrupt to clear for console.\n"); 891982SN/A //panic("Need implementation\n"); 901917SN/A} 912683Sktlim@umich.edu 922683Sktlim@umich.eduvoid 931917SN/APC::postPciInt(int line) 941917SN/A{ 951917SN/A panic("Need implementation\n"); 961917SN/A} 971917SN/A 981917SN/Avoid 991917SN/APC::clearPciInt(int line) 1001917SN/A{ 1012521SN/A panic("Need implementation\n"); 1025482Snate@binkert.org} 1033548Sgblack@eecs.umich.edu 1042SN/AAddr 1052862Sktlim@umich.eduPC::pciToDma(Addr pciAddr) const 1062862Sktlim@umich.edu{ 1072864Sktlim@umich.edu panic("Need implementation\n"); 1086331Sgblack@eecs.umich.edu M5_DUMMY_RETURN 1092190SN/A} 1102683Sktlim@umich.edu 1112190SN/A 1122190SN/AAddr 1132683Sktlim@umich.eduPC::calcConfigAddr(int bus, int dev, int func) 1141070SN/A{ 1158754Sgblack@eecs.umich.edu assert(func < 8); 1163486Sktlim@umich.edu assert(dev < 32); 1172680SN/A assert(bus == 0); 1181070SN/A return (PhysAddrPrefixPciConfig | (func << 8) | (dev << 11)); 1191070SN/A} 1201917SN/A 1212683Sktlim@umich.eduPC * 122180SN/APCParams::create() 123180SN/A{ 1241858SN/A return new PC(this); 1252235SN/A} 1268767Sgblack@eecs.umich.edu