]> Git Repo - linux.git/commitdiff
Merge branch 'for-4.2/sg' of git://git.kernel.dk/linux-block
authorLinus Torvalds <[email protected]>
Thu, 25 Jun 2015 22:22:36 +0000 (15:22 -0700)
committerLinus Torvalds <[email protected]>
Thu, 25 Jun 2015 22:22:36 +0000 (15:22 -0700)
Pull asm/scatterlist.h removal from Jens Axboe:
 "We don't have any specific arch scatterlist anymore, since parisc
  finally switched over.  Kill the include"

* 'for-4.2/sg' of git://git.kernel.dk/linux-block:
  remove scatterlist.h generation from arch Kbuild files
  remove <asm/scatterlist.h>

13 files changed:
1  2 
Documentation/scsi/scsi_mid_low_api.txt
arch/alpha/include/asm/pci.h
arch/frv/include/asm/pci.h
arch/ia64/include/asm/pci.h
arch/microblaze/include/asm/pci.h
arch/mips/include/asm/pci.h
arch/mn10300/include/asm/pci.h
arch/parisc/include/asm/pci.h
arch/powerpc/include/asm/pci.h
arch/x86/include/asm/pci.h
include/linux/blkdev.h
include/linux/scatterlist.h
lib/swiotlb.c

index 731bc4f4c5e64a1ef0a4fce0ea3bf352f8f4c389,731bc4f4c5e64a1ef0a4fce0ea3bf352f8f4c389..255075157511640622258f5d2801f5eceb51f13a
@@@ -1269,7 -1269,7 +1269,7 @@@ Members of interest
      request_buffer - either contains data buffer or scatter gather list
                       depending on the setting of use_sg. Scatter gather
                       elements are defined by 'struct scatterlist' found
--                     in include/asm/scatterlist.h .
++                     in include/linux/scatterlist.h .
      done         - function pointer that should be invoked by LLD when the
                     SCSI command is completed (successfully or otherwise).
                     Should only be called by an LLD if the LLD has accepted
index 8b02afeb6319101c0080e98a06ced98e7e4f27ad,bf7d97dce9e81eb260ae9eee96c0f4b60701a519..98f2eeee8f681117908a3958a4698de514388bd9
@@@ -5,7 -5,7 +5,7 @@@
  
  #include <linux/spinlock.h>
  #include <linux/dma-mapping.h>
- #include <asm/scatterlist.h>
+ #include <linux/scatterlist.h>
  #include <asm/machvec.h>
  #include <asm-generic/pci-bridge.h>
  
@@@ -71,6 -71,22 +71,6 @@@ extern void pcibios_set_master(struct p
  /* implement the pci_ DMA API in terms of the generic device dma_ one */
  #include <asm-generic/pci-dma-compat.h>
  
 -static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 -                                      enum pci_dma_burst_strategy *strat,
 -                                      unsigned long *strategy_parameter)
 -{
 -      unsigned long cacheline_size;
 -      u8 byte;
 -
 -      pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &byte);
 -      if (byte == 0)
 -              cacheline_size = 1024;
 -      else
 -              cacheline_size = (int) byte * 4;
 -
 -      *strat = PCI_DMA_BURST_BOUNDARY;
 -      *strategy_parameter = cacheline_size;
 -}
  #endif
  
  /* TODO: integrate with include/asm-generic/pci.h ? */
index a6d4ed042c709f6c4ec75ecf0ca0a7cac53a50a9,43d224685144a5032ecf7961168c0889429ef85a..e43d22c58ad52cc74d116291eef632508700460e
@@@ -14,7 -14,7 +14,7 @@@
  #define _ASM_FRV_PCI_H
  
  #include <linux/mm.h>
- #include <asm/scatterlist.h>
+ #include <linux/scatterlist.h>
  #include <asm-generic/pci-dma-compat.h>
  #include <asm-generic/pci.h>
  
