--- trunk/src/devices/dev_lca.c 2007/10/08 16:20:58 32 +++ trunk/src/devices/dev_lca.c 2007/10/08 16:21:17 34 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Anders Gavare. All rights reserved. + * Copyright (C) 2006-2007 Anders Gavare. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: dev_lca.c,v 1.4 2006/08/29 15:55:10 debug Exp $ + * $Id: dev_lca.c,v 1.8 2006/12/30 13:30:58 debug Exp $ * * LCA PCI bus (for Alpha machines). */ @@ -39,6 +39,7 @@ #include "cpu.h" #include "device.h" #include "emul.h" +#include "interrupt.h" #include "machine.h" #include "memory.h" #include "misc.h" @@ -64,6 +65,30 @@ }; +/* + * lca_interrupt_assert(): + * + * Line 0 = ISA interrupt. + */ +void lca_interrupt_assert(struct interrupt *interrupt) +{ + fatal("lca_interrupt_assert: TODO\n"); + exit(1); +} + + +/* + * lca_interrupt_deassert(): + * + * Line 0 = ISA interrupt. + */ +void lca_interrupt_deassert(struct interrupt *interrupt) +{ + fatal("lca_interrupt_deassert: TODO\n"); + exit(1); +} + + DEVICE_ACCESS(lca_pci_conf) { uint64_t idata = 0, odata = 0; @@ -302,6 +327,8 @@ DEVINIT(lca) { + char *interrupt_path; + struct interrupt interrupt_template; struct lca_data *d = malloc(sizeof(struct lca_data)); if (d == NULL) { fprintf(stderr, "out of memory\n"); @@ -312,15 +339,15 @@ /* Register a PCI bus: */ d->pci_data = bus_pci_init( devinit->machine, - 0 /* pciirq: TODO */, + "TODO: irq" /* pciirq: TODO */, LCA_PCI_SIO, /* pci device io offset */ 0x00000000, /* pci device mem offset: TODO */ 0x00000000, /* PCI portbase: TODO */ 0x00000000, /* PCI membase: TODO */ - 0x00000000, /* PCI irqbase: TODO */ + "TODO: pci irq base", /* PCI irqbase: TODO */ LCA_ISA_BASE, /* ISA portbase */ LCA_ISA_MEMBASE, /* ISA membase */ - 8); /* ISA irqbase: TODO */ + "TODO: irqbase isa"); /* ISA irqbase: TODO */ /* Add the "sio0" controller (as seen by NetBSD): */ bus_pci_add(devinit->machine, d->pci_data, devinit->machine->memory, @@ -338,9 +365,20 @@ LCA_IOC_BASE, 0x20000000, dev_lca_ioc_access, (void *)d, DM_DEFAULT, NULL); - /* TODO: IRQs etc. */ - bus_isa_init(devinit->machine, BUS_ISA_IDE0 | BUS_ISA_IDE1, - LCA_ISA_BASE, LCA_ISA_MEMBASE, 32, 48); + interrupt_path = malloc(strlen(devinit->machine->path) + 10); + snprintf(interrupt_path, strlen(devinit->machine->path) + 10, + "%s.lca", devinit->machine->path); + + memset(&interrupt_template, 0, sizeof(interrupt_template)); + interrupt_template.line = 0; + interrupt_template.name = interrupt_path; + interrupt_template.extra = d; + interrupt_template.interrupt_assert = lca_interrupt_assert; + interrupt_template.interrupt_deassert = lca_interrupt_deassert; + interrupt_handler_register(&interrupt_template); + + bus_isa_init(devinit->machine, interrupt_path, + BUS_ISA_IDE0 | BUS_ISA_IDE1, LCA_ISA_BASE, LCA_ISA_MEMBASE); return 1; }