PCI: Add BAR index argument to pci_mmap_page_range()
In all cases we know which BAR it is. Passing it in means that arch code (or generic code; watch this space) won't have to go looking for it again. Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
Родитель
dca40b186b
Коммит
f66e225828
|
@ -597,7 +597,8 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
|
int pci_mmap_page_range(struct pci_dev *dev, int bar,
|
||||||
|
struct vm_area_struct *vma,
|
||||||
enum pci_mmap_state mmap_state, int write_combine)
|
enum pci_mmap_state mmap_state, int write_combine)
|
||||||
{
|
{
|
||||||
if (mmap_state == pci_mmap_io)
|
if (mmap_state == pci_mmap_io)
|
||||||
|
|
|
@ -14,7 +14,8 @@ void pcibios_set_master(struct pci_dev *dev)
|
||||||
pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
|
pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
|
||||||
}
|
}
|
||||||
|
|
||||||
int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
|
int pci_mmap_page_range(struct pci_dev *dev, int bar,
|
||||||
|
struct vm_area_struct *vma,
|
||||||
enum pci_mmap_state mmap_state, int write_combine)
|
enum pci_mmap_state mmap_state, int write_combine)
|
||||||
{
|
{
|
||||||
unsigned long prot;
|
unsigned long prot;
|
||||||
|
|
|
@ -419,7 +419,8 @@ pcibios_align_resource (void *data, const struct resource *res,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
pci_mmap_page_range (struct pci_dev *dev, struct vm_area_struct *vma,
|
pci_mmap_page_range (struct pci_dev *dev, int bar,
|
||||||
|
struct vm_area_struct *vma,
|
||||||
enum pci_mmap_state mmap_state, int write_combine)
|
enum pci_mmap_state mmap_state, int write_combine)
|
||||||
{
|
{
|
||||||
unsigned long size = vma->vm_end - vma->vm_start;
|
unsigned long size = vma->vm_end - vma->vm_start;
|
||||||
|
|
|
@ -278,7 +278,7 @@ pgprot_t pci_phys_mem_access_prot(struct file *file,
|
||||||
*
|
*
|
||||||
* Returns a negative error code on failure, zero on success.
|
* Returns a negative error code on failure, zero on success.
|
||||||
*/
|
*/
|
||||||
int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
|
int pci_mmap_page_range(struct pci_dev *dev, int bar, struct vm_area_struct *vma,
|
||||||
enum pci_mmap_state mmap_state, int write_combine)
|
enum pci_mmap_state mmap_state, int write_combine)
|
||||||
{
|
{
|
||||||
resource_size_t offset =
|
resource_size_t offset =
|
||||||
|
|
|
@ -58,7 +58,8 @@ void pci_resource_to_user(const struct pci_dev *dev, int bar,
|
||||||
*end = rsrc->start + size;
|
*end = rsrc->start + size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
|
int pci_mmap_page_range(struct pci_dev *dev, int bar,
|
||||||
|
struct vm_area_struct *vma,
|
||||||
enum pci_mmap_state mmap_state, int write_combine)
|
enum pci_mmap_state mmap_state, int write_combine)
|
||||||
{
|
{
|
||||||
unsigned long prot;
|
unsigned long prot;
|
||||||
|
|
|
@ -211,7 +211,8 @@ void __init pcibios_resource_survey(void)
|
||||||
pcibios_allocate_resources(1);
|
pcibios_allocate_resources(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
|
int pci_mmap_page_range(struct pci_dev *dev, int bar,
|
||||||
|
struct vm_area_struct *vma,
|
||||||
enum pci_mmap_state mmap_state, int write_combine)
|
enum pci_mmap_state mmap_state, int write_combine)
|
||||||
{
|
{
|
||||||
unsigned long prot;
|
unsigned long prot;
|
||||||
|
|
|
@ -228,7 +228,8 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
|
int pci_mmap_page_range(struct pci_dev *dev, int bar,
|
||||||
|
struct vm_area_struct *vma,
|
||||||
enum pci_mmap_state mmap_state, int write_combine)
|
enum pci_mmap_state mmap_state, int write_combine)
|
||||||
{
|
{
|
||||||
unsigned long prot;
|
unsigned long prot;
|
||||||
|
|
|
@ -513,7 +513,8 @@ pgprot_t pci_phys_mem_access_prot(struct file *file,
|
||||||
*
|
*
|
||||||
* Returns a negative error code on failure, zero on success.
|
* Returns a negative error code on failure, zero on success.
|
||||||
*/
|
*/
|
||||||
int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
|
int pci_mmap_page_range(struct pci_dev *dev, int bar,
|
||||||
|
struct vm_area_struct *vma,
|
||||||
enum pci_mmap_state mmap_state, int write_combine)
|
enum pci_mmap_state mmap_state, int write_combine)
|
||||||
{
|
{
|
||||||
resource_size_t offset =
|
resource_size_t offset =
|
||||||
|
|
|
@ -269,7 +269,8 @@ void __ref pcibios_report_status(unsigned int status_mask, int warn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
|
int pci_mmap_page_range(struct pci_dev *dev, int bar,
|
||||||
|
struct vm_area_struct *vma,
|
||||||
enum pci_mmap_state mmap_state, int write_combine)
|
enum pci_mmap_state mmap_state, int write_combine)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -862,9 +862,9 @@ static void __pci_mmap_set_pgprot(struct pci_dev *dev, struct vm_area_struct *vm
|
||||||
*
|
*
|
||||||
* Returns a negative error code on failure, zero on success.
|
* Returns a negative error code on failure, zero on success.
|
||||||
*/
|
*/
|
||||||
int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
|
int pci_mmap_page_range(struct pci_dev *dev, int bar,
|
||||||
enum pci_mmap_state mmap_state,
|
struct vm_area_struct *vma,
|
||||||
int write_combine)
|
enum pci_mmap_state mmap_state, int write_combine)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
|
@ -357,7 +357,8 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
|
int pci_mmap_page_range(struct pci_dev *dev, int bar,
|
||||||
|
struct vm_area_struct *vma,
|
||||||
enum pci_mmap_state mmap_state, int write_combine)
|
enum pci_mmap_state mmap_state, int write_combine)
|
||||||
{
|
{
|
||||||
unsigned long phys;
|
unsigned long phys;
|
||||||
|
|
|
@ -411,7 +411,8 @@ static const struct vm_operations_struct pci_mmap_ops = {
|
||||||
.access = generic_access_phys,
|
.access = generic_access_phys,
|
||||||
};
|
};
|
||||||
|
|
||||||
int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
|
int pci_mmap_page_range(struct pci_dev *dev, int bar,
|
||||||
|
struct vm_area_struct *vma,
|
||||||
enum pci_mmap_state mmap_state, int write_combine)
|
enum pci_mmap_state mmap_state, int write_combine)
|
||||||
{
|
{
|
||||||
unsigned long prot;
|
unsigned long prot;
|
||||||
|
|
|
@ -343,7 +343,8 @@ __pci_mmap_make_offset(struct pci_dev *dev, struct vm_area_struct *vma,
|
||||||
*
|
*
|
||||||
* Returns a negative error code on failure, zero on success.
|
* Returns a negative error code on failure, zero on success.
|
||||||
*/
|
*/
|
||||||
int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
|
int pci_mmap_page_range(struct pci_dev *dev, int bar,
|
||||||
|
struct vm_area_struct *vma,
|
||||||
enum pci_mmap_state mmap_state,
|
enum pci_mmap_state mmap_state,
|
||||||
int write_combine)
|
int write_combine)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1041,7 +1041,7 @@ static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
|
||||||
pci_resource_to_user(pdev, bar, res, &start, &end);
|
pci_resource_to_user(pdev, bar, res, &start, &end);
|
||||||
vma->vm_pgoff += start >> PAGE_SHIFT;
|
vma->vm_pgoff += start >> PAGE_SHIFT;
|
||||||
mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io;
|
mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io;
|
||||||
return pci_mmap_page_range(pdev, vma, mmap_type, write_combine);
|
return pci_mmap_page_range(pdev, bar, vma, mmap_type, write_combine);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pci_mmap_resource_uc(struct file *filp, struct kobject *kobj,
|
static int pci_mmap_resource_uc(struct file *filp, struct kobject *kobj,
|
||||||
|
|
|
@ -262,7 +262,7 @@ static int proc_bus_pci_mmap(struct file *file, struct vm_area_struct *vma)
|
||||||
else
|
else
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
ret = pci_mmap_page_range(dev, vma,
|
ret = pci_mmap_page_range(dev, i, vma,
|
||||||
fpriv->mmap_state, write_combine);
|
fpriv->mmap_state, write_combine);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -1630,7 +1630,8 @@ static inline int pci_get_new_domain_nr(void) { return -ENOSYS; }
|
||||||
* Architectures provide this function if they set HAVE_PCI_MMAP, and
|
* Architectures provide this function if they set HAVE_PCI_MMAP, and
|
||||||
* it accepts the 'write_combine' argument when arch_can_pci_mmap_wc()
|
* it accepts the 'write_combine' argument when arch_can_pci_mmap_wc()
|
||||||
* evaluates to nonzero. */
|
* evaluates to nonzero. */
|
||||||
int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
|
int pci_mmap_page_range(struct pci_dev *pdev, int bar,
|
||||||
|
struct vm_area_struct *vma,
|
||||||
enum pci_mmap_state mmap_state, int write_combine);
|
enum pci_mmap_state mmap_state, int write_combine);
|
||||||
|
|
||||||
#ifndef arch_can_pci_mmap_wc
|
#ifndef arch_can_pci_mmap_wc
|
||||||
|
|
Загрузка…
Ссылка в новой задаче