diff options
| author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-04 10:07:22 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-04 10:07:22 -0400 |
| commit | 742b0c905d970fd60893cce14a3c68b523504bc4 (patch) | |
| tree | d85689d464a8b11efe7fb6ff2f2151c4c4974871 /drivers | |
| parent | 235bd6140dad7c08261abdc1f8056485c5344a74 (diff) | |
| parent | 9171078ab5a0bbb516029cfc61378e0350a7b30d (diff) | |
Merge of rsync://rsync.kernel.org/pub/scm/linux/kernel/git/gregkh/pci-2.6.git/
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/pci/hotplug/ibmphp.h | 2 | ||||
| -rw-r--r-- | drivers/pci/hotplug/ibmphp_hpc.c | 6 | ||||
| -rw-r--r-- | drivers/pci/hotplug/ibmphp_pci.c | 7 | ||||
| -rw-r--r-- | drivers/pci/hotplug/pci_hotplug.h | 2 | ||||
| -rw-r--r-- | drivers/pci/hotplug/pciehp_core.c | 23 | ||||
| -rw-r--r-- | drivers/pci/hotplug/pcihp_skeleton.c | 2 | ||||
| -rw-r--r-- | drivers/pci/msi.c | 6 | ||||
| -rw-r--r-- | drivers/pci/pci-acpi.c | 2 | ||||
| -rw-r--r-- | drivers/pci/pci-driver.c | 11 | ||||
| -rw-r--r-- | drivers/pci/pci-sysfs.c | 82 | ||||
| -rw-r--r-- | drivers/pci/pci.c | 20 | ||||
| -rw-r--r-- | drivers/pci/probe.c | 1 | ||||
| -rw-r--r-- | drivers/pci/proc.c | 1 | ||||
| -rw-r--r-- | drivers/pci/quirks.c | 2 |
14 files changed, 109 insertions, 58 deletions
diff --git a/drivers/pci/hotplug/ibmphp.h b/drivers/pci/hotplug/ibmphp.h index 5bc039da647f..c22e0284d7b1 100644 --- a/drivers/pci/hotplug/ibmphp.h +++ b/drivers/pci/hotplug/ibmphp.h | |||
| @@ -196,7 +196,7 @@ struct ebda_hpc_bus { | |||
| 196 | 196 | ||
| 197 | 197 | ||
| 198 | /******************************************************************** | 198 | /******************************************************************** |
| 199 | * THREE TYPE OF HOT PLUG CONTROLER * | 199 | * THREE TYPE OF HOT PLUG CONTROLLER * |
| 200 | ********************************************************************/ | 200 | ********************************************************************/ |
| 201 | 201 | ||
| 202 | struct isa_ctlr_access { | 202 | struct isa_ctlr_access { |
diff --git a/drivers/pci/hotplug/ibmphp_hpc.c b/drivers/pci/hotplug/ibmphp_hpc.c index 6894b548c8ca..1a3eb8d3d4cb 100644 --- a/drivers/pci/hotplug/ibmphp_hpc.c +++ b/drivers/pci/hotplug/ibmphp_hpc.c | |||
| @@ -64,7 +64,7 @@ static int to_debug = FALSE; | |||
| 64 | #define WPG_I2C_OR 0x2000 // I2C OR operation | 64 | #define WPG_I2C_OR 0x2000 // I2C OR operation |
| 65 | 65 | ||
| 66 | //---------------------------------------------------------------------------- | 66 | //---------------------------------------------------------------------------- |
| 67 | // Command set for I2C Master Operation Setup Regisetr | 67 | // Command set for I2C Master Operation Setup Register |
| 68 | //---------------------------------------------------------------------------- | 68 | //---------------------------------------------------------------------------- |
| 69 | #define WPG_READATADDR_MASK 0x00010000 // read,bytes,I2C shifted,index | 69 | #define WPG_READATADDR_MASK 0x00010000 // read,bytes,I2C shifted,index |
| 70 | #define WPG_WRITEATADDR_MASK 0x40010000 // write,bytes,I2C shifted,index | 70 | #define WPG_WRITEATADDR_MASK 0x40010000 // write,bytes,I2C shifted,index |
| @@ -835,7 +835,7 @@ static void poll_hpc (void) | |||
| 835 | if (ibmphp_shutdown) | 835 | if (ibmphp_shutdown) |
| 836 | break; | 836 | break; |
| 837 | 837 | ||
| 838 | /* try to get the lock to do some kind of harware access */ | 838 | /* try to get the lock to do some kind of hardware access */ |
| 839 | down (&semOperations); | 839 | down (&semOperations); |
| 840 | 840 | ||
| 841 | switch (poll_state) { | 841 | switch (poll_state) { |
| @@ -906,7 +906,7 @@ static void poll_hpc (void) | |||
| 906 | poll_state = POLL_LATCH_REGISTER; | 906 | poll_state = POLL_LATCH_REGISTER; |
| 907 | break; | 907 | break; |
| 908 | } | 908 | } |
| 909 | /* give up the harware semaphore */ | 909 | /* give up the hardware semaphore */ |
| 910 | up (&semOperations); | 910 | up (&semOperations); |
| 911 | /* sleep for a short time just for good measure */ | 911 | /* sleep for a short time just for good measure */ |
| 912 | msleep(100); | 912 | msleep(100); |
diff --git a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c index 2335fac65fb4..8122fe734aa7 100644 --- a/drivers/pci/hotplug/ibmphp_pci.c +++ b/drivers/pci/hotplug/ibmphp_pci.c | |||
| @@ -1308,10 +1308,10 @@ static int unconfigure_boot_device (u8 busno, u8 device, u8 function) | |||
| 1308 | /* ????????? DO WE NEED TO WRITE ANYTHING INTO THE PCI CONFIG SPACE BACK ?????????? */ | 1308 | /* ????????? DO WE NEED TO WRITE ANYTHING INTO THE PCI CONFIG SPACE BACK ?????????? */ |
| 1309 | } else { | 1309 | } else { |
| 1310 | /* This is Memory */ | 1310 | /* This is Memory */ |
| 1311 | start_address &= PCI_BASE_ADDRESS_MEM_MASK; | ||
| 1312 | if (start_address & PCI_BASE_ADDRESS_MEM_PREFETCH) { | 1311 | if (start_address & PCI_BASE_ADDRESS_MEM_PREFETCH) { |
| 1313 | /* pfmem */ | 1312 | /* pfmem */ |
| 1314 | debug ("start address of pfmem is %x\n", start_address); | 1313 | debug ("start address of pfmem is %x\n", start_address); |
| 1314 | start_address &= PCI_BASE_ADDRESS_MEM_MASK; | ||
| 1315 | 1315 | ||
| 1316 | if (ibmphp_find_resource (bus, start_address, &pfmem, PFMEM) < 0) { | 1316 | if (ibmphp_find_resource (bus, start_address, &pfmem, PFMEM) < 0) { |
| 1317 | err ("cannot find corresponding PFMEM resource to remove\n"); | 1317 | err ("cannot find corresponding PFMEM resource to remove\n"); |
| @@ -1325,6 +1325,8 @@ static int unconfigure_boot_device (u8 busno, u8 device, u8 function) | |||
| 1325 | } else { | 1325 | } else { |
| 1326 | /* regular memory */ | 1326 | /* regular memory */ |
| 1327 | debug ("start address of mem is %x\n", start_address); | 1327 | debug ("start address of mem is %x\n", start_address); |
| 1328 | start_address &= PCI_BASE_ADDRESS_MEM_MASK; | ||
| 1329 | |||
| 1328 | if (ibmphp_find_resource (bus, start_address, &mem, MEM) < 0) { | 1330 | if (ibmphp_find_resource (bus, start_address, &mem, MEM) < 0) { |
| 1329 | err ("cannot find corresponding MEM resource to remove\n"); | 1331 | err ("cannot find corresponding MEM resource to remove\n"); |
| 1330 | return -EIO; | 1332 | return -EIO; |
| @@ -1422,9 +1424,9 @@ static int unconfigure_boot_bridge (u8 busno, u8 device, u8 function) | |||
| 1422 | /* ????????? DO WE NEED TO WRITE ANYTHING INTO THE PCI CONFIG SPACE BACK ?????????? */ | 1424 | /* ????????? DO WE NEED TO WRITE ANYTHING INTO THE PCI CONFIG SPACE BACK ?????????? */ |
| 1423 | } else { | 1425 | } else { |
| 1424 | /* This is Memory */ | 1426 | /* This is Memory */ |
| 1425 | start_address &= PCI_BASE_ADDRESS_MEM_MASK; | ||
| 1426 | if (start_address & PCI_BASE_ADDRESS_MEM_PREFETCH) { | 1427 | if (start_address & PCI_BASE_ADDRESS_MEM_PREFETCH) { |
| 1427 | /* pfmem */ | 1428 | /* pfmem */ |
| 1429 | start_address &= PCI_BASE_ADDRESS_MEM_MASK; | ||
| 1428 | if (ibmphp_find_resource (bus, start_address, &pfmem, PFMEM) < 0) { | 1430 | if (ibmphp_find_resource (bus, start_address, &pfmem, PFMEM) < 0) { |
| 1429 | err ("cannot find corresponding PFMEM resource to remove\n"); | 1431 | err ("cannot find corresponding PFMEM resource to remove\n"); |
| 1430 | return -EINVAL; | 1432 | return -EINVAL; |
| @@ -1436,6 +1438,7 @@ static int unconfigure_boot_bridge (u8 busno, u8 device, u8 function) | |||
| 1436 | } | 1438 | } |
| 1437 | } else { | 1439 | } else { |
| 1438 | /* regular memory */ | 1440 | /* regular memory */ |
| 1441 | start_address &= PCI_BASE_ADDRESS_MEM_MASK; | ||
| 1439 | if (ibmphp_find_resource (bus, start_address, &mem, MEM) < 0) { | 1442 | if (ibmphp_find_resource (bus, start_address, &mem, MEM) < 0) { |
| 1440 | err ("cannot find corresponding MEM resource to remove\n"); | 1443 | err ("cannot find corresponding MEM resource to remove\n"); |
| 1441 | return -EINVAL; | 1444 | return -EINVAL; |
diff --git a/drivers/pci/hotplug/pci_hotplug.h b/drivers/pci/hotplug/pci_hotplug.h index 57ace325168d..88d44f7fef29 100644 --- a/drivers/pci/hotplug/pci_hotplug.h +++ b/drivers/pci/hotplug/pci_hotplug.h | |||
| @@ -150,7 +150,7 @@ struct hotplug_slot_info { | |||
| 150 | * @name: the name of the slot being registered. This string must | 150 | * @name: the name of the slot being registered. This string must |
| 151 | * be unique amoung slots registered on this system. | 151 | * be unique amoung slots registered on this system. |
| 152 | * @ops: pointer to the &struct hotplug_slot_ops to be used for this slot | 152 | * @ops: pointer to the &struct hotplug_slot_ops to be used for this slot |
| 153 | * @info: pointer to the &struct hotplug_slot_info for the inital values for | 153 | * @info: pointer to the &struct hotplug_slot_info for the initial values for |
| 154 | * this slot. | 154 | * this slot. |
| 155 | * @release: called during pci_hp_deregister to free memory allocated in a | 155 | * @release: called during pci_hp_deregister to free memory allocated in a |
| 156 | * hotplug_slot structure. | 156 | * hotplug_slot structure. |
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 72baf749e65e..ed1fd8d6178d 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
| @@ -90,6 +90,22 @@ static struct hotplug_slot_ops pciehp_hotplug_slot_ops = { | |||
| 90 | .get_cur_bus_speed = get_cur_bus_speed, | 90 | .get_cur_bus_speed = get_cur_bus_speed, |
| 91 | }; | 91 | }; |
| 92 | 92 | ||
| 93 | /** | ||
| 94 | * release_slot - free up the memory used by a slot | ||
| 95 | * @hotplug_slot: slot to free | ||
| 96 | */ | ||
| 97 | static void release_slot(struct hotplug_slot *hotplug_slot) | ||
| 98 | { | ||
| 99 | struct slot *slot = hotplug_slot->private; | ||
| 100 | |||
| 101 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | ||
| 102 | |||
| 103 | kfree(slot->hotplug_slot->info); | ||
| 104 | kfree(slot->hotplug_slot->name); | ||
| 105 | kfree(slot->hotplug_slot); | ||
| 106 | kfree(slot); | ||
| 107 | } | ||
| 108 | |||
| 93 | static int init_slots(struct controller *ctrl) | 109 | static int init_slots(struct controller *ctrl) |
| 94 | { | 110 | { |
| 95 | struct slot *new_slot; | 111 | struct slot *new_slot; |
| @@ -139,7 +155,8 @@ static int init_slots(struct controller *ctrl) | |||
| 139 | 155 | ||
| 140 | /* register this slot with the hotplug pci core */ | 156 | /* register this slot with the hotplug pci core */ |
| 141 | new_slot->hotplug_slot->private = new_slot; | 157 | new_slot->hotplug_slot->private = new_slot; |
| 142 | make_slot_name (new_slot->hotplug_slot->name, SLOT_NAME_SIZE, new_slot); | 158 | new_slot->hotplug_slot->release = &release_slot; |
| 159 | make_slot_name(new_slot->hotplug_slot->name, SLOT_NAME_SIZE, new_slot); | ||
| 143 | new_slot->hotplug_slot->ops = &pciehp_hotplug_slot_ops; | 160 | new_slot->hotplug_slot->ops = &pciehp_hotplug_slot_ops; |
| 144 | 161 | ||
| 145 | new_slot->hpc_ops->get_power_status(new_slot, &(new_slot->hotplug_slot->info->power_status)); | 162 | new_slot->hpc_ops->get_power_status(new_slot, &(new_slot->hotplug_slot->info->power_status)); |
| @@ -188,10 +205,6 @@ static int cleanup_slots (struct controller * ctrl) | |||
| 188 | while (old_slot) { | 205 | while (old_slot) { |
| 189 | next_slot = old_slot->next; | 206 | next_slot = old_slot->next; |
| 190 | pci_hp_deregister (old_slot->hotplug_slot); | 207 | pci_hp_deregister (old_slot->hotplug_slot); |
| 191 | kfree(old_slot->hotplug_slot->info); | ||
| 192 | kfree(old_slot->hotplug_slot->name); | ||
| 193 | kfree(old_slot->hotplug_slot); | ||
| 194 | kfree(old_slot); | ||
| 195 | old_slot = next_slot; | 208 | old_slot = next_slot; |
| 196 | } | 209 | } |
| 197 | 210 | ||
diff --git a/drivers/pci/hotplug/pcihp_skeleton.c b/drivers/pci/hotplug/pcihp_skeleton.c index 6605d6bda529..3194d51c6ec9 100644 --- a/drivers/pci/hotplug/pcihp_skeleton.c +++ b/drivers/pci/hotplug/pcihp_skeleton.c | |||
| @@ -297,7 +297,7 @@ static int __init init_slots(void) | |||
| 297 | hotplug_slot->ops = &skel_hotplug_slot_ops; | 297 | hotplug_slot->ops = &skel_hotplug_slot_ops; |
| 298 | 298 | ||
| 299 | /* | 299 | /* |
| 300 | * Initilize the slot info structure with some known | 300 | * Initialize the slot info structure with some known |
| 301 | * good values. | 301 | * good values. |
| 302 | */ | 302 | */ |
| 303 | info->power_status = get_power_status(slot); | 303 | info->power_status = get_power_status(slot); |
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 22ecd3b058be..30206ac43c44 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
| @@ -522,7 +522,7 @@ void pci_scan_msi_device(struct pci_dev *dev) | |||
| 522 | * msi_capability_init - configure device's MSI capability structure | 522 | * msi_capability_init - configure device's MSI capability structure |
| 523 | * @dev: pointer to the pci_dev data structure of MSI device function | 523 | * @dev: pointer to the pci_dev data structure of MSI device function |
| 524 | * | 524 | * |
| 525 | * Setup the MSI capability structure of device funtion with a single | 525 | * Setup the MSI capability structure of device function with a single |
| 526 | * MSI vector, regardless of device function is capable of handling | 526 | * MSI vector, regardless of device function is capable of handling |
| 527 | * multiple messages. A return of zero indicates the successful setup | 527 | * multiple messages. A return of zero indicates the successful setup |
| 528 | * of an entry zero with the new MSI vector or non-zero for otherwise. | 528 | * of an entry zero with the new MSI vector or non-zero for otherwise. |
| @@ -599,7 +599,7 @@ static int msi_capability_init(struct pci_dev *dev) | |||
| 599 | * msix_capability_init - configure device's MSI-X capability | 599 | * msix_capability_init - configure device's MSI-X capability |
| 600 | * @dev: pointer to the pci_dev data structure of MSI-X device function | 600 | * @dev: pointer to the pci_dev data structure of MSI-X device function |
| 601 | * | 601 | * |
| 602 | * Setup the MSI-X capability structure of device funtion with a | 602 | * Setup the MSI-X capability structure of device function with a |
| 603 | * single MSI-X vector. A return of zero indicates the successful setup of | 603 | * single MSI-X vector. A return of zero indicates the successful setup of |
| 604 | * requested MSI-X entries with allocated vectors or non-zero for otherwise. | 604 | * requested MSI-X entries with allocated vectors or non-zero for otherwise. |
| 605 | **/ | 605 | **/ |
| @@ -1074,7 +1074,7 @@ void pci_disable_msix(struct pci_dev* dev) | |||
| 1074 | * msi_remove_pci_irq_vectors - reclaim MSI(X) vectors to unused state | 1074 | * msi_remove_pci_irq_vectors - reclaim MSI(X) vectors to unused state |
| 1075 | * @dev: pointer to the pci_dev data structure of MSI(X) device function | 1075 | * @dev: pointer to the pci_dev data structure of MSI(X) device function |
| 1076 | * | 1076 | * |
| 1077 | * Being called during hotplug remove, from which the device funciton | 1077 | * Being called during hotplug remove, from which the device function |
| 1078 | * is hot-removed. All previous assigned MSI/MSI-X vectors, if | 1078 | * is hot-removed. All previous assigned MSI/MSI-X vectors, if |
| 1079 | * allocated for this device function, are reclaimed to unused state, | 1079 | * allocated for this device function, are reclaimed to unused state, |
| 1080 | * which may be used later on. | 1080 | * which may be used later on. |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 968eb32f292d..bc01d34e2634 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | 19 | ||
| 20 | static u32 ctrlset_buf[3] = {0, 0, 0}; | 20 | static u32 ctrlset_buf[3] = {0, 0, 0}; |
| 21 | static u32 global_ctrlsets = 0; | 21 | static u32 global_ctrlsets = 0; |
| 22 | u8 OSC_UUID[16] = {0x5B, 0x4D, 0xDB, 0x33, 0xF7, 0x1F, 0x1C, 0x40, 0x96, 0x57, 0x74, 0x41, 0xC0, 0x3D, 0xD7, 0x66}; | 22 | static u8 OSC_UUID[16] = {0x5B, 0x4D, 0xDB, 0x33, 0xF7, 0x1F, 0x1C, 0x40, 0x96, 0x57, 0x74, 0x41, 0xC0, 0x3D, 0xD7, 0x66}; |
| 23 | 23 | ||
| 24 | static acpi_status | 24 | static acpi_status |
| 25 | acpi_query_osc ( | 25 | acpi_query_osc ( |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 37b7961efc44..fe98553c978f 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
| @@ -318,6 +318,14 @@ static int pci_device_resume(struct device * dev) | |||
| 318 | return 0; | 318 | return 0; |
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | static void pci_device_shutdown(struct device *dev) | ||
| 322 | { | ||
| 323 | struct pci_dev *pci_dev = to_pci_dev(dev); | ||
| 324 | struct pci_driver *drv = pci_dev->driver; | ||
| 325 | |||
| 326 | if (drv && drv->shutdown) | ||
| 327 | drv->shutdown(pci_dev); | ||
| 328 | } | ||
| 321 | 329 | ||
| 322 | #define kobj_to_pci_driver(obj) container_of(obj, struct device_driver, kobj) | 330 | #define kobj_to_pci_driver(obj) container_of(obj, struct device_driver, kobj) |
| 323 | #define attr_to_driver_attribute(obj) container_of(obj, struct driver_attribute, attr) | 331 | #define attr_to_driver_attribute(obj) container_of(obj, struct driver_attribute, attr) |
| @@ -373,7 +381,7 @@ pci_populate_driver_dir(struct pci_driver *drv) | |||
| 373 | * | 381 | * |
| 374 | * Adds the driver structure to the list of registered drivers. | 382 | * Adds the driver structure to the list of registered drivers. |
| 375 | * Returns a negative value on error, otherwise 0. | 383 | * Returns a negative value on error, otherwise 0. |
| 376 | * If no error occured, the driver remains registered even if | 384 | * If no error occurred, the driver remains registered even if |
| 377 | * no device was claimed during registration. | 385 | * no device was claimed during registration. |
| 378 | */ | 386 | */ |
| 379 | int pci_register_driver(struct pci_driver *drv) | 387 | int pci_register_driver(struct pci_driver *drv) |
| @@ -385,6 +393,7 @@ int pci_register_driver(struct pci_driver *drv) | |||
| 385 | drv->driver.bus = &pci_bus_type; | 393 | drv->driver.bus = &pci_bus_type; |
| 386 | drv->driver.probe = pci_device_probe; | 394 | drv->driver.probe = pci_device_probe; |
| 387 | drv->driver.remove = pci_device_remove; | 395 | drv->driver.remove = pci_device_remove; |
| 396 | drv->driver.shutdown = pci_device_shutdown, | ||
| 388 | drv->driver.owner = drv->owner; | 397 | drv->driver.owner = drv->owner; |
| 389 | drv->driver.kobj.ktype = &pci_driver_kobj_type; | 398 | drv->driver.kobj.ktype = &pci_driver_kobj_type; |
| 390 | pci_init_dynids(&drv->dynids); | 399 | pci_init_dynids(&drv->dynids); |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index d57ae71d32b1..8568b207f189 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
| @@ -91,6 +91,7 @@ pci_read_config(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
| 91 | struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); | 91 | struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); |
| 92 | unsigned int size = 64; | 92 | unsigned int size = 64; |
| 93 | loff_t init_off = off; | 93 | loff_t init_off = off; |
| 94 | u8 *data = (u8*) buf; | ||
| 94 | 95 | ||
| 95 | /* Several chips lock up trying to read undefined config space */ | 96 | /* Several chips lock up trying to read undefined config space */ |
| 96 | if (capable(CAP_SYS_ADMIN)) { | 97 | if (capable(CAP_SYS_ADMIN)) { |
| @@ -108,30 +109,47 @@ pci_read_config(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
| 108 | size = count; | 109 | size = count; |
| 109 | } | 110 | } |
| 110 | 111 | ||
| 111 | while (off & 3) { | 112 | if ((off & 1) && size) { |
| 112 | unsigned char val; | 113 | u8 val; |
| 113 | pci_read_config_byte(dev, off, &val); | 114 | pci_read_config_byte(dev, off, &val); |
| 114 | buf[off - init_off] = val; | 115 | data[off - init_off] = val; |
| 115 | off++; | 116 | off++; |
| 116 | if (--size == 0) | 117 | size--; |
| 117 | break; | 118 | } |
| 119 | |||
| 120 | if ((off & 3) && size > 2) { | ||
| 121 | u16 val; | ||
| 122 | pci_read_config_word(dev, off, &val); | ||
| 123 | data[off - init_off] = val & 0xff; | ||
| 124 | data[off - init_off + 1] = (val >> 8) & 0xff; | ||
| 125 | off += 2; | ||
| 126 | size -= 2; | ||
| 118 | } | 127 | } |
| 119 | 128 | ||
| 120 | while (size > 3) { | 129 | while (size > 3) { |
| 121 | unsigned int val; | 130 | u32 val; |
| 122 | pci_read_config_dword(dev, off, &val); | 131 | pci_read_config_dword(dev, off, &val); |
| 123 | buf[off - init_off] = val & 0xff; | 132 | data[off - init_off] = val & 0xff; |
| 124 | buf[off - init_off + 1] = (val >> 8) & 0xff; | 133 | data[off - init_off + 1] = (val >> 8) & 0xff; |
| 125 | buf[off - init_off + 2] = (val >> 16) & 0xff; | 134 | data[off - init_off + 2] = (val >> 16) & 0xff; |
| 126 | buf[off - init_off + 3] = (val >> 24) & 0xff; | 135 | data[off - init_off + 3] = (val >> 24) & 0xff; |
| 127 | off += 4; | 136 | off += 4; |
| 128 | size -= 4; | 137 | size -= 4; |
| 129 | } | 138 | } |
| 130 | 139 | ||
| 131 | while (size > 0) { | 140 | if (size >= 2) { |
| 132 | unsigned char val; | 141 | u16 val; |
| 142 | pci_read_config_word(dev, off, &val); | ||
| 143 | data[off - init_off] = val & 0xff; | ||
| 144 | data[off - init_off + 1] = (val >> 8) & 0xff; | ||
| 145 | off += 2; | ||
| 146 | size -= 2; | ||
| 147 | } | ||
| 148 | |||
| 149 | if (size > 0) { | ||
| 150 | u8 val; | ||
| 133 | pci_read_config_byte(dev, off, &val); | 151 | pci_read_config_byte(dev, off, &val); |
| 134 | buf[off - init_off] = val; | 152 | data[off - init_off] = val; |
| 135 | off++; | 153 | off++; |
| 136 | --size; | 154 | --size; |
| 137 | } | 155 | } |
| @@ -145,6 +163,7 @@ pci_write_config(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
| 145 | struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); | 163 | struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); |
| 146 | unsigned int size = count; | 164 | unsigned int size = count; |
| 147 | loff_t init_off = off; | 165 | loff_t init_off = off; |
| 166 | u8 *data = (u8*) buf; | ||
| 148 | 167 | ||
| 149 | if (off > dev->cfg_size) | 168 | if (off > dev->cfg_size) |
| 150 | return 0; | 169 | return 0; |
| @@ -152,26 +171,41 @@ pci_write_config(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
| 152 | size = dev->cfg_size - off; | 171 | size = dev->cfg_size - off; |
| 153 | count = size; | 172 | count = size; |
| 154 | } | 173 | } |
| 155 | 174 | ||
| 156 | while (off & 3) { | 175 | if ((off & 1) && size) { |
| 157 | pci_write_config_byte(dev, off, buf[off - init_off]); | 176 | pci_write_config_byte(dev, off, data[off - init_off]); |
| 158 | off++; | 177 | off++; |
| 159 | if (--size == 0) | 178 | size--; |
| 160 | break; | ||
| 161 | } | 179 | } |
| 180 | |||
| 181 | if ((off & 3) && size > 2) { | ||
| 182 | u16 val = data[off - init_off]; | ||
| 183 | val |= (u16) data[off - init_off + 1] << 8; | ||
| 184 | pci_write_config_word(dev, off, val); | ||
| 185 | off += 2; | ||
| 186 | size -= 2; | ||
| 187 | } | ||
| 162 | 188 | ||
| 163 | while (size > 3) { | 189 | while (size > 3) { |
| 164 | unsigned int val = buf[off - init_off]; | 190 | u32 val = data[off - init_off]; |
| 165 | val |= (unsigned int) buf[off - init_off + 1] << 8; | 191 | val |= (u32) data[off - init_off + 1] << 8; |
| 166 | val |= (unsigned int) buf[off - init_off + 2] << 16; | 192 | val |= (u32) data[off - init_off + 2] << 16; |
| 167 | val |= (unsigned int) buf[off - init_off + 3] << 24; | 193 | val |= (u32) data[off - init_off + 3] << 24; |
| 168 | pci_write_config_dword(dev, off, val); | 194 | pci_write_config_dword(dev, off, val); |
| 169 | off += 4; | 195 | off += 4; |
| 170 | size -= 4; | 196 | size -= 4; |
| 171 | } | 197 | } |
| 198 | |||
| 199 | if (size >= 2) { | ||
| 200 | u16 val = data[off - init_off]; | ||
| 201 | val |= (u16) data[off - init_off + 1] << 8; | ||
| 202 | pci_write_config_word(dev, off, val); | ||
| 203 | off += 2; | ||
| 204 | size -= 2; | ||
| 205 | } | ||
| 172 | 206 | ||
| 173 | while (size > 0) { | 207 | if (size) { |
| 174 | pci_write_config_byte(dev, off, buf[off - init_off]); | 208 | pci_write_config_byte(dev, off, data[off - init_off]); |
| 175 | off++; | 209 | off++; |
| 176 | --size; | 210 | --size; |
| 177 | } | 211 | } |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index bfbff8335268..f04b9ffe4153 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
| 17 | #include <linux/spinlock.h> | 17 | #include <linux/spinlock.h> |
| 18 | #include <asm/dma.h> /* isa_dma_bridge_buggy */ | 18 | #include <asm/dma.h> /* isa_dma_bridge_buggy */ |
| 19 | #include "pci.h" | ||
| 19 | 20 | ||
| 20 | 21 | ||
| 21 | /** | 22 | /** |
| @@ -398,10 +399,10 @@ pci_enable_device(struct pci_dev *dev) | |||
| 398 | { | 399 | { |
| 399 | int err; | 400 | int err; |
| 400 | 401 | ||
| 401 | dev->is_enabled = 1; | ||
| 402 | if ((err = pci_enable_device_bars(dev, (1 << PCI_NUM_RESOURCES) - 1))) | 402 | if ((err = pci_enable_device_bars(dev, (1 << PCI_NUM_RESOURCES) - 1))) |
| 403 | return err; | 403 | return err; |
| 404 | pci_fixup_device(pci_fixup_enable, dev); | 404 | pci_fixup_device(pci_fixup_enable, dev); |
| 405 | dev->is_enabled = 1; | ||
| 405 | return 0; | 406 | return 0; |
| 406 | } | 407 | } |
| 407 | 408 | ||
| @@ -427,16 +428,15 @@ pci_disable_device(struct pci_dev *dev) | |||
| 427 | { | 428 | { |
| 428 | u16 pci_command; | 429 | u16 pci_command; |
| 429 | 430 | ||
| 430 | dev->is_enabled = 0; | ||
| 431 | dev->is_busmaster = 0; | ||
| 432 | |||
| 433 | pci_read_config_word(dev, PCI_COMMAND, &pci_command); | 431 | pci_read_config_word(dev, PCI_COMMAND, &pci_command); |
| 434 | if (pci_command & PCI_COMMAND_MASTER) { | 432 | if (pci_command & PCI_COMMAND_MASTER) { |
| 435 | pci_command &= ~PCI_COMMAND_MASTER; | 433 | pci_command &= ~PCI_COMMAND_MASTER; |
| 436 | pci_write_config_word(dev, PCI_COMMAND, pci_command); | 434 | pci_write_config_word(dev, PCI_COMMAND, pci_command); |
| 437 | } | 435 | } |
| 436 | dev->is_busmaster = 0; | ||
| 438 | 437 | ||
| 439 | pcibios_disable_device(dev); | 438 | pcibios_disable_device(dev); |
| 439 | dev->is_enabled = 0; | ||
| 440 | } | 440 | } |
| 441 | 441 | ||
| 442 | /** | 442 | /** |
| @@ -749,17 +749,6 @@ pci_set_dma_mask(struct pci_dev *dev, u64 mask) | |||
| 749 | } | 749 | } |
| 750 | 750 | ||
| 751 | int | 751 | int |
| 752 | pci_dac_set_dma_mask(struct pci_dev *dev, u64 mask) | ||
| 753 | { | ||
| 754 | if (!pci_dac_dma_supported(dev, mask)) | ||
| 755 | return -EIO; | ||
| 756 | |||
| 757 | dev->dma_mask = mask; | ||
| 758 | |||
| 759 | return 0; | ||
| 760 | } | ||
| 761 | |||
| 762 | int | ||
| 763 | pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) | 752 | pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) |
| 764 | { | 753 | { |
| 765 | if (!pci_dma_supported(dev, mask)) | 754 | if (!pci_dma_supported(dev, mask)) |
| @@ -821,7 +810,6 @@ EXPORT_SYMBOL(pci_set_master); | |||
| 821 | EXPORT_SYMBOL(pci_set_mwi); | 810 | EXPORT_SYMBOL(pci_set_mwi); |
| 822 | EXPORT_SYMBOL(pci_clear_mwi); | 811 | EXPORT_SYMBOL(pci_clear_mwi); |
| 823 | EXPORT_SYMBOL(pci_set_dma_mask); | 812 | EXPORT_SYMBOL(pci_set_dma_mask); |
| 824 | EXPORT_SYMBOL(pci_dac_set_dma_mask); | ||
| 825 | EXPORT_SYMBOL(pci_set_consistent_dma_mask); | 813 | EXPORT_SYMBOL(pci_set_consistent_dma_mask); |
| 826 | EXPORT_SYMBOL(pci_assign_resource); | 814 | EXPORT_SYMBOL(pci_assign_resource); |
| 827 | EXPORT_SYMBOL(pci_find_parent_resource); | 815 | EXPORT_SYMBOL(pci_find_parent_resource); |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 6f0edadd132c..b7ae87823c69 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
| 10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
| 11 | #include <linux/cpumask.h> | 11 | #include <linux/cpumask.h> |
| 12 | #include "pci.h" | ||
| 12 | 13 | ||
| 13 | #define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */ | 14 | #define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */ |
| 14 | #define CARDBUS_RESERVE_BUSNR 3 | 15 | #define CARDBUS_RESERVE_BUSNR 3 |
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index 84cc4f620d8d..e68bbfb1e7c3 100644 --- a/drivers/pci/proc.c +++ b/drivers/pci/proc.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | #include <asm/uaccess.h> | 16 | #include <asm/uaccess.h> |
| 17 | #include <asm/byteorder.h> | 17 | #include <asm/byteorder.h> |
| 18 | #include "pci.h" | ||
| 18 | 19 | ||
| 19 | static int proc_initialized; /* = 0 */ | 20 | static int proc_initialized; /* = 0 */ |
| 20 | 21 | ||
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 15a398051682..026aa04669a2 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/pci.h> | 18 | #include <linux/pci.h> |
| 19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
| 20 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
| 21 | #include "pci.h" | ||
| 21 | 22 | ||
| 22 | /* Deal with broken BIOS'es that neglect to enable passive release, | 23 | /* Deal with broken BIOS'es that neglect to enable passive release, |
| 23 | which can cause problems in combination with the 82441FX/PPro MTRRs */ | 24 | which can cause problems in combination with the 82441FX/PPro MTRRs */ |
| @@ -328,6 +329,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, | |||
| 328 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0, quirk_ich4_lpc_acpi ); | 329 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0, quirk_ich4_lpc_acpi ); |
| 329 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, quirk_ich4_lpc_acpi ); | 330 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, quirk_ich4_lpc_acpi ); |
| 330 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, quirk_ich4_lpc_acpi ); | 331 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, quirk_ich4_lpc_acpi ); |
| 332 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1, quirk_ich4_lpc_acpi ); | ||
| 331 | 333 | ||
| 332 | /* | 334 | /* |
| 333 | * VIA ACPI: One IO region pointed to by longword at | 335 | * VIA ACPI: One IO region pointed to by longword at |