@@@ -41,6 -41,16 +41,6 @@@ extern void pci_free_consistent(struct 
  /* Return the index of the PCI controller for device PDEV. */
  #define pci_controller_num(PDEV)      (0)
  
 -#ifdef CONFIG_PCI
 -static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 -                                      enum pci_dma_burst_strategy *strat,
 -                                      unsigned long *strategy_parameter)
 -{
 -      *strat = PCI_DMA_BURST_INFINITY;
 -      *strategy_parameter = ~0UL;
 -}
 -#endif
 -
  /*
   *    These are pretty much arbitrary with the CoMEM implementation.
   *    We have the whole address space to ourselves.
index b897fae1f0ca88d96a3b1e06ea906969ffac76d8,0c0e25d6427a196a9fe9aadd40d02ae973b83c47..36d2c1e3928bc744eb2d66eeb18aa7291969eab5
@@@ -6,9 -6,9 +6,9 @@@
  #include <linux/spinlock.h>
  #include <linux/string.h>
  #include <linux/types.h>
+ #include <linux/scatterlist.h>
  
  #include <asm/io.h>
- #include <asm/scatterlist.h>
  #include <asm/hw_irq.h>
  
  struct pci_vector_struct {
@@@ -52,6 -52,25 +52,6 @@@ extern unsigned long ia64_max_iommu_mer
  
  #include <asm-generic/pci-dma-compat.h>
  
 -#ifdef CONFIG_PCI
 -static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 -                                      enum pci_dma_burst_strategy *strat,
 -                                      unsigned long *strategy_parameter)
 -{
 -      unsigned long cacheline_size;
 -      u8 byte;
 -
 -      pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &byte);
 -      if (byte == 0)
 -              cacheline_size = 1024;
 -      else
 -              cacheline_size = (int) byte * 4;
 -
 -      *strat = PCI_DMA_BURST_MULTIPLE;
 -      *strategy_parameter = cacheline_size;
 -}
 -#endif
 -
  #define HAVE_PCI_MMAP
  extern int pci_mmap_page_range (struct pci_dev *dev, struct vm_area_struct *vma,
                                enum pci_mmap_state mmap_state, int write_combine);
@@@ -89,6 -108,19 +89,6 @@@ static inline int pci_proc_domain(struc
        return (pci_domain_nr(bus) != 0);
  }
  
 -static inline struct resource *
 -pcibios_select_root(struct pci_dev *pdev, struct resource *res)
 -{
 -      struct resource *root = NULL;
 -
 -      if (res->flags & IORESOURCE_IO)
 -              root = &ioport_resource;
 -      if (res->flags & IORESOURCE_MEM)
 -              root = &iomem_resource;
 -
 -      return root;
 -}
 -
  #define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
  static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
  {
index b42ed684b94594bcfd7b8382e1161a65433ab22a,81f27aef979c48ed2bb632ff0928e28c3a487436..dc9eb6657e3a4a8e0763e3afabe0284bbd9bbbb2
@@@ -16,8 -16,8 +16,8 @@@
  #include <linux/string.h>
  #include <linux/dma-mapping.h>
  #include <linux/pci.h>
+ #include <linux/scatterlist.h>
  
- #include <asm/scatterlist.h>
  #include <asm/io.h>
  #include <asm/prom.h>
  #include <asm/pci-bridge.h>
@@@ -27,6 -27,8 +27,6 @@@
  #define PCIBIOS_MIN_IO                0x1000
  #define PCIBIOS_MIN_MEM               0x10000000
  
 -struct pci_dev;
 -
  /* Values for the `which' argument to sys_pciconfig_iobase syscall.  */
  #define IOBASE_BRIDGE_NUMBER  0
  #define IOBASE_MEMORY         1
   */
  #define pcibios_assign_all_busses()   0
  
 -#ifdef CONFIG_PCI
 -static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 -                                      enum pci_dma_burst_strategy *strat,
 -                                      unsigned long *strategy_parameter)
 -{
 -      *strat = PCI_DMA_BURST_INFINITY;
 -      *strategy_parameter = ~0UL;
 -}
 -#endif
 -
  extern int pci_domain_nr(struct pci_bus *bus);
  
  /* Decide whether to display the domain number in /proc */
