linux/drivers/pci/ioapic.c
<<
00.4" /spa3.4 " /form.4 " a 00.4" href="../linux+v3.7.5/drivers/pci/ioapic.c">00.4" img src="../.static/gfx/right.png" alt=">>">00 /spa3.400 spa3 class="lxr_search">00.400.4" input typ1500.4" input typ1500.4" butt vtyp15Search00.4" Prefs4 " /a>00 /spa3.4.4" /div.4.4" form ac="v3="ajax+*" method="post" onsubmit="return false;">00 input typ150.4" /form.40.4" div class="headingbott m">4 div id5 1 /a> spa3 class="comment">/* /spa3.4 2 /a> spa3 class="comment"> * IOAPIC/IOxAPIC/IOSAPIC driver /spa3.4 3 /a> spa3 class="comment"> * /spa3.4 4 /a> spa3 class="comment"> * Copyright (C) 2009 Fujitsu Limited. /spa3.4 5 /a> spa3 class="comment"> * (c) Copyright 2009 Hewlett-Packard Development Compa3y, L.P. /spa3.4 6 /a> spa3 class="comment"> * /spa3.4 7 /a> spa3 class="comment"> * This program is free software; you ca3 redistribute it and/or modify /spa3.4 8 /a> spa3 class="comment"> * it under the terms of the GNU General Public License vers v2 as /spa3.4 9 /a> spa3 class="comment"> * published by the Free Software Founda="v3. /spa3.4 vala> spa3 class="comment"> */ /spa3.4 11 /a>4 12 /a> spa3 class="comment">/* /spa3.4 13 /a> spa3 class="comment"> * This driver manages PCI I/O APICs added by hotplug after boot. We try to /spa3.4 14 /a> spa3 class="comment"> * claim all I/O APIC PCI devices, but those present at boot were registered /spa3.4 15 /a> spa3 class="comment"> * when we parsed the ACPI MADT, so we'll fail when we try to re-register /spa3.4 16 /a> spa3 class="comment"> * them. /spa3.4 17 /a> spa3 class="comment"> */ /spa3.4 18 /a>4 19 /a>#include <linux/pci.h /a>>4 20 /a>#include <linux/module.h /a>>4 21 /a>#include <linux/acpi.h /a>>4 22 /a>#include <linux/slab.h /a>>4 23 /a>#include <acpi/acpi_bus.h /a>>4 24 /a>4 25 /a>struct a href="+code=ioapic" class="sref">ioapic /a> {4 26 /a> a href="+code=acpi_handle" class="sref">acpi_handle /a> a href="+code=handle" class="sref">handle /a>;4 27 /a> a href="+code=u32" class="sref">u32 /a> a href="+code=gsi_base" class="sref">gsi_base /a>;4 28 /a>};4 29 /a>4 30 /a>static int a href="+code=__devinit" class="sref">__devinit /a> a href="+code=ioapic_probe" class="sref">ioapic_probe /a>(struct a href="+code=pci_dev" class="sref">pci_dev /a> * a href="+code=dev" class="sref">dev /a>, const struct a href="+code=pci_device_id" class="sref">pci_device_id /a> * a href="+code=ent" class="sref">ent /a>)4 31 /a>{4 32 /a> a href="+code=acpi_handle" class="sref">acpi_handle /a> a href="+code=handle" class="sref">handle /a>;4 33 /a> a href="+code=acpi_status" class="sref">acpi_status /a> a href="+code=status" class="sref">status /a>;4 34 /a> unsigned long long a href="+code=gsb" class="sref">gsb /a>;4 35 /a> struct a href="+code=ioapic" class="sref">ioapic /a> * a href="+code=ioapic" class="sref">ioapic /a>;4 36 /a> int a href="+code=ret" class="sref">ret /a>;4 37 /a> char * a href="+code=typ1" class="sref">typ1 /a>;4 38 /a> struct a href="+code=resourc1" class="sref">resourc1 /a> * a href="+code=res" class="sref">res /a>;4 39 /a>4 40 /a> a href="+code=handle" class="sref">handle /a> = a href="+code=DEVICE_ACPI_HANDLE" class="sref">DEVICE_ACPI_HANDLE /a>(& a href="+code=dev" class="sref">dev /a>-> a href="+code=dev" class="sref">dev /a>);4 41 /a> if (! a href="+code=handle" class="sref">handle /a>)4 42 /a> return - a href="+code=EINVAL" class="sref">EINVAL /a>;4 43 /a>4 44 /a> a href="+code=status" class="sref">status /a> = a href="+code=acpi_e3.4.ate_integer" class="sref">acpi_e3.4.ate_integer /a>( a href="+code=handle" class="sref">handle /a>, spa3 class="string">"_GSB" /spa3., a href="+code=NULL" class="sref">NULL /a>, & a href="+code=gsb" class="sref">gsb /a>);4 45 /a> if ( a href="+code=ACPI_FAILURE" class="sref">ACPI_FAILURE /a>( a href="+code=status" class="sref">status /a>))4 46 /a> return - a href="+code=EINVAL" class="sref">EINVAL /a>;4 47 /a>4 48 /a> spa3 class="comment">/* /spa3.4 49 /a> spa3 class="comment"> * The previous code in acpiphp e3.4.ated _MAT if _GSB failed, but /spa3.4 5vala> spa3 class="comment"> * ACPI spec 4.0 sec 6.2.2 requires _GSB for hot-pluggable I/O APICs. /spa3.4 51 /a> spa3 class="comment"> */ /spa3.4 52 /a>4 53 /a> a href="+code=ioapic" class="sref">ioapic /a> = a href="+code=kzalloc" class="sref">kzalloc /a>(sizeof(* a href="+code=ioapic" class="sref">ioapic /a>), a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL /a>);4 54 /a> if (! a href="+code=ioapic" class="sref">ioapic /a>)4 55 /a> return - a href="+code=ENOMEM" class="sref">ENOMEM /a>;4 56 /a>4 57 /a> a href="+code=ioapic" class="sref">ioapic /a>-> a href="+code=handle" class="sref">handle /a> = a href="+code=handle" class="sref">handle /a>;4 58 /a> a href="+code=ioapic" class="sref">ioapic /a>-> a href="+code=gsi_base" class="sref">gsi_base /a> = ( a href="+code=u32" class="sref">u32 /a>) a href="+code=gsb" class="sref">gsb /a>;4 59 /a>4 60 /a> if ( a href="+code=dev" class="sref">dev /a>-> a href="+code=class" class="sref">class /a> == a href="+code=PCI_CLASS_SYSTEM_PIC_IOAPIC" class="sref">PCI_CLASS_SYSTEM_PIC_IOAPIC /a>)4 61 /a> a href="+code=typ1" class="sref">typ1 /a> = spa3 class="string">"IOAPIC" /spa3.;4 62 /a> else4 63 /a> a href="+code=typ1" class="sref">typ1 /a> = spa3 class="string">"IOxAPIC" /spa3.;4 64 /a>4 65 /a> a href="+code=ret" class="sref">ret /a> = a href="+code=pci_enable_device" class="sref">pci_enable_device /a>( a href="+code=dev" class="sref">dev /a>);4 66 /a> if ( a href="+code=ret" class="sref">ret /a> < 0)4 67 /a> goto a href="+code=exit_free" class="sref">exit_free /a>;4 68 /a>4 69 /a> a href="+code=pci_set_master" class="sref">pci_set_master /a>( a href="+code=dev" class="sref">dev /a>);4 70 /a>4 71 /a> if ( a href="+code=pci_request_region" class="sref">pci_request_region /a>( a href="+code=dev" class="sref">dev /a>, 0, a href="+code=typ1" class="sref">typ1 /a>))4 72 /a> goto a href="+code=exit_disable" class="sref">exit_disable /a>;4 73 /a>4 74 /a> a href="+code=res" class="sref">res /a> = & a href="+code=dev" class="sref">dev /a>-> a href="+code=resourc1" class="sref">resourc1 /a>[0];4 75 /a> if ( a href="+code=acpi_register_ioapic" class="sref">acpi_register_ioapic /a>( a href="+code=ioapic" class="sref">ioapic /a>-> a href="+code=handle" class="sref">handle /a>, a href="+code=res" class="sref">res /a>-> a href="+code=start" class="sref">start /a>, a href="+code=ioapic" class="sref">ioapic /a>-> a href="+code=gsi_base" class="sref">gsi_base /a>))4 76 /a> goto a href="+code=exit_release" class="sref">exit_release /a>;4 77 /a>4 78 /a> a href="+code=pci_set_drvdata" class="sref">pci_set_drvdata /a>( a href="+code=dev" class="sref">dev /a>, a href="+code=ioapic" class="sref">ioapic /a>);4 79 /a> a href="+code=dev_info" class="sref">dev_info /a>(& a href="+code=dev" class="sref">dev /a>-> a href="+code=dev" class="sref">dev /a>, spa3 class="string">"%s at %pR, GSI %u\n" /spa3., a href="+code=typ1" class="sref">typ1 /a>, a href="+code=res" class="sref">res /a>, a href="+code=ioapic" class="sref">ioapic /a>-> a href="+code=gsi_base" class="sref">gsi_base /a>);4 80 /a> return 0;4 81 /a>4 82 /a> a href="+code=exit_release" class="sref">exit_release /a>:4 83 /a> a href="+code=pci_release_region" class="sref">pci_release_region /a>( a href="+code=dev" class="sref">dev /a>, 0);4 84 /a> a href="+code=exit_disable" class="sref">exit_disable /a>:4 85 /a> a href="+code=pci_disable_device" class="sref">pci_disable_device /a>( a href="+code=dev" class="sref">dev /a>);4 86 /a> a href="+code=exit_free" class="sref">exit_free /a>:4 87 /a> a href="+code=kfree" class="sref">kfree /a>( a href="+code=ioapic" class="sref">ioapic /a>);4 88 /a> return - a href="+code=ENODEV" class="sref">ENODEV /a>;4 89 /a>}4 90 /a>4 91 /a>static void a href="+code=__devexit" class="sref">__devexit /a> a href="+code=ioapic_remove" class="sref">ioapic_remove /a>(struct a href="+code=pci_dev" class="sref">pci_dev /a> * a href="+code=dev" class="sref">dev /a>)4 92 /a>{4 93 /a> struct a href="+code=ioapic" class="sref">ioapic /a> * a href="+code=ioapic" class="sref">ioapic /a> = a href="+code=pci_get_drvdata" class="sref">pci_get_drvdata /a>( a href="+code=dev" class="sref">dev /a>);4 94 /a>4 95 /a> a href="+code=acpi_unregister_ioapic" class="sref">acpi_unregister_ioapic /a>( a href="+code=ioapic" class="sref">ioapic /a>-> a href="+code=handle" class="sref">handle /a>, a href="+code=ioapic" class="sref">ioapic /a>-> a href="+code=gsi_base" class="sref">gsi_base /a>);4 96 /a> a href="+code=pci_release_region" class="sref">pci_release_region /a>( a href="+code=dev" class="sref">dev /a>, 0);4 97 /a> a href="+code=pci_disable_device" class="sref">pci_disable_device /a>( a href="+code=dev" class="sref">dev /a>);4 98 /a> a href="+code=kfree" class="sref">kfree /a>( a href="+code=ioapic" class="sref">ioapic /a>);4 99 /a>}4 100 /a>4 101 /a>4 102 /a>static a href="+code=DEFINE_PCI_DEVICE_TABLE" class="sref">DEFINE_PCI_DEVICE_TABLE /a>( a href="+code=ioapic_devices" class="sref">ioapic_devices /a>) = {4 103 /a> { a href="+code=PCI_DEVICE_CLASS" class="sref">PCI_DEVICE_CLASS /a>( a href="+code=PCI_CLASS_SYSTEM_PIC_IOAPIC" class="sref">PCI_CLASS_SYSTEM_PIC_IOAPIC /a>, ~0) },4 104 /a> { a href="+code=PCI_DEVICE_CLASS" class="sref">PCI_DEVICE_CLASS /a>( a href="+code=PCI_CLASS_SYSTEM_PIC_IOXAPIC" class="sref">PCI_CLASS_SYSTEM_PIC_IOXAPIC /a>, ~0) },4 105 /a> { }4 106 /a>};4 107 /a> a href="+code=MODULE_DEVICE_TABLE" class="sref">MODULE_DEVICE_TABLE /a>( a href="+code=pci" class="sref">pci /a>, a href="+code=ioapic_devices" class="sref">ioapic_devices /a>);4 108 /a>4 109 /a>static struct a href="+code=pci_driver" class="sref">pci_driver /a> a href="+code=ioapic_driver" class="sref">ioapic_driver /a> = {4 110 /a> . a href="+code=nam1" class="sref">nam1 /a> = spa3 class="string">"ioapic" /spa3.,4 111 /a> . a href="+code=id_table" class="sref">id_table /a> = a href="+code=ioapic_devices" class="sref">ioapic_devices /a>,4 112 /a> . a href="+code=probe" class="sref">probe /a> = a href="+code=ioapic_probe" class="sref">ioapic_probe /a>,4 113 /a> . a href="+code=remove" class="sref">remove /a> = a href="+code=__devexit_p" class="sref">__devexit_p /a>( a href="+code=ioapic_remove" class="sref">ioapic_remove /a>),4 114 /a>};4 115 /a>4 116 /a>static int a href="+code=__init" class="sref">__init /a> a href="+code=ioapic_init" class="sref">ioapic_init /a>(void)4 117 /a>{4 118 /a> return a href="+code=pci_register_driver" class="sref">pci_register_driver /a>(& a href="+code=ioapic_driver" class="sref">ioapic_driver /a>);4 119 /a>}4 120 /a>4 121 /a>static void a href="+code=__exit" class="sref">__exit /a> a href="+code=ioapic_exit" class="sref">ioapic_exit /a>(void)4 122 /a>{4 123 /a> a href="+code=pci_unregister_driver" class="sref">pci_unregister_driver /a>(& a href="+code=ioapic_driver" class="sref">ioapic_driver /a>);4 124 /a>}4 125 /a>4 126 /a> a href="+code=module_init" class="sref">module_init /a>( a href="+code=ioapic_init" class="sref">ioapic_init /a>);4 127 /a> a href="+code=module_exit" class="sref">module_exit /a>( a href="+code=ioapic_exit" class="sref">ioapic_exit /a>);4 128 /a> The original LXR software by the LXR community /a>, this experimental vers vby lxr@linux.no /a>. /div.4 div class="subfooter"> lxr.linux.no kindly hosted by Redpill Linpro AS /a>, provider of Linux consulting and opera="v3s services since 1995. /div.4 /body.4 /html.4