Fixed compilation error
[bochs-mirror.git] / iodev / pci_ide.h
blob63f162178faac08a35ed7a3e4312113bedb5e5fd
1 /////////////////////////////////////////////////////////////////////////
2 // $Id: pci_ide.h,v 1.12 2007/09/28 19:52:03 sshwarts Exp $
3 /////////////////////////////////////////////////////////////////////////
4 //
5 // Copyright (C) 2004 MandrakeSoft S.A.
6 //
7 // MandrakeSoft S.A.
8 // 43, rue d'Aboukir
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_PCIIDE_H
28 #define BX_IODEV_PCIIDE_H
30 #if BX_USE_PIDE_SMF
31 # define BX_PIDE_SMF static
32 # define BX_PIDE_THIS thePciIdeController->
33 # define BX_PIDE_THIS_PTR thePciIdeController
34 #else
35 # define BX_PIDE_SMF
36 # define BX_PIDE_THIS this->
37 # define BX_PIDE_THIS_PTR this
38 #endif
40 class bx_pci_ide_c : public bx_pci_ide_stub_c {
41 public:
42 bx_pci_ide_c();
43 virtual ~bx_pci_ide_c();
44 virtual void init(void);
45 virtual void reset(unsigned type);
46 virtual bx_bool bmdma_present(void);
47 virtual void bmdma_set_irq(Bit8u channel);
48 virtual void register_state(void);
49 virtual void after_restore_state(void);
50 static Bit64s param_save_handler(void *devptr, bx_param_c *param, Bit64s val);
51 static Bit64s param_restore_handler(void *devptr, bx_param_c *param, Bit64s val);
52 #if !BX_USE_PIDE_SMF
53 Bit64s param_save(bx_param_c *param, Bit64s val);
54 Bit64s param_restore(bx_param_c *param, Bit64s val);
55 #endif
57 virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
58 virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len);
60 static void timer_handler(void *);
61 BX_PIDE_SMF void timer(void);
63 private:
65 struct {
66 Bit8u pci_conf[256];
67 Bit32u bmdma_addr;
68 struct {
69 bx_bool cmd_ssbm;
70 bx_bool cmd_rwcon;
71 Bit8u status;
72 Bit32u dtpr;
73 Bit32u prd_current;
74 int timer_index;
75 Bit8u *buffer;
76 Bit8u *buffer_top;
77 Bit8u *buffer_idx;
78 } bmdma[2];
79 } s;
81 static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
82 static void write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
83 #if !BX_USE_PIDE_SMF
84 Bit32u read(Bit32u address, unsigned io_len);
85 void write(Bit32u address, Bit32u value, unsigned io_len);
86 #endif
89 #endif