@@@ -71,12 -83,40 +71,12 @@@ extern int pci_mmap_legacy_page_range(s
   */
  #define PCI_DMA_BUS_IS_PHYS     (1)
  
 -static inline struct resource *pcibios_select_root(struct pci_dev *pdev,
 -                      struct resource *res)
 -{
 -      struct resource *root = NULL;
 -
 -      if (res->flags & IORESOURCE_IO)
 -              root = &ioport_resource;
 -      if (res->flags & IORESOURCE_MEM)
 -              root = &iomem_resource;
 -
 -      return root;
 -}
 -
  extern void pcibios_claim_one_bus(struct pci_bus *b);
  
  extern void pcibios_finish_adding_to_bus(struct pci_bus *bus);
  
  extern void pcibios_resource_survey(void);
  
 -extern struct pci_controller *init_phb_dynamic(struct device_node *dn);
 -extern int remove_phb_dynamic(struct pci_controller *phb);
 -
 -extern struct pci_dev *of_create_pci_dev(struct device_node *node,
 -                                      struct pci_bus *bus, int devfn);
 -
 -extern void of_scan_pci_bridge(struct device_node *node,
 -                              struct pci_dev *dev);
 -
 -extern void of_scan_bus(struct device_node *node, struct pci_bus *bus);
 -extern void of_rescan_bus(struct device_node *node, struct pci_bus *bus);
 -
 -extern int pci_bus_find_capability(struct pci_bus *bus,
 -                                              unsigned int devfn, int cap);
 -
  struct file;
  extern pgprot_t       pci_phys_mem_access_prot(struct file *file,
                                         unsigned long pfn,
index 70dcc5498128b5e918d8c57496eafa09e8c1071f,3413b10d833bc96a3d1a11a377a6af71c50428b0..98c31e5d95793c68b50d594a5152bd0c2a730c82
@@@ -99,7 -99,7 +99,7 @@@ static inline void pci_resource_to_user
  
  #include <linux/types.h>
  #include <linux/slab.h>
- #include <asm/scatterlist.h>
+ #include <linux/scatterlist.h>
  #include <linux/string.h>
  #include <asm/io.h>
  #include <asm-generic/pci-bridge.h>
@@@ -113,6 -113,16 +113,6 @@@ struct pci_dev
   */
  extern unsigned int PCI_DMA_BUS_IS_PHYS;
  
 -#ifdef CONFIG_PCI
 -static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 -                                      enum pci_dma_burst_strategy *strat,
 -                                      unsigned long *strategy_parameter)
 -{
 -      *strat = PCI_DMA_BURST_INFINITY;
 -      *strategy_parameter = ~0UL;
 -}
 -#endif
 -
  #ifdef CONFIG_PCI_DOMAINS
  #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
  
index c222d1792d5b57681b37f3188d287237a90b74fd,393b51d38f36182d3b7577d9cdfe3daf935697c3..be3debb8fc02b1a1befbe6230249a6733aa98cfb
@@@ -55,7 -55,7 +55,7 @@@ void pcibios_set_master(struct pci_dev 
  
  #include <linux/types.h>
  #include <linux/slab.h>
- #include <asm/scatterlist.h>
+ #include <linux/scatterlist.h>
  #include <linux/string.h>
  #include <asm/io.h>
  
@@@ -83,6 -83,19 +83,6 @@@ extern int pci_mmap_page_range(struct p
  /* implement the pci_ DMA API in terms of the generic device dma_ one */
  #include <asm-generic/pci-dma-compat.h>
  
 -static inline struct resource *
 -pcibios_select_root(struct pci_dev *pdev, struct resource *res)
 -{
 -      struct resource *root = NULL;
 -
 -      if (res->flags & IORESOURCE_IO)
 -              root = &ioport_resource;
 -      if (res->flags & IORESOURCE_MEM)
 -              root = &iomem_resource;
 -
 -      return root;
 -}
 -
  static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
  {
        return channel ? 15 : 14;
index bf5e044281d693a53a2f008ae7654750fd5b1060,794d8820db5d7738dd0fd78889f7cb99f8f35244..71889ea7274035a229495f31e6a81ab520261e2d
@@@ -1,7 -1,7 +1,7 @@@
  #ifndef __ASM_PARISC_PCI_H
  #define __ASM_PARISC_PCI_H
  
- #include <asm/scatterlist.h>
+ #include <linux/scatterlist.h>
  
  
  
@@@ -196,6 -196,25 +196,6 @@@ static inline void pcibios_register_hba
  /* export the pci_ DMA API in terms of the dma_ one */
  #include <asm-generic/pci-dma-compat.h>
  
 -#ifdef CONFIG_PCI
 -static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 -                                      enum pci_dma_burst_strategy *strat,
 -                                      unsigned long *strategy_parameter)
 -{
 -      unsigned long cacheline_size;
 -      u8 byte;
 -
 -      pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &byte);
 -      if (byte == 0)
 -              cacheline_size = 1024;
 -      else
 -              cacheline_size = (int) byte * 4;
 -
 -      *strat = PCI_DMA_BURST_MULTIPLE;
 -      *strategy_parameter = cacheline_size;
 -}
 -#endif
 -
  static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
  {
        return channel ? 15 : 14;
index 99dc432b256ae1899a7b8238602fc1996af63a6d,3be43ab63181c299558b395c85ee988b201b3940..3453bd8dc18f32be59f81751d20f012e2b2480bc
@@@ -13,9 -13,9 +13,9 @@@
  #include <linux/slab.h>
  #include <linux/string.h>
  #include <linux/dma-mapping.h>
+ #include <linux/scatterlist.h>
  
  #include <asm/machdep.h>
- #include <asm/scatterlist.h>
  #include <asm/io.h>
  #include <asm/prom.h>
  #include <asm/pci-bridge.h>
@@@ -71,6 -71,36 +71,6 @@@ extern struct dma_map_ops *get_pci_dma_
   */
  #define PCI_DISABLE_MWI
  
 -#ifdef CONFIG_PCI
 -static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 -                                      enum pci_dma_burst_strategy *strat,
 -                                      unsigned long *strategy_parameter)
 -{
 -      unsigned long cacheline_size;
 -      u8 byte;
 -
 -      pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &byte);
 -      if (byte == 0)
 -              cacheline_size = 1024;
 -      else
 -              cacheline_size = (int) byte * 4;
 -
 -      *strat = PCI_DMA_BURST_MULTIPLE;
 -      *strategy_parameter = cacheline_size;
 -}
 -#endif
 -
 -#else /* 32-bit */
 -
 -#ifdef CONFIG_PCI
 -static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 -                                      enum pci_dma_burst_strategy *strat,
 -                                      unsigned long *strategy_parameter)
 -{
 -      *strat = PCI_DMA_BURST_INFINITY;
 -      *strategy_parameter = ~0UL;
 -}
 -#endif
  #endif /* CONFIG_PPC64 */
  
  extern int pci_domain_nr(struct pci_bus *bus);
