/[gxemul]/trunk/src/devices/bus_isa.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/devices/bus_isa.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 21 by dpavlin, Mon Oct 8 16:19:23 2007 UTC revision 22 by dpavlin, Mon Oct 8 16:19:37 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2005  Anders Gavare.  All rights reserved.   *  Copyright (C) 2005-2006  Anders Gavare.  All rights reserved.
3   *   *
4   *  Redistribution and use in source and binary forms, with or without   *  Redistribution and use in source and binary forms, with or without
5   *  modification, are permitted provided that the following conditions are met:   *  modification, are permitted provided that the following conditions are met:
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: bus_isa.c,v 1.5 2005/11/21 11:10:11 debug Exp $   *  $Id: bus_isa.c,v 1.9 2006/01/16 01:45:27 debug Exp $
29   *     *  
30   *  Generic ISA bus. This is not a normal device, but it can be used as a quick   *  Generic ISA bus. This is not a normal device, but it can be used as a quick
31   *  way of adding most of the common legacy ISA devices to a machine.   *  way of adding most of the common legacy ISA devices to a machine.
# Line 35  Line 35 
35  #include <stdlib.h>  #include <stdlib.h>
36  #include <string.h>  #include <string.h>
37    
38    #define BUS_ISA_C
39    
40  #include "bus_isa.h"  #include "bus_isa.h"
41  #include "device.h"  #include "device.h"
42  #include "devices.h"  #include "devices.h"
# Line 44  Line 46 
46    
47    
48  /*  /*
49   *  bus_isa():   *  bus_isa_debug_dump():
50     */
51    void bus_isa_debug_dump(void *extra)
52    {
53            struct bus_isa_data *d = (struct bus_isa_data *) extra;
54    
55            debug("isa:\n");
56            debug_indentation(DEBUG_INDENTATION);
57            debug("portbase:     0x%llx\n", (long long)d->isa_portbase);
58            debug("membase:      0x%llx\n", (long long)d->isa_membase);
59            debug("irqbase:      %i\n", (int)d->isa_irqbase);
60            debug("reassert_irq: %i\n", (int)d->reassert_irq);
61            debug_indentation(-DEBUG_INDENTATION);
62    }
63    
64    
65    /*
66     *  bus_isa_init():
67   *   *
68   *  Flags are zero or more of the following, ORed together:   *  Flags are zero or more of the following, ORed together:
69   *   *
# Line 56  Line 75 
75   *  BUS_ISA_PCKBC_FORCE_USE     Always assume keyboard console, not serial. (*3)   *  BUS_ISA_PCKBC_FORCE_USE     Always assume keyboard console, not serial. (*3)
76   *  BUS_ISA_PCKBC_NONPCSTYLE    Don't set the pc-style flag for the keyboard.   *  BUS_ISA_PCKBC_NONPCSTYLE    Don't set the pc-style flag for the keyboard.
77   *  BUS_ISA_NO_SECOND_PIC       Only useful for 8086 XT (pre-AT) emulation. :-)   *  BUS_ISA_NO_SECOND_PIC       Only useful for 8086 XT (pre-AT) emulation. :-)
78     *  BUS_ISA_LPTBASE_3BC         Set lptbase to 0x3bc instead of 0x378.
79   *   *
80   *  (*1) For machines with a PCI bus, this flag should not be used. Instead, a   *  (*1) For machines with a PCI bus, this flag should not be used. Instead, a
81   *       PCI VGA card should be added to the PCI bus.   *       PCI VGA card should be added to the PCI bus.
# Line 67  Line 87 
87   *  (*3) Similar to *2 above; machines that always boot up with VGA console   *  (*3) Similar to *2 above; machines that always boot up with VGA console
88   *       should have this flag set, so that the keyboard is always used.   *       should have this flag set, so that the keyboard is always used.
89   */   */
90  void bus_isa(struct machine *machine, uint32_t bus_isa_flags,  struct bus_isa_data *bus_isa_init(struct machine *machine,
91          uint64_t isa_portbase, uint64_t isa_membase, int isa_irqbase,          uint32_t bus_isa_flags, uint64_t isa_portbase, uint64_t isa_membase,
92          int reassert_irq)          int isa_irqbase, int reassert_irq)
93  {  {
94            struct bus_isa_data *d = malloc(sizeof(struct bus_isa_data));
95          char tmpstr[300];          char tmpstr[300];
96          int wdc0_irq = 14, wdc1_irq = 15;          int wdc0_irq = 14, wdc1_irq = 15;
97          int tmp_handle, kbd_in_use;          int tmp_handle, kbd_in_use;
98            int lptbase = 0x378;
99    
100            memset(d, 0, sizeof(struct bus_isa_data));
101            d->isa_portbase = isa_portbase;
102            d->isa_membase  = isa_membase;
103            d->isa_irqbase  = isa_irqbase;
104            d->reassert_irq = reassert_irq;
105            machine_bus_register(machine, "isa", bus_isa_debug_dump, d);
106    
107          kbd_in_use = ((bus_isa_flags & BUS_ISA_PCKBC_FORCE_USE) ||          kbd_in_use = ((bus_isa_flags & BUS_ISA_PCKBC_FORCE_USE) ||
108              (machine->use_x11))? 1 : 0;              (machine->use_x11))? 1 : 0;
# Line 112  void bus_isa(struct machine *machine, ui Line 141  void bus_isa(struct machine *machine, ui
141              " in_use=0", isa_irqbase +3, (long long)(isa_portbase + 0x2f8));              " in_use=0", isa_irqbase +3, (long long)(isa_portbase + 0x2f8));
142          device_add(machine, tmpstr);          device_add(machine, tmpstr);
143    
144            if (bus_isa_flags & BUS_ISA_LPTBASE_3BC) {
145                    bus_isa_flags &= ~BUS_ISA_LPTBASE_3BC;
146                    lptbase = 0x3bc;
147            }
148    
149          snprintf(tmpstr, sizeof(tmpstr), "lpt irq=%i addr=0x%llx name2=lpt"          snprintf(tmpstr, sizeof(tmpstr), "lpt irq=%i addr=0x%llx name2=lpt"
150              " in_use=0", isa_irqbase + 7, (long long)(isa_portbase + 0x378));              " in_use=0", isa_irqbase + 7, (long long)(isa_portbase + lptbase));
151          device_add(machine, tmpstr);          device_add(machine, tmpstr);
152    
153          if (bus_isa_flags & BUS_ISA_IDE0) {          if (bus_isa_flags & BUS_ISA_IDE0) {
# Line 161  void bus_isa(struct machine *machine, ui Line 195  void bus_isa(struct machine *machine, ui
195          if (bus_isa_flags != 0)          if (bus_isa_flags != 0)
196                  fatal("WARNING! bus_isa(): unimplemented bus_isa_flags 0x%x\n",                  fatal("WARNING! bus_isa(): unimplemented bus_isa_flags 0x%x\n",
197                      bus_isa_flags);                      bus_isa_flags);
198    
199            return d;
200  }  }
201    

Legend:
Removed from v.21  
changed lines
  Added in v.22

  ViewVC Help
Powered by ViewVC 1.1.26