/[gxemul]/trunk/src/devices/dev_lca.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/dev_lca.c

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

revision 32 by dpavlin, Mon Oct 8 16:20:58 2007 UTC revision 42 by dpavlin, Mon Oct 8 16:22:32 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2006  Anders Gavare.  All rights reserved.   *  Copyright (C) 2006-2007  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: dev_lca.c,v 1.4 2006/08/29 15:55:10 debug Exp $   *  $Id: dev_lca.c,v 1.10 2007/06/15 19:11:15 debug Exp $
29   *   *
30   *  LCA PCI bus (for Alpha machines).   *  COMMENT: LCA PCI bus, for Alpha machines
31   */   */
32    
33  #include <stdio.h>  #include <stdio.h>
# Line 39  Line 39 
39  #include "cpu.h"  #include "cpu.h"
40  #include "device.h"  #include "device.h"
41  #include "emul.h"  #include "emul.h"
42    #include "interrupt.h"
43  #include "machine.h"  #include "machine.h"
44  #include "memory.h"  #include "memory.h"
45  #include "misc.h"  #include "misc.h"
# Line 64  struct lca_data { Line 65  struct lca_data {
65  };  };
66    
67    
68    /*
69     *  lca_interrupt_assert():
70     *
71     *  Line 0 = ISA interrupt.
72     */
73    void lca_interrupt_assert(struct interrupt *interrupt)
74    {
75            fatal("lca_interrupt_assert: TODO\n");
76            exit(1);
77    }
78    
79    
80    /*
81     *  lca_interrupt_deassert():
82     *
83     *  Line 0 = ISA interrupt.
84     */
85    void lca_interrupt_deassert(struct interrupt *interrupt)
86    {
87            fatal("lca_interrupt_deassert: TODO\n");
88            exit(1);
89    }
90    
91    
92  DEVICE_ACCESS(lca_pci_conf)  DEVICE_ACCESS(lca_pci_conf)
93  {  {
94          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
# Line 129  DEVICE_ACCESS(lca_pci_conf) Line 154  DEVICE_ACCESS(lca_pci_conf)
154    
155  DEVICE_ACCESS(lca_isa)  DEVICE_ACCESS(lca_isa)
156  {  {
157          int ofs, i;          unsigned int ofs, i;
158          uint8_t byte;          uint8_t byte;
159    
160          relative_addr >>= 5;          relative_addr >>= 5;
# Line 302  DEVICE_ACCESS(lca_ioc) Line 327  DEVICE_ACCESS(lca_ioc)
327    
328  DEVINIT(lca)  DEVINIT(lca)
329  {  {
330          struct lca_data *d = malloc(sizeof(struct lca_data));          char *interrupt_path;
331          if (d == NULL) {          struct interrupt interrupt_template;
332                  fprintf(stderr, "out of memory\n");          struct lca_data *d;
333                  exit(1);  
334          }          CHECK_ALLOCATION(d = malloc(sizeof(struct lca_data)));
335          memset(d, 0, sizeof(struct lca_data));          memset(d, 0, sizeof(struct lca_data));
336    
337          /*  Register a PCI bus:  */          /*  Register a PCI bus:  */
338          d->pci_data = bus_pci_init(          d->pci_data = bus_pci_init(
339              devinit->machine,              devinit->machine,
340              0                   /*  pciirq: TODO  */,              "TODO: irq"         /*  pciirq: TODO  */,
341              LCA_PCI_SIO,        /*  pci device io offset  */              LCA_PCI_SIO,        /*  pci device io offset  */
342              0x00000000,         /*  pci device mem offset: TODO  */              0x00000000,         /*  pci device mem offset: TODO  */
343              0x00000000,         /*  PCI portbase: TODO  */              0x00000000,         /*  PCI portbase: TODO  */
344              0x00000000,         /*  PCI membase: TODO  */              0x00000000,         /*  PCI membase: TODO  */
345              0x00000000,         /*  PCI irqbase: TODO  */              "TODO: pci irq base",       /*  PCI irqbase: TODO  */
346              LCA_ISA_BASE,       /*  ISA portbase  */              LCA_ISA_BASE,       /*  ISA portbase  */
347              LCA_ISA_MEMBASE,    /*  ISA membase  */              LCA_ISA_MEMBASE,    /*  ISA membase  */
348              8);                 /*  ISA irqbase: TODO  */              "TODO: irqbase isa");                /*  ISA irqbase: TODO  */
349    
350          /*  Add the "sio0" controller (as seen by NetBSD):  */          /*  Add the "sio0" controller (as seen by NetBSD):  */
351          bus_pci_add(devinit->machine, d->pci_data, devinit->machine->memory,          bus_pci_add(devinit->machine, d->pci_data, devinit->machine->memory,
# Line 338  DEVINIT(lca) Line 363  DEVINIT(lca)
363              LCA_IOC_BASE, 0x20000000, dev_lca_ioc_access, (void *)d,              LCA_IOC_BASE, 0x20000000, dev_lca_ioc_access, (void *)d,
364              DM_DEFAULT, NULL);              DM_DEFAULT, NULL);
365    
366          /*  TODO: IRQs etc.  */          CHECK_ALLOCATION(interrupt_path =
367          bus_isa_init(devinit->machine, BUS_ISA_IDE0 | BUS_ISA_IDE1,              malloc(strlen(devinit->machine->path) + 10));
368              LCA_ISA_BASE, LCA_ISA_MEMBASE, 32, 48);          snprintf(interrupt_path, strlen(devinit->machine->path) + 10,
369                "%s.lca", devinit->machine->path);
370    
371            memset(&interrupt_template, 0, sizeof(interrupt_template));
372            interrupt_template.line = 0;
373            interrupt_template.name = interrupt_path;
374            interrupt_template.extra = d;
375            interrupt_template.interrupt_assert = lca_interrupt_assert;
376            interrupt_template.interrupt_deassert = lca_interrupt_deassert;
377            interrupt_handler_register(&interrupt_template);
378    
379            bus_isa_init(devinit->machine, interrupt_path,
380                BUS_ISA_IDE0 | BUS_ISA_IDE1, LCA_ISA_BASE, LCA_ISA_MEMBASE);
381    
382          return 1;          return 1;
383  }  }

Legend:
Removed from v.32  
changed lines
  Added in v.42

  ViewVC Help
Powered by ViewVC 1.1.26