index b962e0fe565852d4c8214d6ed891664bce0ebb5a,81da003df21b08ffd5b9c2fddf7f99f840c27538..462594320d39a93b835dde080d1b7ae9f9e9819a
@@@ -5,7 -5,7 +5,7 @@@
  #include <linux/types.h>
  #include <linux/slab.h>
  #include <linux/string.h>
- #include <asm/scatterlist.h>
+ #include <linux/scatterlist.h>
  #include <asm/io.h>
  #include <asm/x86_init.h>
  
@@@ -80,6 -80,13 +80,6 @@@ extern int pci_mmap_page_range(struct p
  
  #ifdef CONFIG_PCI
  extern void early_quirks(void);
 -static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 -                                      enum pci_dma_burst_strategy *strat,
 -                                      unsigned long *strategy_parameter)
 -{
 -      *strat = PCI_DMA_BURST_INFINITY;
 -      *strategy_parameter = ~0UL;
 -}
  #else
  static inline void early_quirks(void) { }
  #endif
@@@ -89,10 -96,15 +89,10 @@@ extern void pci_iommu_alloc(void)
  #ifdef CONFIG_PCI_MSI
  /* implemented in arch/x86/kernel/apic/io_apic. */
  struct msi_desc;
 -void native_compose_msi_msg(struct pci_dev *pdev, unsigned int irq,
 -                          unsigned int dest, struct msi_msg *msg, u8 hpet_id);
  int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
  void native_teardown_msi_irq(unsigned int irq);
  void native_restore_msi_irqs(struct pci_dev *dev);
 -int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc,
 -                unsigned int irq_base, unsigned int irq_offset);
  #else
 -#define native_compose_msi_msg                NULL
  #define native_setup_msi_irqs         NULL
  #define native_teardown_msi_irq               NULL
  #endif
