pci.c (b6c58b1d987a5795086c5c2babd8c7367d2fdb8c) pci.c (9ad62ec4f752c82b39aa5927f23d894b46ae10b9)
1/*
2 * New-style PCI core.
3 *
4 * Copyright (c) 2004 - 2009 Paul Mundt
5 * Copyright (c) 2002 M. R. Brown
6 *
7 * Modelled after arch/mips/pci/pci.c:
8 * Copyright (C) 2003, 04 Ralf Baechle (ralf@linux-mips.org)

--- 190 unchanged lines hidden (view full) ---

199 if (start & 0x300)
200 start = (start + 0x3ff) & ~0x3ff;
201 }
202
203 res->start = start;
204}
205
206void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
1/*
2 * New-style PCI core.
3 *
4 * Copyright (c) 2004 - 2009 Paul Mundt
5 * Copyright (c) 2002 M. R. Brown
6 *
7 * Modelled after arch/mips/pci/pci.c:
8 * Copyright (C) 2003, 04 Ralf Baechle (ralf@linux-mips.org)

--- 190 unchanged lines hidden (view full) ---

199 if (start & 0x300)
200 start = (start + 0x3ff) & ~0x3ff;
201 }
202
203 res->start = start;
204}
205
206void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
207 struct resource *res)
207 struct resource *res)
208{
209 struct pci_channel *hose = dev->sysdata;
210 unsigned long offset = 0;
211
212 if (res->flags & IORESOURCE_IO)
213 offset = hose->io_offset;
214 else if (res->flags & IORESOURCE_MEM)
215 offset = hose->mem_offset;
216
217 region->start = res->start - offset;
218 region->end = res->end - offset;
219}
220
208{
209 struct pci_channel *hose = dev->sysdata;
210 unsigned long offset = 0;
211
212 if (res->flags & IORESOURCE_IO)
213 offset = hose->io_offset;
214 else if (res->flags & IORESOURCE_MEM)
215 offset = hose->mem_offset;
216
217 region->start = res->start - offset;
218 region->end = res->end - offset;
219}
220
221void __devinit
222pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
223 struct pci_bus_region *region)
221void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
222 struct pci_bus_region *region)
224{
225 struct pci_channel *hose = dev->sysdata;
226 unsigned long offset = 0;
227
228 if (res->flags & IORESOURCE_IO)
229 offset = hose->io_offset;
230 else if (res->flags & IORESOURCE_MEM)
231 offset = hose->mem_offset;

--- 66 unchanged lines hidden (view full) ---

298 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
299}
300
301char * __devinit pcibios_setup(char *str)
302{
303 return str;
304}
305
223{
224 struct pci_channel *hose = dev->sysdata;
225 unsigned long offset = 0;
226
227 if (res->flags & IORESOURCE_IO)
228 offset = hose->io_offset;
229 else if (res->flags & IORESOURCE_MEM)
230 offset = hose->mem_offset;

--- 66 unchanged lines hidden (view full) ---

297 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
298}
299
300char * __devinit pcibios_setup(char *str)
301{
302 return str;
303}
304
305static void __init
306pcibios_bus_report_status_early(struct pci_channel *hose,
307 int top_bus, int current_bus,
308 unsigned int status_mask, int warn)
309{
310 unsigned int pci_devfn;
311 u16 status;
312 int ret;
313
314 for (pci_devfn = 0; pci_devfn < 0xff; pci_devfn++) {
315 if (PCI_FUNC(pci_devfn))
316 continue;
317 ret = early_read_config_word(hose, top_bus, current_bus,
318 pci_devfn, PCI_STATUS, &status);
319 if (ret != PCIBIOS_SUCCESSFUL)
320 continue;
321 if (status == 0xffff)
322 continue;
323
324 early_write_config_word(hose, top_bus, current_bus,
325 pci_devfn, PCI_STATUS,
326 status & status_mask);
327 if (warn)
328 printk("(%02x:%02x: %04X) ", current_bus,
329 pci_devfn, status);
330 }
331}
332
306/*
307 * We can't use pci_find_device() here since we are
308 * called from interrupt context.
309 */
333/*
334 * We can't use pci_find_device() here since we are
335 * called from interrupt context.
336 */
310static void pcibios_bus_report_status(struct pci_bus *bus,
311 unsigned int status_mask, int warn)
337static void __init_refok
338pcibios_bus_report_status(struct pci_bus *bus, unsigned int status_mask,
339 int warn)
312{
313 struct pci_dev *dev;
314
315 list_for_each_entry(dev, &bus->devices, bus_list) {
316 u16 status;
317
318 /*
319 * ignore host bridge - we handle

--- 16 unchanged lines hidden (view full) ---

336 printk("(%s: %04X) ", pci_name(dev), status);
337 }
338
339 list_for_each_entry(dev, &bus->devices, bus_list)
340 if (dev->subordinate)
341 pcibios_bus_report_status(dev->subordinate, status_mask, warn);
342}
343
340{
341 struct pci_dev *dev;
342
343 list_for_each_entry(dev, &bus->devices, bus_list) {
344 u16 status;
345
346 /*
347 * ignore host bridge - we handle

--- 16 unchanged lines hidden (view full) ---

364 printk("(%s: %04X) ", pci_name(dev), status);
365 }
366
367 list_for_each_entry(dev, &bus->devices, bus_list)
368 if (dev->subordinate)
369 pcibios_bus_report_status(dev->subordinate, status_mask, warn);
370}
371
344void pcibios_report_status(unsigned int status_mask, int warn)
372void __init_refok pcibios_report_status(unsigned int status_mask, int warn)
345{
346 struct pci_channel *hose;
347
373{
374 struct pci_channel *hose;
375
348 for (hose = hose_head; hose; hose = hose->next)
349 pcibios_bus_report_status(hose->bus, status_mask, warn);
376 for (hose = hose_head; hose; hose = hose->next) {
377 if (unlikely(!hose->bus))
378 pcibios_bus_report_status_early(hose, hose_head->index,
379 hose->index, status_mask, warn);
380 else
381 pcibios_bus_report_status(hose->bus, status_mask, warn);
382 }
350}
351
352int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
353 enum pci_mmap_state mmap_state, int write_combine)
354{
355 /*
356 * I/O space can be accessed via normal processor loads and stores on
357 * this platform but for now we elect not to do this and portable

--- 71 unchanged lines hidden ---
383}
384
385int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
386 enum pci_mmap_state mmap_state, int write_combine)
387{
388 /*
389 * I/O space can be accessed via normal processor loads and stores on
390 * this platform but for now we elect not to do this and portable

--- 71 unchanged lines hidden ---