ia64/xen-unstable

changeset 17084:1cb8d51b4d77

ioemu: Fix the build.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Feb 15 14:31:20 2008 +0000 (2008-02-15)
parents 819399d0bdb1
children bf19616b2ae8
files tools/ioemu/hw/pass-through.c tools/ioemu/hw/piix4acpi.c tools/ioemu/vl.c tools/ioemu/vl.h
line diff
     1.1 --- a/tools/ioemu/hw/pass-through.c	Fri Feb 15 14:16:42 2008 +0000
     1.2 +++ b/tools/ioemu/hw/pass-through.c	Fri Feb 15 14:31:20 2008 +0000
     1.3 @@ -692,15 +692,3 @@ int pt_init(PCIBus *e_bus, char *direct_
     1.4      /* Success */
     1.5      return 0;
     1.6  }
     1.7 -
     1.8 -void pt_uninit(void)
     1.9 -{
    1.10 -    struct pci_access *access;
    1.11 -
    1.12 -    /* clean up the libpci */
    1.13 -    access = dpci_infos.pci_access;
    1.14 -    if ( access ) {
    1.15 -        pci_cleanup(access);
    1.16 -    }
    1.17 -
    1.18 -}
     2.1 --- a/tools/ioemu/hw/piix4acpi.c	Fri Feb 15 14:16:42 2008 +0000
     2.2 +++ b/tools/ioemu/hw/piix4acpi.c	Fri Feb 15 14:31:20 2008 +0000
     2.3 @@ -94,7 +94,7 @@ static int piix4acpi_load(QEMUFile *f, v
     2.4          return -EINVAL;
     2.5      ret = pci_device_load(&s->dev, f);
     2.6      if (ret < 0)
     2.7 -	return ret;
     2.8 +        return ret;
     2.9      qemu_get_be16s(f, &s->pm1_control);
    2.10      return 0;
    2.11  }
    2.12 @@ -114,11 +114,10 @@ static uint32_t acpiPm1Control_readb(voi
    2.13  
    2.14  static void acpi_shutdown(uint32_t val)
    2.15  {
    2.16 -    if ( !(val & SLP_EN) )
    2.17 +    if (!(val & SLP_EN))
    2.18          return;
    2.19  
    2.20 -    switch ( val & SLP_TYP_Sx )
    2.21 -    {
    2.22 +    switch (val & SLP_TYP_Sx) {
    2.23      case SLP_TYP_S4:
    2.24      case SLP_TYP_S5:
    2.25          qemu_system_shutdown_request();
    2.26 @@ -162,7 +161,7 @@ static uint32_t acpiPm1Control_readw(voi
    2.27  }
    2.28  
    2.29  static void acpi_map(PCIDevice *pci_dev, int region_num,
    2.30 -                    uint32_t addr, uint32_t size, int type)
    2.31 +                     uint32_t addr, uint32_t size, int type)
    2.32  {
    2.33      PCIAcpiState *d = (PCIAcpiState *)pci_dev;
    2.34  
    2.35 @@ -177,6 +176,8 @@ static void acpi_map(PCIDevice *pci_dev,
    2.36      register_ioport_read(addr + 4, 2, 2, acpiPm1Control_readw, d);
    2.37  }
    2.38  
    2.39 +#ifdef CONFIG_PASSTHROUGH
    2.40 +
    2.41  static inline int test_bit(uint8_t *map, int bit)
    2.42  {
    2.43      return ( map[bit / 8] & (1 << (bit % 8)) );
    2.44 @@ -217,15 +218,17 @@ static uint32_t acpi_php_readb(void *opa
    2.45  
    2.46      switch (addr)
    2.47      {
    2.48 -        case ACPI_PHP_IO_ADDR:
    2.49 -            val = hotplug_slots->plug_evt;
    2.50 -            break;
    2.51 -        default:
    2.52 -            num = addr - ACPI_PHP_IO_ADDR - 1;
    2.53 -            val = hotplug_slots->slot[num].status;
    2.54 +    case ACPI_PHP_IO_ADDR:
    2.55 +        val = hotplug_slots->plug_evt;
    2.56 +        break;
    2.57 +    default:
    2.58 +        num = addr - ACPI_PHP_IO_ADDR - 1;
    2.59 +        val = hotplug_slots->slot[num].status;
    2.60      }
    2.61  
    2.62 -    fprintf(logfile, "ACPI PCI hotplug: read addr=0x%x, val=0x%x.\n", addr, val);
    2.63 +    fprintf(logfile, "ACPI PCI hotplug: read addr=0x%x, val=0x%x.\n",
    2.64 +            addr, val);
    2.65 +
    2.66      return val;
    2.67  }
    2.68  
    2.69 @@ -233,27 +236,29 @@ static void acpi_php_writeb(void *opaque
    2.70  {
    2.71      PHPSlots *hotplug_slots = opaque;
    2.72      int php_slot;
    2.73 -    fprintf(logfile, "ACPI PCI hotplug: write addr=0x%x, val=0x%x.\n", addr, val);
    2.74 +
    2.75 +    fprintf(logfile, "ACPI PCI hotplug: write addr=0x%x, val=0x%x.\n",
    2.76 +            addr, val);
    2.77  
    2.78      switch (addr)
    2.79      {
    2.80 -        case ACPI_PHP_IO_ADDR:
    2.81 -            break;
    2.82 -        default:
    2.83 -            php_slot = addr - ACPI_PHP_IO_ADDR - 1;
    2.84 -            if ( val == 0x1 ) { /* Eject command */
    2.85 -                /* make _STA of the slot 0 */
    2.86 -                hotplug_slots->slot[php_slot].status = 0;
    2.87 +    case ACPI_PHP_IO_ADDR:
    2.88 +        break;
    2.89 +    default:
    2.90 +        php_slot = addr - ACPI_PHP_IO_ADDR - 1;
    2.91 +        if ( val == 0x1 ) { /* Eject command */
    2.92 +            /* make _STA of the slot 0 */
    2.93 +            hotplug_slots->slot[php_slot].status = 0;
    2.94  
    2.95 -                /* clear the hotplug event */
    2.96 -                hotplug_slots->plug_evt = 0;
    2.97 +            /* clear the hotplug event */
    2.98 +            hotplug_slots->plug_evt = 0;
    2.99  
   2.100 -                /* power off the slot */
   2.101 -                power_off_php_slot(php_slot);
   2.102 +            /* power off the slot */
   2.103 +            power_off_php_slot(php_slot);
   2.104  
   2.105 -                /* signal the CP ACPI hot remove done. */
   2.106 -                xenstore_record_dm_state("pci-removed");
   2.107 -            }
   2.108 +            /* signal the CP ACPI hot remove done. */
   2.109 +            xenstore_record_dm_state("pci-removed");
   2.110 +        }
   2.111      }
   2.112  }
   2.113  
   2.114 @@ -346,8 +351,8 @@ static void gpe_en_write(void *opaque, u
   2.115       * need deassert the intr to avoid redundant intrs
   2.116       */
   2.117      if ( s->sci_asserted &&
   2.118 -            reg_count == (ACPI_PHP_GPE_BIT / 8) &&
   2.119 -            !(val & (1 << (ACPI_PHP_GPE_BIT % 8))) ) {
   2.120 +         reg_count == (ACPI_PHP_GPE_BIT / 8) &&
   2.121 +         !(val & (1 << (ACPI_PHP_GPE_BIT % 8))) ) {
   2.122          fprintf(logfile, "deassert due to disable GPE bit.\n");
   2.123          s->sci_asserted = 0;
   2.124          pic_set_irq(ACPI_SCI_IRQ, 0);
   2.125 @@ -393,26 +398,26 @@ static void gpe_acpi_init(void)
   2.126      memset(s, 0, sizeof(GPEState));
   2.127  
   2.128      register_ioport_read(ACPI_GPE0_BLK_ADDRESS,
   2.129 -            ACPI_GPE0_BLK_LEN / 2,
   2.130 -            1,
   2.131 -            gpe_sts_read,
   2.132 -            s);
   2.133 +                         ACPI_GPE0_BLK_LEN / 2,
   2.134 +                         1,
   2.135 +                         gpe_sts_read,
   2.136 +                         s);
   2.137      register_ioport_read(ACPI_GPE0_BLK_ADDRESS + ACPI_GPE0_BLK_LEN / 2,
   2.138 -            ACPI_GPE0_BLK_LEN / 2,
   2.139 -            1,
   2.140 -            gpe_en_read,
   2.141 -            s);
   2.142 +                         ACPI_GPE0_BLK_LEN / 2,
   2.143 +                         1,
   2.144 +                         gpe_en_read,
   2.145 +                         s);
   2.146  
   2.147      register_ioport_write(ACPI_GPE0_BLK_ADDRESS,
   2.148 -            ACPI_GPE0_BLK_LEN / 2,
   2.149 -            1,
   2.150 -            gpe_sts_write,
   2.151 -            s);
   2.152 +                          ACPI_GPE0_BLK_LEN / 2,
   2.153 +                          1,
   2.154 +                          gpe_sts_write,
   2.155 +                          s);
   2.156      register_ioport_write(ACPI_GPE0_BLK_ADDRESS + ACPI_GPE0_BLK_LEN / 2,
   2.157 -            ACPI_GPE0_BLK_LEN / 2,
   2.158 -            1,
   2.159 -            gpe_en_write,
   2.160 -            s);
   2.161 +                          ACPI_GPE0_BLK_LEN / 2,
   2.162 +                          1,
   2.163 +                          gpe_en_write,
   2.164 +                          s);
   2.165  
   2.166      register_savevm("gpe", 0, 1, gpe_save, gpe_load, s);
   2.167  }
   2.168 @@ -420,7 +425,7 @@ static void gpe_acpi_init(void)
   2.169  static void acpi_sci_intr(GPEState *s)
   2.170  {
   2.171      if ( !test_bit(&s->gpe0_sts[0], ACPI_PHP_GPE_BIT) &&
   2.172 -            test_bit(&s->gpe0_en[0], ACPI_PHP_GPE_BIT) ) {
   2.173 +         test_bit(&s->gpe0_en[0], ACPI_PHP_GPE_BIT) ) {
   2.174  
   2.175          set_bit(&s->gpe0_sts[0], ACPI_PHP_GPE_BIT);
   2.176          s->sci_asserted = 1;
   2.177 @@ -489,6 +494,8 @@ void acpi_php_add(int pci_slot)
   2.178      acpi_sci_intr(s);
   2.179  }
   2.180  
   2.181 +#endif /* CONFIG_PASSTHROUGH */
   2.182 +
   2.183  /* PIIX4 acpi pci configuration space, func 2 */
   2.184  void pci_piix4_acpi_init(PCIBus *bus, int devfn)
   2.185  {
   2.186 @@ -528,12 +535,11 @@ void pci_piix4_acpi_init(PCIBus *bus, in
   2.187  
   2.188      acpi_map((PCIDevice *)d, 0, 0x1f40, 0x10, PCI_ADDRESS_SPACE_IO);
   2.189  
   2.190 +#ifdef CONFIG_PASSTHROUGH
   2.191      gpe_acpi_init();
   2.192 -
   2.193      php_slots_init();
   2.194 -
   2.195 -    /* for ACPI debug */
   2.196      register_ioport_write(ACPI_DBG_IO_ADDR, 4, 4, acpi_dbg_writel, d);
   2.197 +#endif
   2.198  
   2.199      register_savevm("piix4acpi", 0, 1, piix4acpi_save, piix4acpi_load, d);
   2.200  }
     3.1 --- a/tools/ioemu/vl.c	Fri Feb 15 14:16:42 2008 +0000
     3.2 +++ b/tools/ioemu/vl.c	Fri Feb 15 14:31:20 2008 +0000
     3.3 @@ -4384,19 +4384,18 @@ void usb_info(void)
     3.4  
     3.5  void do_pci_del(char *devname)
     3.6  {
     3.7 -    int pci_slot;
     3.8 -    pci_slot = bdf_to_slot(devname);
     3.9 -
    3.10 +#ifdef CONFIG_PASSTHROUGH
    3.11 +    int pci_slot = bdf_to_slot(devname);
    3.12      acpi_php_del(pci_slot);
    3.13 +#endif
    3.14  }
    3.15  
    3.16  void do_pci_add(char *devname)
    3.17  {
    3.18 -    int pci_slot;
    3.19 -
    3.20 -    pci_slot = insert_to_pci_slot(devname);
    3.21 -
    3.22 +#ifdef CONFIG_PASSTHROUGH
    3.23 +    int pci_slot = insert_to_pci_slot(devname);
    3.24      acpi_php_add(pci_slot);
    3.25 +#endif
    3.26  }
    3.27  
    3.28  
    3.29 @@ -7985,6 +7984,5 @@ int main(int argc, char **argv)
    3.30  
    3.31      main_loop();
    3.32      quit_timers();
    3.33 -    pt_uninit();
    3.34      return 0;
    3.35  }
     4.1 --- a/tools/ioemu/vl.h	Fri Feb 15 14:16:42 2008 +0000
     4.2 +++ b/tools/ioemu/vl.h	Fri Feb 15 14:31:20 2008 +0000
     4.3 @@ -868,7 +868,6 @@ int test_pci_slot(int);
     4.4  int bdf_to_slot(char*);
     4.5  int power_on_php_slot(int);
     4.6  int power_off_php_slot(int);
     4.7 -void pt_uninit(void);
     4.8  
     4.9  /* prep_pci.c */
    4.10  PCIBus *pci_prep_init(void);