diff --combined include/linux/blkdev.h
index a6ae5f9bee495d03ecbf03ddac145a96abe852ff,504af1e65ce12aaef8c02d0b10db4974a9eaf3bd..5ced29cef03f7b01819019e7c34cbbc1b2b549a5
  #include <linux/smp.h>
  #include <linux/rcupdate.h>
  #include <linux/percpu-refcount.h>
- #include <asm/scatterlist.h>
+ #include <linux/scatterlist.h>
  
  struct module;
  struct scsi_ioctl_command;
  
  struct request_queue;
  struct elevator_queue;
 -struct request_pm_state;
  struct blk_trace;
  struct request;
  struct sg_io_hdr;
@@@ -74,7 -74,18 +73,7 @@@ struct request_list 
  enum rq_cmd_type_bits {
        REQ_TYPE_FS             = 1,    /* fs request */
        REQ_TYPE_BLOCK_PC,              /* scsi command */
 -      REQ_TYPE_SENSE,                 /* sense request */
 -      REQ_TYPE_PM_SUSPEND,            /* suspend request */
 -      REQ_TYPE_PM_RESUME,             /* resume request */
 -      REQ_TYPE_PM_SHUTDOWN,           /* shutdown request */
 -      REQ_TYPE_SPECIAL,               /* driver defined type */
 -      /*
 -       * for ATA/ATAPI devices. this really doesn't belong here, ide should
 -       * use REQ_TYPE_SPECIAL and use rq->cmd[0] with the range of driver
 -       * private REQ_LB opcodes to differentiate what type of request this is
 -       */
 -      REQ_TYPE_ATA_TASKFILE,
 -      REQ_TYPE_ATA_PC,
 +      REQ_TYPE_DRV_PRIV,              /* driver defined types from here */
  };
  
  #define BLK_MAX_CDB   16
@@@ -96,7 -107,7 +95,7 @@@ struct request 
        struct blk_mq_ctx *mq_ctx;
  
        u64 cmd_flags;
 -      enum rq_cmd_type_bits cmd_type;
 +      unsigned cmd_type;
        unsigned long atomic_flags;
  
        int cpu;
@@@ -204,6 -215,19 +203,6 @@@ static inline unsigned short req_get_io
        return req->ioprio;
  }
  
 -/*
 - * State information carried for REQ_TYPE_PM_SUSPEND and REQ_TYPE_PM_RESUME
 - * requests. Some step values could eventually be made generic.
 - */
 -struct request_pm_state
 -{
 -      /* PM state machine step value, currently driver specific */
 -      int     pm_step;
 -      /* requested PM state value (S1, S2, S3, S4, ...) */
 -      u32     pm_state;
 -      void*   data;           /* for driver use */
 -};
 -
  #include <linux/elevator.h>
  
  struct blk_queue_ctx;
@@@ -444,7 -468,7 +443,7 @@@ struct request_queue 
        struct mutex            sysfs_lock;
  
        int                     bypass_depth;
 -      int                     mq_freeze_depth;
 +      atomic_t                mq_freeze_depth;
  
  #if defined(CONFIG_BLK_DEV_BSG)
        bsg_job_fn              *bsg_job_fn;
