ACPICA: Major update for acpi_get_object_info external interface
[safe/jmp/linux-2.6] / arch / ia64 / hp / common / sba_iommu.c
index 29e7206..674a837 100644 (file)
@@ -907,13 +907,15 @@ sba_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt)
  * @dir:  R/W or both.
  * @attrs: optional dma attributes
  *
- * See Documentation/DMA-mapping.txt
+ * See Documentation/PCI/PCI-DMA-mapping.txt
  */
-static dma_addr_t
-sba_map_single_attrs(struct device *dev, void *addr, size_t size, int dir,
-                    struct dma_attrs *attrs)
+static dma_addr_t sba_map_page(struct device *dev, struct page *page,
+                              unsigned long poff, size_t size,
+                              enum dma_data_direction dir,
+                              struct dma_attrs *attrs)
 {
        struct ioc *ioc;
+       void *addr = page_address(page) + poff;
        dma_addr_t iovp;
        dma_addr_t offset;
        u64 *pdir_start;
@@ -992,6 +994,14 @@ sba_map_single_attrs(struct device *dev, void *addr, size_t size, int dir,
        return SBA_IOVA(ioc, iovp, offset);
 }
 
+static dma_addr_t sba_map_single_attrs(struct device *dev, void *addr,
+                                      size_t size, enum dma_data_direction dir,
+                                      struct dma_attrs *attrs)
+{
+       return sba_map_page(dev, virt_to_page(addr),
+                           (unsigned long)addr & ~PAGE_MASK, size, dir, attrs);
+}
+
 #ifdef ENABLE_MARK_CLEAN
 static SBA_INLINE void
 sba_mark_clean(struct ioc *ioc, dma_addr_t iova, size_t size)
@@ -1024,10 +1034,10 @@ sba_mark_clean(struct ioc *ioc, dma_addr_t iova, size_t size)
  * @dir:  R/W or both.
  * @attrs: optional dma attributes
  *
- * See Documentation/DMA-mapping.txt
+ * See Documentation/PCI/PCI-DMA-mapping.txt
  */
-static void sba_unmap_single_attrs(struct device *dev, dma_addr_t iova, size_t size,
-                                  int dir, struct dma_attrs *attrs)
+static void sba_unmap_page(struct device *dev, dma_addr_t iova, size_t size,
+                          enum dma_data_direction dir, struct dma_attrs *attrs)
 {
        struct ioc *ioc;
 #if DELAYED_RESOURCE_CNT > 0
@@ -1095,13 +1105,19 @@ static void sba_unmap_single_attrs(struct device *dev, dma_addr_t iova, size_t s
 #endif /* DELAYED_RESOURCE_CNT == 0 */
 }
 
+void sba_unmap_single_attrs(struct device *dev, dma_addr_t iova, size_t size,
+                           enum dma_data_direction dir, struct dma_attrs *attrs)
+{
+       sba_unmap_page(dev, iova, size, dir, attrs);
+}
+
 /**
  * sba_alloc_coherent - allocate/map shared mem for DMA
  * @dev: instance of PCI owned by the driver that's asking.
  * @size:  number of bytes mapped in driver buffer.
  * @dma_handle:  IOVA of new buffer.
  *
- * See Documentation/DMA-mapping.txt
+ * See Documentation/PCI/PCI-DMA-mapping.txt
  */
 static void *
 sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flags)
@@ -1115,7 +1131,7 @@ sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp
 #ifdef CONFIG_NUMA
        {
                struct page *page;
-               page = alloc_pages_node(ioc->node == MAX_NUMNODES ?
+               page = alloc_pages_exact_node(ioc->node == MAX_NUMNODES ?
                                        numa_node_id() : ioc->node, flags,
                                        get_order(size));
 
@@ -1164,7 +1180,7 @@ sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp
  * @vaddr:  virtual address IOVA of "consistent" buffer.
  * @dma_handler:  IO virtual address of "consistent" buffer.
  *
- * See Documentation/DMA-mapping.txt
+ * See Documentation/PCI/PCI-DMA-mapping.txt
  */
 static void sba_free_coherent (struct device *dev, size_t size, void *vaddr,
                               dma_addr_t dma_handle)
@@ -1420,10 +1436,11 @@ sba_coalesce_chunks(struct ioc *ioc, struct device *dev,
  * @dir:  R/W or both.
  * @attrs: optional dma attributes
  *
- * See Documentation/DMA-mapping.txt
+ * See Documentation/PCI/PCI-DMA-mapping.txt
  */
 static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist,
-                           int nents, int dir, struct dma_attrs *attrs)
+                           int nents, enum dma_data_direction dir,
+                           struct dma_attrs *attrs)
 {
        struct ioc *ioc;
        int coalesced, filled = 0;
@@ -1511,10 +1528,11 @@ static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist,
  * @dir:  R/W or both.
  * @attrs: optional dma attributes
  *
- * See Documentation/DMA-mapping.txt
+ * See Documentation/PCI/PCI-DMA-mapping.txt
  */
 static void sba_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist,
-                              int nents, int dir, struct dma_attrs *attrs)
+                              int nents, enum dma_data_direction dir,
+                              struct dma_attrs *attrs)
 {
 #ifdef ASSERT_PDIR_SANITY
        struct ioc *ioc;
@@ -1769,7 +1787,7 @@ static struct ioc_iommu ioc_iommu_info[] __initdata = {
 };
 
 static struct ioc * __init
-ioc_init(u64 hpa, void *handle)
+ioc_init(unsigned long hpa, void *handle)
 {
        struct ioc *ioc;
        struct ioc_iommu *info;
@@ -2008,24 +2026,21 @@ acpi_sba_ioc_add(struct acpi_device *device)
        struct ioc *ioc;
        acpi_status status;
        u64 hpa, length;
-       struct acpi_buffer buffer;
        struct acpi_device_info *dev_info;
 
        status = hp_acpi_csr_space(device->handle, &hpa, &length);
        if (ACPI_FAILURE(status))
                return 1;
 
-       buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
-       status = acpi_get_object_info(device->handle, &buffer);
+       status = acpi_get_object_info(device->handle, &dev_info);
        if (ACPI_FAILURE(status))
                return 1;
-       dev_info = buffer.pointer;
 
        /*
         * For HWP0001, only SBA appears in ACPI namespace.  It encloses the PCI
         * root bridges, and its CSR space includes the IOC function.
         */
-       if (strncmp("HWP0001", dev_info->hardware_id.value, 7) == 0) {
+       if (strncmp("HWP0001", dev_info->hardware_id.string, 7) == 0) {
                hpa += ZX1_IOC_OFFSET;
                /* zx1 based systems default to kernel page size iommu pages */
                if (!iovp_shift)
@@ -2062,7 +2077,7 @@ static struct acpi_driver acpi_sba_ioc_driver = {
        },
 };
 
-extern struct dma_mapping_ops swiotlb_dma_ops;
+extern struct dma_map_ops swiotlb_dma_ops;
 
 static int __init
 sba_init(void)
@@ -2176,18 +2191,18 @@ sba_page_override(char *str)
 
 __setup("sbapagesize=",sba_page_override);
 
-struct dma_mapping_ops sba_dma_ops = {
+struct dma_map_ops sba_dma_ops = {
        .alloc_coherent         = sba_alloc_coherent,
        .free_coherent          = sba_free_coherent,
-       .map_single_attrs       = sba_map_single_attrs,
-       .unmap_single_attrs     = sba_unmap_single_attrs,
-       .map_sg_attrs           = sba_map_sg_attrs,
-       .unmap_sg_attrs         = sba_unmap_sg_attrs,
+       .map_page               = sba_map_page,
+       .unmap_page             = sba_unmap_page,
+       .map_sg                 = sba_map_sg_attrs,
+       .unmap_sg               = sba_unmap_sg_attrs,
        .sync_single_for_cpu    = machvec_dma_sync_single,
        .sync_sg_for_cpu        = machvec_dma_sync_sg,
        .sync_single_for_device = machvec_dma_sync_single,
        .sync_sg_for_device     = machvec_dma_sync_sg,
-       .dma_supported_op       = sba_dma_supported,
+       .dma_supported          = sba_dma_supported,
        .mapping_error          = sba_dma_mapping_error,
 };