X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Fsrc%2Fdevices%2Fide.c;h=bf9524563054db854ea9a3d2765dc7c1e03179da;hp=60be9de2de0ea7f98688cb37759a3d5e2aea922d;hb=afb2a35b2e15ba0fa932c4e49a3678f958a4502a;hpb=942df9bb1e2570764d24c74f797247536639502e diff --git a/palacios/src/devices/ide.c b/palacios/src/devices/ide.c index 60be9de..bf95245 100644 --- a/palacios/src/devices/ide.c +++ b/palacios/src/devices/ide.c @@ -26,7 +26,7 @@ #include "ide-types.h" #include "atapi-types.h" -#ifndef DEBUG_IDE +#ifndef CONFIG_DEBUG_IDE #undef PrintDebug #define PrintDebug(fmt, args...) #endif @@ -280,9 +280,9 @@ static inline int is_lba_enabled(struct ide_channel * channel) { /* Drive Commands */ static void ide_raise_irq(struct vm_device * dev, struct ide_channel * channel) { if (channel->ctrl_reg.irq_disable == 0) { - PrintDebug("Raising IDE Interrupt %d\n", channel->irq); - channel->dma_status.int_gen = 1; - v3_raise_irq(dev->vm, channel->irq); + // PrintError("Raising IDE Interrupt %d\n", channel->irq); + channel->dma_status.int_gen = 1; + v3_raise_irq(dev->vm, channel->irq); } } @@ -353,7 +353,7 @@ static int dma_write(struct vm_device * dev, struct ide_channel * channel); #include "ata.h" -#ifdef DEBUG_IDE +#ifdef CONFIG_DEBUG_IDE static void print_prd_table(struct vm_device * dev, struct ide_channel * channel) { struct ide_dma_prd prd_entry; int index = 0; @@ -395,7 +395,7 @@ static int dma_read(struct vm_device * dev, struct ide_channel * channel) { // Read in the data buffer.... // Read a sector/block at a time until the prd entry is full. -#ifdef DEBUG_IDE +#ifdef CONFIG_DEBUG_IDE print_prd_table(dev, channel); #endif @@ -626,7 +626,8 @@ static int dma_write(struct vm_device * dev, struct ide_channel * channel) { #define DMA_CHANNEL_FLAG 0x08 -static int write_dma_port(ushort_t port, void * src, uint_t length, struct vm_device * dev) { +static int write_dma_port(ushort_t port, void * src, uint_t length, void * private_data) { + struct vm_device * dev = (struct vm_device *)private_data; struct ide_internal * ide = (struct ide_internal *)(dev->private_data); uint16_t port_offset = port & (DMA_CHANNEL_FLAG - 1); uint_t channel_flag = (port & DMA_CHANNEL_FLAG) >> 3; @@ -708,7 +709,8 @@ static int write_dma_port(ushort_t port, void * src, uint_t length, struct vm_de } -static int read_dma_port(ushort_t port, void * dst, uint_t length, struct vm_device * dev) { +static int read_dma_port(ushort_t port, void * dst, uint_t length, void * private_data) { + struct vm_device * dev = (struct vm_device *)private_data; struct ide_internal * ide = (struct ide_internal *)(dev->private_data); uint16_t port_offset = port & (DMA_CHANNEL_FLAG - 1); uint_t channel_flag = (port & DMA_CHANNEL_FLAG) >> 3; @@ -1157,7 +1159,7 @@ static int ide_read_data_port(ushort_t port, void * dst, uint_t length, struct v struct ide_channel * channel = get_selected_channel(ide, port); struct ide_drive * drive = get_selected_drive(channel); - // PrintDebug("IDE: Reading Data Port %x (len=%d)\n", port, length); + PrintDebug("IDE: Reading Data Port %x (len=%d)\n", port, length); if ((channel->cmd_reg == 0xec) || (channel->cmd_reg == 0xa1)) { @@ -1395,7 +1397,7 @@ static void init_channel(struct ide_channel * channel) { } -static int pci_config_update(struct pci_device * pci_dev, uint_t reg_num, int length) { +static int pci_config_update(uint_t reg_num, void * src, uint_t length, void * private_data) { PrintDebug("PCI Config Update\n"); PrintDebug("\t\tInterupt register (Dev=%s), irq=%d\n", pci_dev->name, pci_dev->config_header.intr_line); @@ -1554,12 +1556,14 @@ static int ide_init(struct guest_info * vm, void * cfg_data) { } bars[4].type = PCI_BAR_IO; - bars[4].default_base_port = PRI_DEFAULT_DMA_PORT; + // bars[4].default_base_port = PRI_DEFAULT_DMA_PORT; + bars[4].default_base_port = -1; bars[4].num_ports = 16; bars[4].io_read = read_dma_port; bars[4].io_write = write_dma_port; - + bars[4].private_data = dev; + pci_dev = v3_pci_register_device(ide->pci_bus, PCI_STD_DEVICE, 0, sb_pci->dev_num, 1, "PIIX3_IDE", bars, pci_config_update, NULL, NULL, dev);