@@@ -585,6 -609,10 +584,6 @@@ static inline void queue_flag_clear(uns
        (((rq)->cmd_flags & REQ_STARTED) && \
         ((rq)->cmd_type == REQ_TYPE_FS))
  
 -#define blk_pm_request(rq)    \
 -      ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND || \
 -       (rq)->cmd_type == REQ_TYPE_PM_RESUME)
 -
  #define blk_rq_cpu_valid(rq)  ((rq)->cpu != -1)
  #define blk_bidi_rq(rq)               ((rq)->next_rq != NULL)
  /* rq->queuelist of dequeued request must be list_empty() */
@@@ -775,7 -803,11 +774,7 @@@ extern void blk_add_request_payload(str
                unsigned int len);
  extern int blk_rq_check_limits(struct request_queue *q, struct request *rq);
  extern int blk_lld_busy(struct request_queue *q);
 -extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
 -                           struct bio_set *bs, gfp_t gfp_mask,
 -                           int (*bio_ctr)(struct bio *, struct bio *, void *),
 -                           void *data);
 -extern void blk_rq_unprep_clone(struct request *rq);
 +extern void blk_rq_prep_clone(struct request *rq, struct request *rq_src);
  extern int blk_insert_cloned_request(struct request_queue *q,
                                     struct request *rq);
  extern void blk_delay_queue(struct request_queue *, unsigned long);
