Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * File: portdrv_core.c |
| 3 | * Purpose: PCI Express Port Bus Driver's Core Functions |
| 4 | * |
| 5 | * Copyright (C) 2004 Intel |
| 6 | * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com) |
| 7 | */ |
| 8 | |
| 9 | #include <linux/module.h> |
| 10 | #include <linux/pci.h> |
| 11 | #include <linux/kernel.h> |
| 12 | #include <linux/errno.h> |
| 13 | #include <linux/pm.h> |
Tim Schmielau | 4e57b68 | 2005-10-30 15:03:48 -0800 | [diff] [blame] | 14 | #include <linux/string.h> |
| 15 | #include <linux/slab.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #include <linux/pcieport_if.h> |
| 17 | |
| 18 | #include "portdrv.h" |
| 19 | |
| 20 | extern int pcie_mch_quirk; /* MSI-quirk Indicator */ |
| 21 | |
| 22 | static int pcie_port_probe_service(struct device *dev) |
| 23 | { |
| 24 | struct pcie_device *pciedev; |
| 25 | struct pcie_port_service_driver *driver; |
| 26 | int status = -ENODEV; |
| 27 | |
| 28 | if (!dev || !dev->driver) |
| 29 | return status; |
| 30 | |
| 31 | driver = to_service_driver(dev->driver); |
| 32 | if (!driver || !driver->probe) |
| 33 | return status; |
| 34 | |
| 35 | pciedev = to_pcie_device(dev); |
| 36 | status = driver->probe(pciedev, driver->id_table); |
| 37 | if (!status) { |
| 38 | printk(KERN_DEBUG "Load service driver %s on pcie device %s\n", |
| 39 | driver->name, dev->bus_id); |
| 40 | get_device(dev); |
| 41 | } |
| 42 | return status; |
| 43 | } |
| 44 | |
| 45 | static int pcie_port_remove_service(struct device *dev) |
| 46 | { |
| 47 | struct pcie_device *pciedev; |
| 48 | struct pcie_port_service_driver *driver; |
| 49 | |
| 50 | if (!dev || !dev->driver) |
| 51 | return 0; |
| 52 | |
| 53 | pciedev = to_pcie_device(dev); |
| 54 | driver = to_service_driver(dev->driver); |
| 55 | if (driver && driver->remove) { |
| 56 | printk(KERN_DEBUG "Unload service driver %s on pcie device %s\n", |
| 57 | driver->name, dev->bus_id); |
| 58 | driver->remove(pciedev); |
| 59 | put_device(dev); |
| 60 | } |
| 61 | return 0; |
| 62 | } |
| 63 | |
| 64 | static void pcie_port_shutdown_service(struct device *dev) {} |
| 65 | |
Russell King | 9480e30 | 2005-10-28 09:52:56 -0700 | [diff] [blame] | 66 | static int pcie_port_suspend_service(struct device *dev, pm_message_t state) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | { |
| 68 | struct pcie_device *pciedev; |
| 69 | struct pcie_port_service_driver *driver; |
| 70 | |
| 71 | if (!dev || !dev->driver) |
| 72 | return 0; |
| 73 | |
| 74 | pciedev = to_pcie_device(dev); |
| 75 | driver = to_service_driver(dev->driver); |
| 76 | if (driver && driver->suspend) |
| 77 | driver->suspend(pciedev, state); |
| 78 | return 0; |
| 79 | } |
| 80 | |
Russell King | 9480e30 | 2005-10-28 09:52:56 -0700 | [diff] [blame] | 81 | static int pcie_port_resume_service(struct device *dev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | { |
| 83 | struct pcie_device *pciedev; |
| 84 | struct pcie_port_service_driver *driver; |
| 85 | |
| 86 | if (!dev || !dev->driver) |
| 87 | return 0; |
| 88 | |
| 89 | pciedev = to_pcie_device(dev); |
| 90 | driver = to_service_driver(dev->driver); |
| 91 | |
| 92 | if (driver && driver->resume) |
| 93 | driver->resume(pciedev); |
| 94 | return 0; |
| 95 | } |
| 96 | |
| 97 | /* |
| 98 | * release_pcie_device |
| 99 | * |
| 100 | * Being invoked automatically when device is being removed |
| 101 | * in response to device_unregister(dev) call. |
| 102 | * Release all resources being claimed. |
| 103 | */ |
| 104 | static void release_pcie_device(struct device *dev) |
| 105 | { |
| 106 | printk(KERN_DEBUG "Free Port Service[%s]\n", dev->bus_id); |
| 107 | kfree(to_pcie_device(dev)); |
| 108 | } |
| 109 | |
| 110 | static int is_msi_quirked(struct pci_dev *dev) |
| 111 | { |
| 112 | int port_type, quirk = 0; |
| 113 | u16 reg16; |
| 114 | |
| 115 | pci_read_config_word(dev, |
| 116 | pci_find_capability(dev, PCI_CAP_ID_EXP) + |
| 117 | PCIE_CAPABILITIES_REG, ®16); |
| 118 | port_type = (reg16 >> 4) & PORT_TYPE_MASK; |
| 119 | switch(port_type) { |
| 120 | case PCIE_RC_PORT: |
| 121 | if (pcie_mch_quirk == 1) |
| 122 | quirk = 1; |
| 123 | break; |
| 124 | case PCIE_SW_UPSTREAM_PORT: |
| 125 | case PCIE_SW_DOWNSTREAM_PORT: |
| 126 | default: |
| 127 | break; |
| 128 | } |
| 129 | return quirk; |
| 130 | } |
| 131 | |
| 132 | static int assign_interrupt_mode(struct pci_dev *dev, int *vectors, int mask) |
| 133 | { |
| 134 | int i, pos, nvec, status = -EINVAL; |
| 135 | int interrupt_mode = PCIE_PORT_INTx_MODE; |
| 136 | |
| 137 | /* Set INTx as default */ |
| 138 | for (i = 0, nvec = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) { |
| 139 | if (mask & (1 << i)) |
| 140 | nvec++; |
| 141 | vectors[i] = dev->irq; |
| 142 | } |
| 143 | |
| 144 | /* Check MSI quirk */ |
| 145 | if (is_msi_quirked(dev)) |
| 146 | return interrupt_mode; |
| 147 | |
| 148 | /* Select MSI-X over MSI if supported */ |
| 149 | pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); |
| 150 | if (pos) { |
| 151 | struct msix_entry msix_entries[PCIE_PORT_DEVICE_MAXSERVICES] = |
| 152 | {{0, 0}, {0, 1}, {0, 2}, {0, 3}}; |
| 153 | printk("%s Found MSIX capability\n", __FUNCTION__); |
| 154 | status = pci_enable_msix(dev, msix_entries, nvec); |
| 155 | if (!status) { |
| 156 | int j = 0; |
| 157 | |
| 158 | interrupt_mode = PCIE_PORT_MSIX_MODE; |
| 159 | for (i = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) { |
| 160 | if (mask & (1 << i)) |
| 161 | vectors[i] = msix_entries[j++].vector; |
| 162 | } |
| 163 | } |
| 164 | } |
| 165 | if (status) { |
| 166 | pos = pci_find_capability(dev, PCI_CAP_ID_MSI); |
| 167 | if (pos) { |
| 168 | printk("%s Found MSI capability\n", __FUNCTION__); |
| 169 | status = pci_enable_msi(dev); |
| 170 | if (!status) { |
| 171 | interrupt_mode = PCIE_PORT_MSI_MODE; |
| 172 | for (i = 0;i < PCIE_PORT_DEVICE_MAXSERVICES;i++) |
| 173 | vectors[i] = dev->irq; |
| 174 | } |
| 175 | } |
| 176 | } |
| 177 | return interrupt_mode; |
| 178 | } |
| 179 | |
| 180 | static int get_port_device_capability(struct pci_dev *dev) |
| 181 | { |
| 182 | int services = 0, pos; |
| 183 | u16 reg16; |
| 184 | u32 reg32; |
| 185 | |
| 186 | pos = pci_find_capability(dev, PCI_CAP_ID_EXP); |
| 187 | pci_read_config_word(dev, pos + PCIE_CAPABILITIES_REG, ®16); |
| 188 | /* Hot-Plug Capable */ |
| 189 | if (reg16 & PORT_TO_SLOT_MASK) { |
| 190 | pci_read_config_dword(dev, |
| 191 | pos + PCIE_SLOT_CAPABILITIES_REG, ®32); |
| 192 | if (reg32 & SLOT_HP_CAPABLE_MASK) |
| 193 | services |= PCIE_PORT_SERVICE_HP; |
| 194 | } |
| 195 | /* PME Capable */ |
| 196 | pos = pci_find_capability(dev, PCI_CAP_ID_PME); |
| 197 | if (pos) |
| 198 | services |= PCIE_PORT_SERVICE_PME; |
| 199 | |
| 200 | pos = PCI_CFG_SPACE_SIZE; |
| 201 | while (pos) { |
| 202 | pci_read_config_dword(dev, pos, ®32); |
| 203 | switch (reg32 & 0xffff) { |
| 204 | case PCI_EXT_CAP_ID_ERR: |
| 205 | services |= PCIE_PORT_SERVICE_AER; |
| 206 | pos = reg32 >> 20; |
| 207 | break; |
| 208 | case PCI_EXT_CAP_ID_VC: |
| 209 | services |= PCIE_PORT_SERVICE_VC; |
| 210 | pos = reg32 >> 20; |
| 211 | break; |
| 212 | default: |
| 213 | pos = 0; |
| 214 | break; |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | return services; |
| 219 | } |
| 220 | |
| 221 | static void pcie_device_init(struct pci_dev *parent, struct pcie_device *dev, |
| 222 | int port_type, int service_type, int irq, int irq_mode) |
| 223 | { |
| 224 | struct device *device; |
| 225 | |
| 226 | dev->port = parent; |
| 227 | dev->interrupt_mode = irq_mode; |
| 228 | dev->irq = irq; |
| 229 | dev->id.vendor = parent->vendor; |
| 230 | dev->id.device = parent->device; |
| 231 | dev->id.port_type = port_type; |
| 232 | dev->id.service_type = (1 << service_type); |
| 233 | |
| 234 | /* Initialize generic device interface */ |
| 235 | device = &dev->device; |
| 236 | memset(device, 0, sizeof(struct device)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | device->bus = &pcie_port_bus_type; |
| 238 | device->driver = NULL; |
long | d0e2b4a | 2005-03-29 13:36:43 -0800 | [diff] [blame] | 239 | device->driver_data = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | device->release = release_pcie_device; /* callback to free pcie dev */ |
Sergey Vlasov | 8c9ad50 | 2005-11-14 20:30:50 +0300 | [diff] [blame] | 241 | snprintf(device->bus_id, sizeof(device->bus_id), "%s:pcie%02x", |
| 242 | pci_name(parent), get_descriptor_id(port_type, service_type)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | device->parent = &parent->dev; |
| 244 | } |
| 245 | |
long | d0e2b4a | 2005-03-29 13:36:43 -0800 | [diff] [blame] | 246 | static struct pcie_device* alloc_pcie_device(struct pci_dev *parent, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 247 | int port_type, int service_type, int irq, int irq_mode) |
| 248 | { |
| 249 | struct pcie_device *device; |
| 250 | |
Eric Sesterhenn | f5afe80 | 2006-02-28 15:34:49 +0100 | [diff] [blame] | 251 | device = kzalloc(sizeof(struct pcie_device), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | if (!device) |
| 253 | return NULL; |
| 254 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 255 | pcie_device_init(parent, device, port_type, service_type, irq,irq_mode); |
| 256 | printk(KERN_DEBUG "Allocate Port Service[%s]\n", device->device.bus_id); |
| 257 | return device; |
| 258 | } |
| 259 | |
| 260 | int pcie_port_device_probe(struct pci_dev *dev) |
| 261 | { |
| 262 | int pos, type; |
| 263 | u16 reg; |
| 264 | |
| 265 | if (!(pos = pci_find_capability(dev, PCI_CAP_ID_EXP))) |
| 266 | return -ENODEV; |
| 267 | |
| 268 | pci_read_config_word(dev, pos + PCIE_CAPABILITIES_REG, ®); |
| 269 | type = (reg >> 4) & PORT_TYPE_MASK; |
| 270 | if ( type == PCIE_RC_PORT || type == PCIE_SW_UPSTREAM_PORT || |
long | d0e2b4a | 2005-03-29 13:36:43 -0800 | [diff] [blame] | 271 | type == PCIE_SW_DOWNSTREAM_PORT ) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | return 0; |
long | d0e2b4a | 2005-03-29 13:36:43 -0800 | [diff] [blame] | 273 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | return -ENODEV; |
| 275 | } |
| 276 | |
| 277 | int pcie_port_device_register(struct pci_dev *dev) |
| 278 | { |
long | 5823d10 | 2005-06-22 09:09:54 -0700 | [diff] [blame] | 279 | struct pcie_port_device_ext *p_ext; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 280 | int status, type, capabilities, irq_mode, i; |
| 281 | int vectors[PCIE_PORT_DEVICE_MAXSERVICES]; |
| 282 | u16 reg16; |
| 283 | |
long | 5823d10 | 2005-06-22 09:09:54 -0700 | [diff] [blame] | 284 | /* Allocate port device extension */ |
| 285 | if (!(p_ext = kmalloc(sizeof(struct pcie_port_device_ext), GFP_KERNEL))) |
| 286 | return -ENOMEM; |
| 287 | |
| 288 | pci_set_drvdata(dev, p_ext); |
| 289 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | /* Get port type */ |
long | d0e2b4a | 2005-03-29 13:36:43 -0800 | [diff] [blame] | 291 | pci_read_config_word(dev, |
| 292 | pci_find_capability(dev, PCI_CAP_ID_EXP) + |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | PCIE_CAPABILITIES_REG, ®16); |
| 294 | type = (reg16 >> 4) & PORT_TYPE_MASK; |
| 295 | |
| 296 | /* Now get port services */ |
| 297 | capabilities = get_port_device_capability(dev); |
| 298 | irq_mode = assign_interrupt_mode(dev, vectors, capabilities); |
long | 5823d10 | 2005-06-22 09:09:54 -0700 | [diff] [blame] | 299 | p_ext->interrupt_mode = irq_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 300 | |
| 301 | /* Allocate child services if any */ |
| 302 | for (i = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) { |
| 303 | struct pcie_device *child; |
| 304 | |
| 305 | if (capabilities & (1 << i)) { |
| 306 | child = alloc_pcie_device( |
| 307 | dev, /* parent */ |
long | d0e2b4a | 2005-03-29 13:36:43 -0800 | [diff] [blame] | 308 | type, /* port type */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | i, /* service type */ |
| 310 | vectors[i], /* irq */ |
| 311 | irq_mode /* interrupt mode */); |
long | d0e2b4a | 2005-03-29 13:36:43 -0800 | [diff] [blame] | 312 | if (child) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | status = device_register(&child->device); |
| 314 | if (status) { |
| 315 | kfree(child); |
| 316 | continue; |
| 317 | } |
| 318 | get_device(&child->device); |
| 319 | } |
| 320 | } |
| 321 | } |
| 322 | return 0; |
| 323 | } |
| 324 | |
| 325 | #ifdef CONFIG_PM |
long | d0e2b4a | 2005-03-29 13:36:43 -0800 | [diff] [blame] | 326 | static int suspend_iter(struct device *dev, void *data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 327 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | struct pcie_port_service_driver *service_driver; |
Pavel Machek | 2a56957 | 2005-07-07 17:56:40 -0700 | [diff] [blame] | 329 | pm_message_t state = * (pm_message_t *) data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | |
long | d0e2b4a | 2005-03-29 13:36:43 -0800 | [diff] [blame] | 331 | if ((dev->bus == &pcie_port_bus_type) && |
| 332 | (dev->driver)) { |
| 333 | service_driver = to_service_driver(dev->driver); |
| 334 | if (service_driver->suspend) |
| 335 | service_driver->suspend(to_pcie_device(dev), state); |
| 336 | } |
| 337 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | } |
| 339 | |
Pavel Machek | 2a56957 | 2005-07-07 17:56:40 -0700 | [diff] [blame] | 340 | int pcie_port_device_suspend(struct pci_dev *dev, pm_message_t state) |
long | d0e2b4a | 2005-03-29 13:36:43 -0800 | [diff] [blame] | 341 | { |
Greg Kroah-Hartman | b19441a | 2006-08-28 11:43:25 -0700 | [diff] [blame] | 342 | return device_for_each_child(&dev->dev, &state, suspend_iter); |
long | d0e2b4a | 2005-03-29 13:36:43 -0800 | [diff] [blame] | 343 | } |
| 344 | |
| 345 | static int resume_iter(struct device *dev, void *data) |
| 346 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 347 | struct pcie_port_service_driver *service_driver; |
| 348 | |
long | d0e2b4a | 2005-03-29 13:36:43 -0800 | [diff] [blame] | 349 | if ((dev->bus == &pcie_port_bus_type) && |
| 350 | (dev->driver)) { |
| 351 | service_driver = to_service_driver(dev->driver); |
| 352 | if (service_driver->resume) |
| 353 | service_driver->resume(to_pcie_device(dev)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 354 | } |
long | d0e2b4a | 2005-03-29 13:36:43 -0800 | [diff] [blame] | 355 | return 0; |
| 356 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | |
long | d0e2b4a | 2005-03-29 13:36:43 -0800 | [diff] [blame] | 358 | int pcie_port_device_resume(struct pci_dev *dev) |
| 359 | { |
Greg Kroah-Hartman | b19441a | 2006-08-28 11:43:25 -0700 | [diff] [blame] | 360 | return device_for_each_child(&dev->dev, NULL, resume_iter); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | } |
| 362 | #endif |
| 363 | |
long | d0e2b4a | 2005-03-29 13:36:43 -0800 | [diff] [blame] | 364 | static int remove_iter(struct device *dev, void *data) |
| 365 | { |
| 366 | struct pcie_port_service_driver *service_driver; |
| 367 | |
| 368 | if (dev->bus == &pcie_port_bus_type) { |
| 369 | if (dev->driver) { |
| 370 | service_driver = to_service_driver(dev->driver); |
| 371 | if (service_driver->remove) |
| 372 | service_driver->remove(to_pcie_device(dev)); |
| 373 | } |
| 374 | *(unsigned long*)data = (unsigned long)dev; |
| 375 | return 1; |
| 376 | } |
| 377 | return 0; |
| 378 | } |
| 379 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 380 | void pcie_port_device_remove(struct pci_dev *dev) |
| 381 | { |
long | d0e2b4a | 2005-03-29 13:36:43 -0800 | [diff] [blame] | 382 | struct device *device; |
| 383 | unsigned long device_addr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 384 | int interrupt_mode = PCIE_PORT_INTx_MODE; |
long | d0e2b4a | 2005-03-29 13:36:43 -0800 | [diff] [blame] | 385 | int status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 386 | |
long | d0e2b4a | 2005-03-29 13:36:43 -0800 | [diff] [blame] | 387 | do { |
| 388 | status = device_for_each_child(&dev->dev, &device_addr, remove_iter); |
| 389 | if (status) { |
| 390 | device = (struct device*)device_addr; |
| 391 | interrupt_mode = (to_pcie_device(device))->interrupt_mode; |
| 392 | put_device(device); |
| 393 | device_unregister(device); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 394 | } |
long | d0e2b4a | 2005-03-29 13:36:43 -0800 | [diff] [blame] | 395 | } while (status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 396 | /* Switch to INTx by default if MSI enabled */ |
| 397 | if (interrupt_mode == PCIE_PORT_MSIX_MODE) |
| 398 | pci_disable_msix(dev); |
| 399 | else if (interrupt_mode == PCIE_PORT_MSI_MODE) |
| 400 | pci_disable_msi(dev); |
| 401 | } |
| 402 | |
Andrew Morton | 3ec6a8d | 2006-09-25 16:52:20 -0700 | [diff] [blame] | 403 | int pcie_port_bus_register(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 404 | { |
Randy Dunlap | 20d5166 | 2006-07-08 22:58:25 -0700 | [diff] [blame] | 405 | return bus_register(&pcie_port_bus_type); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 406 | } |
| 407 | |
| 408 | void pcie_port_bus_unregister(void) |
| 409 | { |
| 410 | bus_unregister(&pcie_port_bus_type); |
| 411 | } |
| 412 | |
| 413 | int pcie_port_service_register(struct pcie_port_service_driver *new) |
| 414 | { |
| 415 | new->driver.name = (char *)new->name; |
| 416 | new->driver.bus = &pcie_port_bus_type; |
| 417 | new->driver.probe = pcie_port_probe_service; |
| 418 | new->driver.remove = pcie_port_remove_service; |
| 419 | new->driver.shutdown = pcie_port_shutdown_service; |
| 420 | new->driver.suspend = pcie_port_suspend_service; |
| 421 | new->driver.resume = pcie_port_resume_service; |
| 422 | |
| 423 | return driver_register(&new->driver); |
long | d0e2b4a | 2005-03-29 13:36:43 -0800 | [diff] [blame] | 424 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 425 | |
| 426 | void pcie_port_service_unregister(struct pcie_port_service_driver *new) |
| 427 | { |
| 428 | driver_unregister(&new->driver); |
| 429 | } |
| 430 | |
| 431 | EXPORT_SYMBOL(pcie_port_service_register); |
| 432 | EXPORT_SYMBOL(pcie_port_service_unregister); |