1 /////////////////////////////////////////////////////////////////////////
2 // $Id: pci.h,v 1.27 2007/09/28 19:52:03 sshwarts Exp $
3 /////////////////////////////////////////////////////////////////////////
5 // Copyright (C) 2002 MandrakeSoft S.A.
9 // 75002 Paris - France
10 // http://www.linux-mandrake.com/
11 // http://www.mandrakesoft.com/
13 // This library is free software; you can redistribute it and/or
14 // modify it under the terms of the GNU Lesser General Public
15 // License as published by the Free Software Foundation; either
16 // version 2 of the License, or (at your option) any later version.
18 // This library is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 // Lesser General Public License for more details.
23 // You should have received a copy of the GNU Lesser General Public
24 // License along with this library; if not, write to the Free Software
25 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #ifndef BX_IODEV_PCI_BRIDGE_H
28 #define BX_IODEV_PCI_BRIDGE_H
30 #define BX_MAX_PCI_DEVICES 20
32 #define BX_PCI_DEVICE(device, function) ((device)<<3 | (function))
35 # define BX_PCI_SMF static
36 # define BX_PCI_THIS thePciBridge->
39 # define BX_PCI_THIS this->
53 class bx_pci_device_stub_c
;
55 class bx_pci_bridge_c
: public bx_pci_bridge_stub_c
{
58 virtual ~bx_pci_bridge_c();
59 virtual void init(void);
60 virtual void reset(unsigned type
);
61 virtual void register_state(void);
62 virtual void after_restore_state(void);
63 virtual bx_bool
register_pci_handlers(bx_pci_device_stub_c
*device
,
64 Bit8u
*devfunc
, const char *name
,
66 virtual bx_bool
is_pci_device(const char *name
);
67 virtual bx_bool
pci_set_base_mem(void *this_ptr
, memory_handler_t f1
,
68 memory_handler_t f2
, Bit32u
*addr
,
69 Bit8u
*pci_conf
, unsigned size
);
70 virtual bx_bool
pci_set_base_io(void *this_ptr
, bx_read_handler_t f1
,
71 bx_write_handler_t f2
, Bit32u
*addr
,
72 Bit8u
*pci_conf
, unsigned size
,
73 const Bit8u
*iomask
, const char *name
);
74 virtual void print_i440fx_state(void);
75 virtual Bit8u
rd_memType (Bit32u addr
);
76 virtual Bit8u
wr_memType (Bit32u addr
);
78 virtual Bit32u
pci_read_handler(Bit8u address
, unsigned io_len
);
79 virtual void pci_write_handler(Bit8u address
, Bit32u value
, unsigned io_len
);
82 Bit8u pci_handler_id
[0x100]; // 256 devices/functions
84 bx_pci_device_stub_c
*handler
;
85 } pci_handler
[BX_MAX_PCI_DEVICES
];
86 unsigned num_pci_handlers
;
88 bx_bool slot_used
[BX_N_PCI_SLOTS
];
89 bx_bool slots_checked
;
95 void smram_control(Bit8u value
);
97 static Bit32u
read_handler(void *this_ptr
, Bit32u address
, unsigned io_len
);
98 static void write_handler(void *this_ptr
, Bit32u address
, Bit32u value
, unsigned io_len
);
100 Bit32u
read(Bit32u address
, unsigned io_len
);
101 void write(Bit32u address
, Bit32u value
, unsigned io_len
);