@@@ -788,6 -820,8 +787,6 @@@ extern int scsi_cmd_ioctl(struct reques
  extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t,
                         struct scsi_ioctl_command __user *);
  
 -extern void blk_queue_bio(struct request_queue *q, struct bio *bio);
 -
  /*
   * A queue has just exitted congestion.  Note this in the global counter of
   * congested queues, and wake up anyone who was waiting for requests to be
@@@ -812,7 -846,6 +811,7 @@@ extern void blk_stop_queue(struct reque
  extern void blk_sync_queue(struct request_queue *q);
  extern void __blk_stop_queue(struct request_queue *q);
  extern void __blk_run_queue(struct request_queue *q);
 +extern void __blk_run_queue_uncond(struct request_queue *q);
  extern void blk_run_queue(struct request_queue *);
  extern void blk_run_queue_async(struct request_queue *q);
  extern int blk_rq_map_user(struct request_queue *, struct request *,
@@@ -901,7 -934,7 +900,7 @@@ static inline unsigned int blk_rq_get_m
        if (unlikely(rq->cmd_type == REQ_TYPE_BLOCK_PC))
                return q->limits.max_hw_sectors;
  
 -      if (!q->limits.chunk_sectors)
 +      if (!q->limits.chunk_sectors || (rq->cmd_flags & REQ_DISCARD))
                return blk_queue_get_max_sectors(q, rq->cmd_flags);
  
        return min(blk_max_size_offset(q, blk_rq_pos(rq)),
@@@ -1022,7 -1055,6 +1021,7 @@@ bool __must_check blk_get_queue(struct 
  struct request_queue *blk_alloc_queue(gfp_t);
  struct request_queue *blk_alloc_queue_node(gfp_t, int);
  extern void blk_put_queue(struct request_queue *);
 +extern void blk_set_queue_dying(struct request_queue *);
  
  /*
   * block layer runtime pm functions
index a0edb992c9c31a76bf314eb6f443c24c230083ce,eca1ec93775c658b5eac3a0685337bf8e82eb754..50a8486c524bb29491bd4540afa4781596abdfdd
@@@ -2,13 -2,39 +2,39 @@@
  #define _LINUX_SCATTERLIST_H
  
  #include <linux/string.h>
+ #include <linux/types.h>
  #include <linux/bug.h>
  #include <linux/mm.h>
- #include <asm/types.h>
- #include <asm/scatterlist.h>
  #include <asm/io.h>
  
+ struct scatterlist {
+ #ifdef CONFIG_DEBUG_SG
+       unsigned long   sg_magic;
+ #endif
+       unsigned long   page_link;
+       unsigned int    offset;
+       unsigned int    length;
+       dma_addr_t      dma_address;
+ #ifdef CONFIG_NEED_SG_DMA_LENGTH
+       unsigned int    dma_length;
+ #endif
+ };
+ /*
+  * These macros should be used after a dma_map_sg call has been done
+  * to get bus addresses of each of the SG entries and their lengths.
+  * You should only work with the number of sg entries dma_map_sg
+  * returns, or alternatively stop on the first sg_dma_len(sg) which
+  * is 0.
+  */
+ #define sg_dma_address(sg)    ((sg)->dma_address)
+ #ifdef CONFIG_NEED_SG_DMA_LENGTH
+ #define sg_dma_len(sg)                ((sg)->dma_length)
+ #else
+ #define sg_dma_len(sg)                ((sg)->length)
+ #endif
  struct sg_table {
        struct scatterlist *sgl;        /* the list */
        unsigned int nents;             /* number of mapped entries */
  /*
   * Notes on SG table design.
   *
-  * Architectures must provide an unsigned long page_link field in the
-  * scatterlist struct. We use that to place the page pointer AND encode
-  * information about the sg table as well. The two lower bits are reserved
-  * for this information.
+  * We use the unsigned long page_link field in the scatterlist struct to place
+  * the page pointer AND encode information about the sg table as well. The two
+  * lower bits are reserved for this information.
   *
   * If bit 0 is set, then the page_link contains a pointer to the next sg
   * table list. Otherwise the next entry is at sg + 1.
@@@ -221,7 -246,6 +246,7 @@@ static inline void *sg_virt(struct scat
  }
  
  int sg_nents(struct scatterlist *sg);
 +int sg_nents_for_len(struct scatterlist *sg, u64 len);
  struct scatterlist *sg_next(struct scatterlist *);
  struct scatterlist *sg_last(struct scatterlist *s, unsigned int);
  void sg_init_table(struct scatterlist *, unsigned int);
diff --combined lib/swiotlb.c
index 42e192decbfd605dc4175cfbe9c93b260bbad8ef,341268841b310b309322388aa602905685d7cb37..76f29ecba8f404b7c63dc4b1d0887135ab7df48b
  #include <linux/ctype.h>
  #include <linux/highmem.h>
  #include <linux/gfp.h>
+ #include <linux/scatterlist.h>
  
  #include <asm/io.h>
  #include <asm/dma.h>
- #include <asm/scatterlist.h>
  
  #include <linux/init.h>
  #include <linux/bootmem.h>
@@@ -537,9 -537,8 +537,9 @@@ EXPORT_SYMBOL_GPL(swiotlb_tbl_map_singl
   * Allocates bounce buffer and returns its kernel virtual address.
   */
  
 -phys_addr_t map_single(struct device *hwdev, phys_addr_t phys, size_t size,
 -                     enum dma_data_direction dir)
 +static phys_addr_t
 +map_single(struct device *hwdev, phys_addr_t phys, size_t size,
 +         enum dma_data_direction dir)
  {
        dma_addr_t start_dma_addr = phys_to_dma(hwdev, io_tlb_start);
  
@@@ -656,7 -655,7 +656,7 @@@ swiotlb_alloc_coherent(struct device *h
                 */
                phys_addr_t paddr = map_single(hwdev, 0, size, DMA_FROM_DEVICE);
                if (paddr == SWIOTLB_MAP_ERROR)
 -                      return NULL;
 +                      goto err_warn;
  
                ret = phys_to_virt(paddr);
                dev_addr = phys_to_dma(hwdev, paddr);
                        /* DMA_TO_DEVICE to avoid memcpy in unmap_single */
                        swiotlb_tbl_unmap_single(hwdev, paddr,
                                                 size, DMA_TO_DEVICE);
 -                      return NULL;
 +                      goto err_warn;
                }
        }
  
        memset(ret, 0, size);
  
        return ret;
 +
 +err_warn:
 +      pr_warn("swiotlb: coherent allocation failed for device %s size=%zu\n",
 +              dev_name(hwdev), size);
 +      dump_stack();
 +
 +      return NULL;
  }
  EXPORT_SYMBOL(swiotlb_alloc_coherent);
  
This page took 0.128391 seconds and 4 git commands to generate.