diff options
Diffstat (limited to 'include/linux')
27 files changed, 1019 insertions, 437 deletions
diff --git a/include/linux/attribute_container.h b/include/linux/attribute_container.h index f5582332af04..574b201b99d8 100644 --- a/include/linux/attribute_container.h +++ b/include/linux/attribute_container.h | |||
@@ -37,7 +37,7 @@ attribute_container_set_no_classdevs(struct attribute_container *atc) | |||
37 | } | 37 | } |
38 | 38 | ||
39 | int attribute_container_register(struct attribute_container *cont); | 39 | int attribute_container_register(struct attribute_container *cont); |
40 | int attribute_container_unregister(struct attribute_container *cont); | 40 | int __must_check attribute_container_unregister(struct attribute_container *cont); |
41 | void attribute_container_create_device(struct device *dev, | 41 | void attribute_container_create_device(struct device *dev, |
42 | int (*fn)(struct attribute_container *, | 42 | int (*fn)(struct attribute_container *, |
43 | struct device *, | 43 | struct device *, |
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 85778a4b1209..35094479ca55 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
@@ -216,6 +216,7 @@ static inline void clocksource_calculate_interval(struct clocksource *c, | |||
216 | /* used to install a new clocksource */ | 216 | /* used to install a new clocksource */ |
217 | extern int clocksource_register(struct clocksource*); | 217 | extern int clocksource_register(struct clocksource*); |
218 | extern void clocksource_unregister(struct clocksource*); | 218 | extern void clocksource_unregister(struct clocksource*); |
219 | extern void clocksource_touch_watchdog(void); | ||
219 | extern struct clocksource* clocksource_get_next(void); | 220 | extern struct clocksource* clocksource_get_next(void); |
220 | extern void clocksource_change_rating(struct clocksource *cs, int rating); | 221 | extern void clocksource_change_rating(struct clocksource *cs, int rating); |
221 | extern void clocksource_resume(void); | 222 | extern void clocksource_resume(void); |
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 34d440698293..b4d84ed6187d 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
@@ -95,12 +95,17 @@ enum dma_transaction_type { | |||
95 | #define DMA_TX_TYPE_END (DMA_INTERRUPT + 1) | 95 | #define DMA_TX_TYPE_END (DMA_INTERRUPT + 1) |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * enum dma_prep_flags - DMA flags to augment operation preparation | 98 | * enum dma_ctrl_flags - DMA flags to augment operation preparation, |
99 | * control completion, and communicate status. | ||
99 | * @DMA_PREP_INTERRUPT - trigger an interrupt (callback) upon completion of | 100 | * @DMA_PREP_INTERRUPT - trigger an interrupt (callback) upon completion of |
100 | * this transaction | 101 | * this transaction |
102 | * @DMA_CTRL_ACK - the descriptor cannot be reused until the client | ||
103 | * acknowledges receipt, i.e. has has a chance to establish any | ||
104 | * dependency chains | ||
101 | */ | 105 | */ |
102 | enum dma_prep_flags { | 106 | enum dma_ctrl_flags { |
103 | DMA_PREP_INTERRUPT = (1 << 0), | 107 | DMA_PREP_INTERRUPT = (1 << 0), |
108 | DMA_CTRL_ACK = (1 << 1), | ||
104 | }; | 109 | }; |
105 | 110 | ||
106 | /** | 111 | /** |
@@ -211,8 +216,8 @@ typedef void (*dma_async_tx_callback)(void *dma_async_param); | |||
211 | * ---dma generic offload fields--- | 216 | * ---dma generic offload fields--- |
212 | * @cookie: tracking cookie for this transaction, set to -EBUSY if | 217 | * @cookie: tracking cookie for this transaction, set to -EBUSY if |
213 | * this tx is sitting on a dependency list | 218 | * this tx is sitting on a dependency list |
214 | * @ack: the descriptor can not be reused until the client acknowledges | 219 | * @flags: flags to augment operation preparation, control completion, and |
215 | * receipt, i.e. has has a chance to establish any dependency chains | 220 | * communicate status |
216 | * @phys: physical address of the descriptor | 221 | * @phys: physical address of the descriptor |
217 | * @tx_list: driver common field for operations that require multiple | 222 | * @tx_list: driver common field for operations that require multiple |
218 | * descriptors | 223 | * descriptors |
@@ -221,23 +226,20 @@ typedef void (*dma_async_tx_callback)(void *dma_async_param); | |||
221 | * @callback: routine to call after this operation is complete | 226 | * @callback: routine to call after this operation is complete |
222 | * @callback_param: general parameter to pass to the callback routine | 227 | * @callback_param: general parameter to pass to the callback routine |
223 | * ---async_tx api specific fields--- | 228 | * ---async_tx api specific fields--- |
224 | * @depend_list: at completion this list of transactions are submitted | 229 | * @next: at completion submit this descriptor |
225 | * @depend_node: allow this transaction to be executed after another | ||
226 | * transaction has completed, possibly on another channel | ||
227 | * @parent: pointer to the next level up in the dependency chain | 230 | * @parent: pointer to the next level up in the dependency chain |
228 | * @lock: protect the dependency list | 231 | * @lock: protect the parent and next pointers |
229 | */ | 232 | */ |
230 | struct dma_async_tx_descriptor { | 233 | struct dma_async_tx_descriptor { |
231 | dma_cookie_t cookie; | 234 | dma_cookie_t cookie; |
232 | int ack; | 235 | enum dma_ctrl_flags flags; /* not a 'long' to pack with cookie */ |
233 | dma_addr_t phys; | 236 | dma_addr_t phys; |
234 | struct list_head tx_list; | 237 | struct list_head tx_list; |
235 | struct dma_chan *chan; | 238 | struct dma_chan *chan; |
236 | dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx); | 239 | dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx); |
237 | dma_async_tx_callback callback; | 240 | dma_async_tx_callback callback; |
238 | void *callback_param; | 241 | void *callback_param; |
239 | struct list_head depend_list; | 242 | struct dma_async_tx_descriptor *next; |
240 | struct list_head depend_node; | ||
241 | struct dma_async_tx_descriptor *parent; | 243 | struct dma_async_tx_descriptor *parent; |
242 | spinlock_t lock; | 244 | spinlock_t lock; |
243 | }; | 245 | }; |
@@ -261,7 +263,6 @@ struct dma_async_tx_descriptor { | |||
261 | * @device_prep_dma_zero_sum: prepares a zero_sum operation | 263 | * @device_prep_dma_zero_sum: prepares a zero_sum operation |
262 | * @device_prep_dma_memset: prepares a memset operation | 264 | * @device_prep_dma_memset: prepares a memset operation |
263 | * @device_prep_dma_interrupt: prepares an end of chain interrupt operation | 265 | * @device_prep_dma_interrupt: prepares an end of chain interrupt operation |
264 | * @device_dependency_added: async_tx notifies the channel about new deps | ||
265 | * @device_issue_pending: push pending transactions to hardware | 266 | * @device_issue_pending: push pending transactions to hardware |
266 | */ | 267 | */ |
267 | struct dma_device { | 268 | struct dma_device { |
@@ -294,9 +295,8 @@ struct dma_device { | |||
294 | struct dma_chan *chan, dma_addr_t dest, int value, size_t len, | 295 | struct dma_chan *chan, dma_addr_t dest, int value, size_t len, |
295 | unsigned long flags); | 296 | unsigned long flags); |
296 | struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)( | 297 | struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)( |
297 | struct dma_chan *chan); | 298 | struct dma_chan *chan, unsigned long flags); |
298 | 299 | ||
299 | void (*device_dependency_added)(struct dma_chan *chan); | ||
300 | enum dma_status (*device_is_tx_complete)(struct dma_chan *chan, | 300 | enum dma_status (*device_is_tx_complete)(struct dma_chan *chan, |
301 | dma_cookie_t cookie, dma_cookie_t *last, | 301 | dma_cookie_t cookie, dma_cookie_t *last, |
302 | dma_cookie_t *used); | 302 | dma_cookie_t *used); |
@@ -321,7 +321,13 @@ void dma_async_tx_descriptor_init(struct dma_async_tx_descriptor *tx, | |||
321 | static inline void | 321 | static inline void |
322 | async_tx_ack(struct dma_async_tx_descriptor *tx) | 322 | async_tx_ack(struct dma_async_tx_descriptor *tx) |
323 | { | 323 | { |
324 | tx->ack = 1; | 324 | tx->flags |= DMA_CTRL_ACK; |
325 | } | ||
326 | |||
327 | static inline int | ||
328 | async_tx_test_ack(struct dma_async_tx_descriptor *tx) | ||
329 | { | ||
330 | return tx->flags & DMA_CTRL_ACK; | ||
325 | } | 331 | } |
326 | 332 | ||
327 | #define first_dma_cap(mask) __first_dma_cap(&(mask)) | 333 | #define first_dma_cap(mask) __first_dma_cap(&(mask)) |
diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h index e38e75967e74..c37e9241fae7 100644 --- a/include/linux/hdreg.h +++ b/include/linux/hdreg.h | |||
@@ -422,9 +422,11 @@ struct hd_geometry { | |||
422 | #define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ | 422 | #define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ |
423 | #define HDIO_SET_DMA 0x0326 /* change use-dma flag */ | 423 | #define HDIO_SET_DMA 0x0326 /* change use-dma flag */ |
424 | #define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ | 424 | #define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ |
425 | #ifndef __KERNEL__ | ||
425 | #define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */ | 426 | #define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */ |
426 | #define HDIO_SET_NICE 0x0329 /* set nice flags */ | ||
427 | #define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */ | 427 | #define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */ |
428 | #endif | ||
429 | #define HDIO_SET_NICE 0x0329 /* set nice flags */ | ||
428 | #define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */ | 430 | #define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */ |
429 | #define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */ | 431 | #define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */ |
430 | #define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */ | 432 | #define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */ |
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 1ad56a7b2f74..56f3236da829 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
@@ -173,7 +173,6 @@ struct hrtimer_clock_base { | |||
173 | * struct hrtimer_cpu_base - the per cpu clock bases | 173 | * struct hrtimer_cpu_base - the per cpu clock bases |
174 | * @lock: lock protecting the base and associated clock bases | 174 | * @lock: lock protecting the base and associated clock bases |
175 | * and timers | 175 | * and timers |
176 | * @lock_key: the lock_class_key for use with lockdep | ||
177 | * @clock_base: array of clock bases for this cpu | 176 | * @clock_base: array of clock bases for this cpu |
178 | * @curr_timer: the timer which is executing a callback right now | 177 | * @curr_timer: the timer which is executing a callback right now |
179 | * @expires_next: absolute time of the next event which was scheduled | 178 | * @expires_next: absolute time of the next event which was scheduled |
@@ -189,7 +188,6 @@ struct hrtimer_clock_base { | |||
189 | */ | 188 | */ |
190 | struct hrtimer_cpu_base { | 189 | struct hrtimer_cpu_base { |
191 | spinlock_t lock; | 190 | spinlock_t lock; |
192 | struct lock_class_key lock_key; | ||
193 | struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; | 191 | struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; |
194 | struct list_head cb_pending; | 192 | struct list_head cb_pending; |
195 | #ifdef CONFIG_HIGH_RES_TIMERS | 193 | #ifdef CONFIG_HIGH_RES_TIMERS |
diff --git a/include/linux/ide.h b/include/linux/ide.h index bc26b2f27359..6c39482fd1a1 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -82,24 +82,10 @@ typedef unsigned char byte; /* used everywhere */ | |||
82 | 82 | ||
83 | #define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET | 83 | #define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET |
84 | #define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET | 84 | #define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET |
85 | 85 | #define IDE_ALTSTATUS_OFFSET IDE_CONTROL_OFFSET | |
86 | #define IDE_DATA_REG (HWIF(drive)->io_ports[IDE_DATA_OFFSET]) | 86 | #define IDE_IREASON_OFFSET IDE_NSECTOR_OFFSET |
87 | #define IDE_ERROR_REG (HWIF(drive)->io_ports[IDE_ERROR_OFFSET]) | 87 | #define IDE_BCOUNTL_OFFSET IDE_LCYL_OFFSET |
88 | #define IDE_NSECTOR_REG (HWIF(drive)->io_ports[IDE_NSECTOR_OFFSET]) | 88 | #define IDE_BCOUNTH_OFFSET IDE_HCYL_OFFSET |
89 | #define IDE_SECTOR_REG (HWIF(drive)->io_ports[IDE_SECTOR_OFFSET]) | ||
90 | #define IDE_LCYL_REG (HWIF(drive)->io_ports[IDE_LCYL_OFFSET]) | ||
91 | #define IDE_HCYL_REG (HWIF(drive)->io_ports[IDE_HCYL_OFFSET]) | ||
92 | #define IDE_SELECT_REG (HWIF(drive)->io_ports[IDE_SELECT_OFFSET]) | ||
93 | #define IDE_STATUS_REG (HWIF(drive)->io_ports[IDE_STATUS_OFFSET]) | ||
94 | #define IDE_CONTROL_REG (HWIF(drive)->io_ports[IDE_CONTROL_OFFSET]) | ||
95 | #define IDE_IRQ_REG (HWIF(drive)->io_ports[IDE_IRQ_OFFSET]) | ||
96 | |||
97 | #define IDE_FEATURE_REG IDE_ERROR_REG | ||
98 | #define IDE_COMMAND_REG IDE_STATUS_REG | ||
99 | #define IDE_ALTSTATUS_REG IDE_CONTROL_REG | ||
100 | #define IDE_IREASON_REG IDE_NSECTOR_REG | ||
101 | #define IDE_BCOUNTL_REG IDE_LCYL_REG | ||
102 | #define IDE_BCOUNTH_REG IDE_HCYL_REG | ||
103 | 89 | ||
104 | #define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good)) | 90 | #define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good)) |
105 | #define BAD_R_STAT (BUSY_STAT | ERR_STAT) | 91 | #define BAD_R_STAT (BUSY_STAT | ERR_STAT) |
@@ -169,7 +155,7 @@ enum { ide_unknown, ide_generic, ide_pci, | |||
169 | ide_rz1000, ide_trm290, | 155 | ide_rz1000, ide_trm290, |
170 | ide_cmd646, ide_cy82c693, ide_4drives, | 156 | ide_cmd646, ide_cy82c693, ide_4drives, |
171 | ide_pmac, ide_etrax100, ide_acorn, | 157 | ide_pmac, ide_etrax100, ide_acorn, |
172 | ide_au1xxx, ide_palm3710, ide_forced | 158 | ide_au1xxx, ide_palm3710 |
173 | }; | 159 | }; |
174 | 160 | ||
175 | typedef u8 hwif_chipset_t; | 161 | typedef u8 hwif_chipset_t; |
@@ -186,14 +172,9 @@ typedef struct hw_regs_s { | |||
186 | } hw_regs_t; | 172 | } hw_regs_t; |
187 | 173 | ||
188 | struct hwif_s * ide_find_port(unsigned long); | 174 | struct hwif_s * ide_find_port(unsigned long); |
189 | struct hwif_s *ide_deprecated_find_port(unsigned long); | ||
190 | void ide_init_port_data(struct hwif_s *, unsigned int); | 175 | void ide_init_port_data(struct hwif_s *, unsigned int); |
191 | void ide_init_port_hw(struct hwif_s *, hw_regs_t *); | 176 | void ide_init_port_hw(struct hwif_s *, hw_regs_t *); |
192 | 177 | ||
193 | struct ide_drive_s; | ||
194 | int ide_register_hw(hw_regs_t *, void (*)(struct ide_drive_s *), | ||
195 | struct hwif_s **); | ||
196 | |||
197 | static inline void ide_std_init_ports(hw_regs_t *hw, | 178 | static inline void ide_std_init_ports(hw_regs_t *hw, |
198 | unsigned long io_addr, | 179 | unsigned long io_addr, |
199 | unsigned long ctl_addr) | 180 | unsigned long ctl_addr) |
@@ -213,45 +194,6 @@ static inline void ide_std_init_ports(hw_regs_t *hw, | |||
213 | #define MAX_HWIFS CONFIG_IDE_MAX_HWIFS | 194 | #define MAX_HWIFS CONFIG_IDE_MAX_HWIFS |
214 | #endif | 195 | #endif |
215 | 196 | ||
216 | /* needed on alpha, x86/x86_64, ia64, mips, ppc32 and sh */ | ||
217 | #ifndef IDE_ARCH_OBSOLETE_DEFAULTS | ||
218 | # define ide_default_io_base(index) (0) | ||
219 | # define ide_default_irq(base) (0) | ||
220 | # define ide_init_default_irq(base) (0) | ||
221 | #endif | ||
222 | |||
223 | #ifdef CONFIG_IDE_ARCH_OBSOLETE_INIT | ||
224 | static inline void ide_init_hwif_ports(hw_regs_t *hw, | ||
225 | unsigned long io_addr, | ||
226 | unsigned long ctl_addr, | ||
227 | int *irq) | ||
228 | { | ||
229 | if (!ctl_addr) | ||
230 | ide_std_init_ports(hw, io_addr, ide_default_io_ctl(io_addr)); | ||
231 | else | ||
232 | ide_std_init_ports(hw, io_addr, ctl_addr); | ||
233 | |||
234 | if (irq) | ||
235 | *irq = 0; | ||
236 | |||
237 | hw->io_ports[IDE_IRQ_OFFSET] = 0; | ||
238 | |||
239 | #ifdef CONFIG_PPC32 | ||
240 | if (ppc_ide_md.ide_init_hwif) | ||
241 | ppc_ide_md.ide_init_hwif(hw, io_addr, ctl_addr, irq); | ||
242 | #endif | ||
243 | } | ||
244 | #else | ||
245 | static inline void ide_init_hwif_ports(hw_regs_t *hw, | ||
246 | unsigned long io_addr, | ||
247 | unsigned long ctl_addr, | ||
248 | int *irq) | ||
249 | { | ||
250 | if (io_addr || ctl_addr) | ||
251 | printk(KERN_WARNING "%s: must not be called\n", __FUNCTION__); | ||
252 | } | ||
253 | #endif /* CONFIG_IDE_ARCH_OBSOLETE_INIT */ | ||
254 | |||
255 | /* Currently only m68k, apus and m8xx need it */ | 197 | /* Currently only m68k, apus and m8xx need it */ |
256 | #ifndef IDE_ARCH_ACK_INTR | 198 | #ifndef IDE_ARCH_ACK_INTR |
257 | # define ide_ack_intr(hwif) (1) | 199 | # define ide_ack_intr(hwif) (1) |
@@ -406,7 +348,7 @@ typedef struct ide_drive_s { | |||
406 | u8 wcache; /* status of write cache */ | 348 | u8 wcache; /* status of write cache */ |
407 | u8 acoustic; /* acoustic management */ | 349 | u8 acoustic; /* acoustic management */ |
408 | u8 media; /* disk, cdrom, tape, floppy, ... */ | 350 | u8 media; /* disk, cdrom, tape, floppy, ... */ |
409 | u8 ctl; /* "normal" value for IDE_CONTROL_REG */ | 351 | u8 ctl; /* "normal" value for Control register */ |
410 | u8 ready_stat; /* min status value for drive ready */ | 352 | u8 ready_stat; /* min status value for drive ready */ |
411 | u8 mult_count; /* current multiple sector setting */ | 353 | u8 mult_count; /* current multiple sector setting */ |
412 | u8 mult_req; /* requested multiple sector setting */ | 354 | u8 mult_req; /* requested multiple sector setting */ |
@@ -507,8 +449,6 @@ typedef struct hwif_s { | |||
507 | void (*maskproc)(ide_drive_t *, int); | 449 | void (*maskproc)(ide_drive_t *, int); |
508 | /* check host's drive quirk list */ | 450 | /* check host's drive quirk list */ |
509 | void (*quirkproc)(ide_drive_t *); | 451 | void (*quirkproc)(ide_drive_t *); |
510 | /* driver soft-power interface */ | ||
511 | int (*busproc)(ide_drive_t *, int); | ||
512 | #endif | 452 | #endif |
513 | u8 (*mdma_filter)(ide_drive_t *); | 453 | u8 (*mdma_filter)(ide_drive_t *); |
514 | u8 (*udma_filter)(ide_drive_t *); | 454 | u8 (*udma_filter)(ide_drive_t *); |
@@ -578,7 +518,6 @@ typedef struct hwif_s { | |||
578 | 518 | ||
579 | unsigned noprobe : 1; /* don't probe for this interface */ | 519 | unsigned noprobe : 1; /* don't probe for this interface */ |
580 | unsigned present : 1; /* this interface exists */ | 520 | unsigned present : 1; /* this interface exists */ |
581 | unsigned hold : 1; /* this interface is always present */ | ||
582 | unsigned serialized : 1; /* serialized all channel operation */ | 521 | unsigned serialized : 1; /* serialized all channel operation */ |
583 | unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ | 522 | unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ |
584 | unsigned reset : 1; /* reset after probe */ | 523 | unsigned reset : 1; /* reset after probe */ |
@@ -586,7 +525,9 @@ typedef struct hwif_s { | |||
586 | unsigned mmio : 1; /* host uses MMIO */ | 525 | unsigned mmio : 1; /* host uses MMIO */ |
587 | unsigned straight8 : 1; /* Alan's straight 8 check */ | 526 | unsigned straight8 : 1; /* Alan's straight 8 check */ |
588 | 527 | ||
589 | struct device gendev; | 528 | struct device gendev; |
529 | struct device *portdev; | ||
530 | |||
590 | struct completion gendev_rel_comp; /* To deal with device release() */ | 531 | struct completion gendev_rel_comp; /* To deal with device release() */ |
591 | 532 | ||
592 | void *hwif_data; /* extra hwif data */ | 533 | void *hwif_data; /* extra hwif data */ |
@@ -647,6 +588,68 @@ int set_io_32bit(ide_drive_t *, int); | |||
647 | int set_pio_mode(ide_drive_t *, int); | 588 | int set_pio_mode(ide_drive_t *, int); |
648 | int set_using_dma(ide_drive_t *, int); | 589 | int set_using_dma(ide_drive_t *, int); |
649 | 590 | ||
591 | /* ATAPI packet command flags */ | ||
592 | enum { | ||
593 | /* set when an error is considered normal - no retry (ide-tape) */ | ||
594 | PC_FLAG_ABORT = (1 << 0), | ||
595 | PC_FLAG_SUPPRESS_ERROR = (1 << 1), | ||
596 | PC_FLAG_WAIT_FOR_DSC = (1 << 2), | ||
597 | PC_FLAG_DMA_OK = (1 << 3), | ||
598 | PC_FLAG_DMA_RECOMMENDED = (1 << 4), | ||
599 | PC_FLAG_DMA_IN_PROGRESS = (1 << 5), | ||
600 | PC_FLAG_DMA_ERROR = (1 << 6), | ||
601 | PC_FLAG_WRITING = (1 << 7), | ||
602 | /* command timed out */ | ||
603 | PC_FLAG_TIMEDOUT = (1 << 8), | ||
604 | }; | ||
605 | |||
606 | struct ide_atapi_pc { | ||
607 | /* actual packet bytes */ | ||
608 | u8 c[12]; | ||
609 | /* incremented on each retry */ | ||
610 | int retries; | ||
611 | int error; | ||
612 | |||
613 | /* bytes to transfer */ | ||
614 | int req_xfer; | ||
615 | /* bytes actually transferred */ | ||
616 | int xferred; | ||
617 | |||
618 | /* data buffer */ | ||
619 | u8 *buf; | ||
620 | /* current buffer position */ | ||
621 | u8 *cur_pos; | ||
622 | int buf_size; | ||
623 | /* missing/available data on the current buffer */ | ||
624 | int b_count; | ||
625 | |||
626 | /* the corresponding request */ | ||
627 | struct request *rq; | ||
628 | |||
629 | unsigned long flags; | ||
630 | |||
631 | /* | ||
632 | * those are more or less driver-specific and some of them are subject | ||
633 | * to change/removal later. | ||
634 | */ | ||
635 | u8 pc_buf[256]; | ||
636 | void (*idefloppy_callback) (ide_drive_t *); | ||
637 | ide_startstop_t (*idetape_callback) (ide_drive_t *); | ||
638 | |||
639 | /* idetape only */ | ||
640 | struct idetape_bh *bh; | ||
641 | char *b_data; | ||
642 | |||
643 | /* idescsi only for now */ | ||
644 | struct scatterlist *sg; | ||
645 | unsigned int sg_cnt; | ||
646 | |||
647 | struct scsi_cmnd *scsi_cmd; | ||
648 | void (*done) (struct scsi_cmnd *); | ||
649 | |||
650 | unsigned long timeout; | ||
651 | }; | ||
652 | |||
650 | #ifdef CONFIG_IDE_PROC_FS | 653 | #ifdef CONFIG_IDE_PROC_FS |
651 | /* | 654 | /* |
652 | * configurable drive settings | 655 | * configurable drive settings |
@@ -691,6 +694,7 @@ void proc_ide_create(void); | |||
691 | void proc_ide_destroy(void); | 694 | void proc_ide_destroy(void); |
692 | void ide_proc_register_port(ide_hwif_t *); | 695 | void ide_proc_register_port(ide_hwif_t *); |
693 | void ide_proc_port_register_devices(ide_hwif_t *); | 696 | void ide_proc_port_register_devices(ide_hwif_t *); |
697 | void ide_proc_unregister_device(ide_drive_t *); | ||
694 | void ide_proc_unregister_port(ide_hwif_t *); | 698 | void ide_proc_unregister_port(ide_hwif_t *); |
695 | void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); | 699 | void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); |
696 | void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); | 700 | void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); |
@@ -724,6 +728,7 @@ static inline void proc_ide_create(void) { ; } | |||
724 | static inline void proc_ide_destroy(void) { ; } | 728 | static inline void proc_ide_destroy(void) { ; } |
725 | static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; } | 729 | static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; } |
726 | static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; } | 730 | static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; } |
731 | static inline void ide_proc_unregister_device(ide_drive_t *drive) { ; } | ||
727 | static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } | 732 | static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } |
728 | static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } | 733 | static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } |
729 | static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } | 734 | static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } |
@@ -990,7 +995,6 @@ extern void do_ide_request(struct request_queue *); | |||
990 | void ide_init_disk(struct gendisk *, ide_drive_t *); | 995 | void ide_init_disk(struct gendisk *, ide_drive_t *); |
991 | 996 | ||
992 | #ifdef CONFIG_IDEPCI_PCIBUS_ORDER | 997 | #ifdef CONFIG_IDEPCI_PCIBUS_ORDER |
993 | extern int ide_scan_direction; | ||
994 | extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name); | 998 | extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name); |
995 | #define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME) | 999 | #define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME) |
996 | #else | 1000 | #else |
@@ -1195,7 +1199,7 @@ static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} | |||
1195 | void ide_remove_port_from_hwgroup(ide_hwif_t *); | 1199 | void ide_remove_port_from_hwgroup(ide_hwif_t *); |
1196 | extern int ide_hwif_request_regions(ide_hwif_t *hwif); | 1200 | extern int ide_hwif_request_regions(ide_hwif_t *hwif); |
1197 | extern void ide_hwif_release_regions(ide_hwif_t* hwif); | 1201 | extern void ide_hwif_release_regions(ide_hwif_t* hwif); |
1198 | void ide_unregister(unsigned int, int, int); | 1202 | void ide_unregister(unsigned int); |
1199 | 1203 | ||
1200 | void ide_register_region(struct gendisk *); | 1204 | void ide_register_region(struct gendisk *); |
1201 | void ide_unregister_region(struct gendisk *); | 1205 | void ide_unregister_region(struct gendisk *); |
@@ -1204,6 +1208,8 @@ void ide_undecoded_slave(ide_drive_t *); | |||
1204 | 1208 | ||
1205 | int ide_device_add_all(u8 *idx, const struct ide_port_info *); | 1209 | int ide_device_add_all(u8 *idx, const struct ide_port_info *); |
1206 | int ide_device_add(u8 idx[4], const struct ide_port_info *); | 1210 | int ide_device_add(u8 idx[4], const struct ide_port_info *); |
1211 | void ide_port_unregister_devices(ide_hwif_t *); | ||
1212 | void ide_port_scan(ide_hwif_t *); | ||
1207 | 1213 | ||
1208 | static inline void *ide_get_hwifdata (ide_hwif_t * hwif) | 1214 | static inline void *ide_get_hwifdata (ide_hwif_t * hwif) |
1209 | { | 1215 | { |
@@ -1279,6 +1285,7 @@ extern struct mutex ide_cfg_mtx; | |||
1279 | #define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0) | 1285 | #define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0) |
1280 | 1286 | ||
1281 | extern struct bus_type ide_bus_type; | 1287 | extern struct bus_type ide_bus_type; |
1288 | extern struct class *ide_port_class; | ||
1282 | 1289 | ||
1283 | /* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */ | 1290 | /* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */ |
1284 | #define ide_id_has_flush_cache(id) ((id)->cfs_enable_2 & 0x3000) | 1291 | #define ide_id_has_flush_cache(id) ((id)->cfs_enable_2 & 0x3000) |
@@ -1307,7 +1314,10 @@ static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive) | |||
1307 | 1314 | ||
1308 | static inline void ide_set_irq(ide_drive_t *drive, int on) | 1315 | static inline void ide_set_irq(ide_drive_t *drive, int on) |
1309 | { | 1316 | { |
1310 | drive->hwif->OUTB(drive->ctl | (on ? 0 : 2), IDE_CONTROL_REG); | 1317 | ide_hwif_t *hwif = drive->hwif; |
1318 | |||
1319 | hwif->OUTB(drive->ctl | (on ? 0 : 2), | ||
1320 | hwif->io_ports[IDE_CONTROL_OFFSET]); | ||
1311 | } | 1321 | } |
1312 | 1322 | ||
1313 | static inline u8 ide_read_status(ide_drive_t *drive) | 1323 | static inline u8 ide_read_status(ide_drive_t *drive) |
@@ -1331,4 +1341,26 @@ static inline u8 ide_read_error(ide_drive_t *drive) | |||
1331 | return hwif->INB(hwif->io_ports[IDE_ERROR_OFFSET]); | 1341 | return hwif->INB(hwif->io_ports[IDE_ERROR_OFFSET]); |
1332 | } | 1342 | } |
1333 | 1343 | ||
1344 | /* | ||
1345 | * Too bad. The drive wants to send us data which we are not ready to accept. | ||
1346 | * Just throw it away. | ||
1347 | */ | ||
1348 | static inline void ide_atapi_discard_data(ide_drive_t *drive, unsigned bcount) | ||
1349 | { | ||
1350 | ide_hwif_t *hwif = drive->hwif; | ||
1351 | |||
1352 | /* FIXME: use ->atapi_input_bytes */ | ||
1353 | while (bcount--) | ||
1354 | (void)hwif->INB(hwif->io_ports[IDE_DATA_OFFSET]); | ||
1355 | } | ||
1356 | |||
1357 | static inline void ide_atapi_write_zeros(ide_drive_t *drive, unsigned bcount) | ||
1358 | { | ||
1359 | ide_hwif_t *hwif = drive->hwif; | ||
1360 | |||
1361 | /* FIXME: use ->atapi_output_bytes */ | ||
1362 | while (bcount--) | ||
1363 | hwif->OUTB(0, hwif->io_ports[IDE_DATA_OFFSET]); | ||
1364 | } | ||
1365 | |||
1334 | #endif /* _IDE_H */ | 1366 | #endif /* _IDE_H */ |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index f8ab4ce70564..b5fef13148bd 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
@@ -102,6 +102,25 @@ extern void disable_irq_nosync(unsigned int irq); | |||
102 | extern void disable_irq(unsigned int irq); | 102 | extern void disable_irq(unsigned int irq); |
103 | extern void enable_irq(unsigned int irq); | 103 | extern void enable_irq(unsigned int irq); |
104 | 104 | ||
105 | #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS) | ||
106 | |||
107 | extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask); | ||
108 | extern int irq_can_set_affinity(unsigned int irq); | ||
109 | |||
110 | #else /* CONFIG_SMP */ | ||
111 | |||
112 | static inline int irq_set_affinity(unsigned int irq, cpumask_t cpumask) | ||
113 | { | ||
114 | return -EINVAL; | ||
115 | } | ||
116 | |||
117 | static inline int irq_can_set_affinity(unsigned int irq) | ||
118 | { | ||
119 | return 0; | ||
120 | } | ||
121 | |||
122 | #endif /* CONFIG_SMP && CONFIG_GENERIC_HARDIRQS */ | ||
123 | |||
105 | #ifdef CONFIG_GENERIC_HARDIRQS | 124 | #ifdef CONFIG_GENERIC_HARDIRQS |
106 | /* | 125 | /* |
107 | * Special lockdep variants of irq disabling/enabling. | 126 | * Special lockdep variants of irq disabling/enabling. |
diff --git a/include/linux/irq.h b/include/linux/irq.h index 176e5e790a44..1883a85625dd 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -228,21 +228,11 @@ static inline void set_pending_irq(unsigned int irq, cpumask_t mask) | |||
228 | 228 | ||
229 | #endif /* CONFIG_GENERIC_PENDING_IRQ */ | 229 | #endif /* CONFIG_GENERIC_PENDING_IRQ */ |
230 | 230 | ||
231 | extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask); | ||
232 | extern int irq_can_set_affinity(unsigned int irq); | ||
233 | |||
234 | #else /* CONFIG_SMP */ | 231 | #else /* CONFIG_SMP */ |
235 | 232 | ||
236 | #define move_native_irq(x) | 233 | #define move_native_irq(x) |
237 | #define move_masked_irq(x) | 234 | #define move_masked_irq(x) |
238 | 235 | ||
239 | static inline int irq_set_affinity(unsigned int irq, cpumask_t cpumask) | ||
240 | { | ||
241 | return -EINVAL; | ||
242 | } | ||
243 | |||
244 | static inline int irq_can_set_affinity(unsigned int irq) { return 0; } | ||
245 | |||
246 | #endif /* CONFIG_SMP */ | 236 | #endif /* CONFIG_SMP */ |
247 | 237 | ||
248 | #ifdef CONFIG_IRQBALANCE | 238 | #ifdef CONFIG_IRQBALANCE |
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h new file mode 100644 index 000000000000..9757b1a6d9dc --- /dev/null +++ b/include/linux/kgdb.h | |||
@@ -0,0 +1,281 @@ | |||
1 | /* | ||
2 | * This provides the callbacks and functions that KGDB needs to share between | ||
3 | * the core, I/O and arch-specific portions. | ||
4 | * | ||
5 | * Author: Amit Kale <amitkale@linsyssoft.com> and | ||
6 | * Tom Rini <trini@kernel.crashing.org> | ||
7 | * | ||
8 | * 2001-2004 (c) Amit S. Kale and 2003-2005 (c) MontaVista Software, Inc. | ||
9 | * This file is licensed under the terms of the GNU General Public License | ||
10 | * version 2. This program is licensed "as is" without any warranty of any | ||
11 | * kind, whether express or implied. | ||
12 | */ | ||
13 | #ifndef _KGDB_H_ | ||
14 | #define _KGDB_H_ | ||
15 | |||
16 | #include <linux/serial_8250.h> | ||
17 | #include <linux/linkage.h> | ||
18 | #include <linux/init.h> | ||
19 | |||
20 | #include <asm/atomic.h> | ||
21 | #include <asm/kgdb.h> | ||
22 | |||
23 | struct pt_regs; | ||
24 | |||
25 | /** | ||
26 | * kgdb_skipexception - (optional) exit kgdb_handle_exception early | ||
27 | * @exception: Exception vector number | ||
28 | * @regs: Current &struct pt_regs. | ||
29 | * | ||
30 | * On some architectures it is required to skip a breakpoint | ||
31 | * exception when it occurs after a breakpoint has been removed. | ||
32 | * This can be implemented in the architecture specific portion of | ||
33 | * for kgdb. | ||
34 | */ | ||
35 | extern int kgdb_skipexception(int exception, struct pt_regs *regs); | ||
36 | |||
37 | /** | ||
38 | * kgdb_post_primary_code - (optional) Save error vector/code numbers. | ||
39 | * @regs: Original pt_regs. | ||
40 | * @e_vector: Original error vector. | ||
41 | * @err_code: Original error code. | ||
42 | * | ||
43 | * This is usually needed on architectures which support SMP and | ||
44 | * KGDB. This function is called after all the secondary cpus have | ||
45 | * been put to a know spin state and the primary CPU has control over | ||
46 | * KGDB. | ||
47 | */ | ||
48 | extern void kgdb_post_primary_code(struct pt_regs *regs, int e_vector, | ||
49 | int err_code); | ||
50 | |||
51 | /** | ||
52 | * kgdb_disable_hw_debug - (optional) Disable hardware debugging hook | ||
53 | * @regs: Current &struct pt_regs. | ||
54 | * | ||
55 | * This function will be called if the particular architecture must | ||
56 | * disable hardware debugging while it is processing gdb packets or | ||
57 | * handling exception. | ||
58 | */ | ||
59 | extern void kgdb_disable_hw_debug(struct pt_regs *regs); | ||
60 | |||
61 | struct tasklet_struct; | ||
62 | struct task_struct; | ||
63 | struct uart_port; | ||
64 | |||
65 | /** | ||
66 | * kgdb_breakpoint - compiled in breakpoint | ||
67 | * | ||
68 | * This will be impelmented a static inline per architecture. This | ||
69 | * function is called by the kgdb core to execute an architecture | ||
70 | * specific trap to cause kgdb to enter the exception processing. | ||
71 | * | ||
72 | */ | ||
73 | void kgdb_breakpoint(void); | ||
74 | |||
75 | extern int kgdb_connected; | ||
76 | |||
77 | extern atomic_t kgdb_setting_breakpoint; | ||
78 | extern atomic_t kgdb_cpu_doing_single_step; | ||
79 | |||
80 | extern struct task_struct *kgdb_usethread; | ||
81 | extern struct task_struct *kgdb_contthread; | ||
82 | |||
83 | enum kgdb_bptype { | ||
84 | BP_BREAKPOINT = 0, | ||
85 | BP_HARDWARE_BREAKPOINT, | ||
86 | BP_WRITE_WATCHPOINT, | ||
87 | BP_READ_WATCHPOINT, | ||
88 | BP_ACCESS_WATCHPOINT | ||
89 | }; | ||
90 | |||
91 | enum kgdb_bpstate { | ||
92 | BP_UNDEFINED = 0, | ||
93 | BP_REMOVED, | ||
94 | BP_SET, | ||
95 | BP_ACTIVE | ||
96 | }; | ||
97 | |||
98 | struct kgdb_bkpt { | ||
99 | unsigned long bpt_addr; | ||
100 | unsigned char saved_instr[BREAK_INSTR_SIZE]; | ||
101 | enum kgdb_bptype type; | ||
102 | enum kgdb_bpstate state; | ||
103 | }; | ||
104 | |||
105 | #ifndef KGDB_MAX_BREAKPOINTS | ||
106 | # define KGDB_MAX_BREAKPOINTS 1000 | ||
107 | #endif | ||
108 | |||
109 | #define KGDB_HW_BREAKPOINT 1 | ||
110 | |||
111 | /* | ||
112 | * Functions each KGDB-supporting architecture must provide: | ||
113 | */ | ||
114 | |||
115 | /** | ||
116 | * kgdb_arch_init - Perform any architecture specific initalization. | ||
117 | * | ||
118 | * This function will handle the initalization of any architecture | ||
119 | * specific callbacks. | ||
120 | */ | ||
121 | extern int kgdb_arch_init(void); | ||
122 | |||
123 | /** | ||
124 | * kgdb_arch_exit - Perform any architecture specific uninitalization. | ||
125 | * | ||
126 | * This function will handle the uninitalization of any architecture | ||
127 | * specific callbacks, for dynamic registration and unregistration. | ||
128 | */ | ||
129 | extern void kgdb_arch_exit(void); | ||
130 | |||
131 | /** | ||
132 | * pt_regs_to_gdb_regs - Convert ptrace regs to GDB regs | ||
133 | * @gdb_regs: A pointer to hold the registers in the order GDB wants. | ||
134 | * @regs: The &struct pt_regs of the current process. | ||
135 | * | ||
136 | * Convert the pt_regs in @regs into the format for registers that | ||
137 | * GDB expects, stored in @gdb_regs. | ||
138 | */ | ||
139 | extern void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs); | ||
140 | |||
141 | /** | ||
142 | * sleeping_thread_to_gdb_regs - Convert ptrace regs to GDB regs | ||
143 | * @gdb_regs: A pointer to hold the registers in the order GDB wants. | ||
144 | * @p: The &struct task_struct of the desired process. | ||
145 | * | ||
146 | * Convert the register values of the sleeping process in @p to | ||
147 | * the format that GDB expects. | ||
148 | * This function is called when kgdb does not have access to the | ||
149 | * &struct pt_regs and therefore it should fill the gdb registers | ||
150 | * @gdb_regs with what has been saved in &struct thread_struct | ||
151 | * thread field during switch_to. | ||
152 | */ | ||
153 | extern void | ||
154 | sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p); | ||
155 | |||
156 | /** | ||
157 | * gdb_regs_to_pt_regs - Convert GDB regs to ptrace regs. | ||
158 | * @gdb_regs: A pointer to hold the registers we've received from GDB. | ||
159 | * @regs: A pointer to a &struct pt_regs to hold these values in. | ||
160 | * | ||
161 | * Convert the GDB regs in @gdb_regs into the pt_regs, and store them | ||
162 | * in @regs. | ||
163 | */ | ||
164 | extern void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs); | ||
165 | |||
166 | /** | ||
167 | * kgdb_arch_handle_exception - Handle architecture specific GDB packets. | ||
168 | * @vector: The error vector of the exception that happened. | ||
169 | * @signo: The signal number of the exception that happened. | ||
170 | * @err_code: The error code of the exception that happened. | ||
171 | * @remcom_in_buffer: The buffer of the packet we have read. | ||
172 | * @remcom_out_buffer: The buffer of %BUFMAX bytes to write a packet into. | ||
173 | * @regs: The &struct pt_regs of the current process. | ||
174 | * | ||
175 | * This function MUST handle the 'c' and 's' command packets, | ||
176 | * as well packets to set / remove a hardware breakpoint, if used. | ||
177 | * If there are additional packets which the hardware needs to handle, | ||
178 | * they are handled here. The code should return -1 if it wants to | ||
179 | * process more packets, and a %0 or %1 if it wants to exit from the | ||
180 | * kgdb callback. | ||
181 | */ | ||
182 | extern int | ||
183 | kgdb_arch_handle_exception(int vector, int signo, int err_code, | ||
184 | char *remcom_in_buffer, | ||
185 | char *remcom_out_buffer, | ||
186 | struct pt_regs *regs); | ||
187 | |||
188 | /** | ||
189 | * kgdb_roundup_cpus - Get other CPUs into a holding pattern | ||
190 | * @flags: Current IRQ state | ||
191 | * | ||
192 | * On SMP systems, we need to get the attention of the other CPUs | ||
193 | * and get them be in a known state. This should do what is needed | ||
194 | * to get the other CPUs to call kgdb_wait(). Note that on some arches, | ||
195 | * the NMI approach is not used for rounding up all the CPUs. For example, | ||
196 | * in case of MIPS, smp_call_function() is used to roundup CPUs. In | ||
197 | * this case, we have to make sure that interrupts are enabled before | ||
198 | * calling smp_call_function(). The argument to this function is | ||
199 | * the flags that will be used when restoring the interrupts. There is | ||
200 | * local_irq_save() call before kgdb_roundup_cpus(). | ||
201 | * | ||
202 | * On non-SMP systems, this is not called. | ||
203 | */ | ||
204 | extern void kgdb_roundup_cpus(unsigned long flags); | ||
205 | |||
206 | /* Optional functions. */ | ||
207 | extern int kgdb_validate_break_address(unsigned long addr); | ||
208 | extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr); | ||
209 | extern int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle); | ||
210 | |||
211 | /** | ||
212 | * struct kgdb_arch - Describe architecture specific values. | ||
213 | * @gdb_bpt_instr: The instruction to trigger a breakpoint. | ||
214 | * @flags: Flags for the breakpoint, currently just %KGDB_HW_BREAKPOINT. | ||
215 | * @set_breakpoint: Allow an architecture to specify how to set a software | ||
216 | * breakpoint. | ||
217 | * @remove_breakpoint: Allow an architecture to specify how to remove a | ||
218 | * software breakpoint. | ||
219 | * @set_hw_breakpoint: Allow an architecture to specify how to set a hardware | ||
220 | * breakpoint. | ||
221 | * @remove_hw_breakpoint: Allow an architecture to specify how to remove a | ||
222 | * hardware breakpoint. | ||
223 | * @remove_all_hw_break: Allow an architecture to specify how to remove all | ||
224 | * hardware breakpoints. | ||
225 | * @correct_hw_break: Allow an architecture to specify how to correct the | ||
226 | * hardware debug registers. | ||
227 | */ | ||
228 | struct kgdb_arch { | ||
229 | unsigned char gdb_bpt_instr[BREAK_INSTR_SIZE]; | ||
230 | unsigned long flags; | ||
231 | |||
232 | int (*set_breakpoint)(unsigned long, char *); | ||
233 | int (*remove_breakpoint)(unsigned long, char *); | ||
234 | int (*set_hw_breakpoint)(unsigned long, int, enum kgdb_bptype); | ||
235 | int (*remove_hw_breakpoint)(unsigned long, int, enum kgdb_bptype); | ||
236 | void (*remove_all_hw_break)(void); | ||
237 | void (*correct_hw_break)(void); | ||
238 | }; | ||
239 | |||
240 | /** | ||
241 | * struct kgdb_io - Describe the interface for an I/O driver to talk with KGDB. | ||
242 | * @name: Name of the I/O driver. | ||
243 | * @read_char: Pointer to a function that will return one char. | ||
244 | * @write_char: Pointer to a function that will write one char. | ||
245 | * @flush: Pointer to a function that will flush any pending writes. | ||
246 | * @init: Pointer to a function that will initialize the device. | ||
247 | * @pre_exception: Pointer to a function that will do any prep work for | ||
248 | * the I/O driver. | ||
249 | * @post_exception: Pointer to a function that will do any cleanup work | ||
250 | * for the I/O driver. | ||
251 | */ | ||
252 | struct kgdb_io { | ||
253 | const char *name; | ||
254 | int (*read_char) (void); | ||
255 | void (*write_char) (u8); | ||
256 | void (*flush) (void); | ||
257 | int (*init) (void); | ||
258 | void (*pre_exception) (void); | ||
259 | void (*post_exception) (void); | ||
260 | }; | ||
261 | |||
262 | extern struct kgdb_arch arch_kgdb_ops; | ||
263 | |||
264 | extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops); | ||
265 | extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops); | ||
266 | |||
267 | extern int kgdb_hex2long(char **ptr, long *long_val); | ||
268 | extern int kgdb_mem2hex(char *mem, char *buf, int count); | ||
269 | extern int kgdb_hex2mem(char *buf, char *mem, int count); | ||
270 | |||
271 | extern int kgdb_isremovedbreak(unsigned long addr); | ||
272 | |||
273 | extern int | ||
274 | kgdb_handle_exception(int ex_vector, int signo, int err_code, | ||
275 | struct pt_regs *regs); | ||
276 | extern int kgdb_nmicallback(int cpu, void *regs); | ||
277 | |||
278 | extern int kgdb_single_step; | ||
279 | extern atomic_t kgdb_active; | ||
280 | |||
281 | #endif /* _KGDB_H_ */ | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index 37ee881c42ac..165734a2dd47 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -122,6 +122,8 @@ enum { | |||
122 | 122 | ||
123 | ATAPI_MAX_DRAIN = 16 << 10, | 123 | ATAPI_MAX_DRAIN = 16 << 10, |
124 | 124 | ||
125 | ATA_ALL_DEVICES = (1 << ATA_MAX_DEVICES) - 1, | ||
126 | |||
125 | ATA_SHT_EMULATED = 1, | 127 | ATA_SHT_EMULATED = 1, |
126 | ATA_SHT_CMD_PER_LUN = 1, | 128 | ATA_SHT_CMD_PER_LUN = 1, |
127 | ATA_SHT_THIS_ID = -1, | 129 | ATA_SHT_THIS_ID = -1, |
@@ -163,9 +165,6 @@ enum { | |||
163 | ATA_DEV_NONE = 9, /* no device */ | 165 | ATA_DEV_NONE = 9, /* no device */ |
164 | 166 | ||
165 | /* struct ata_link flags */ | 167 | /* struct ata_link flags */ |
166 | ATA_LFLAG_HRST_TO_RESUME = (1 << 0), /* hardreset to resume link */ | ||
167 | ATA_LFLAG_SKIP_D2H_BSY = (1 << 1), /* can't wait for the first D2H | ||
168 | * Register FIS clearing BSY */ | ||
169 | ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */ | 168 | ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */ |
170 | ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */ | 169 | ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */ |
171 | ATA_LFLAG_ASSUME_SEMB = (1 << 4), /* assume SEMB class */ | 170 | ATA_LFLAG_ASSUME_SEMB = (1 << 4), /* assume SEMB class */ |
@@ -225,6 +224,7 @@ enum { | |||
225 | ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */ | 224 | ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */ |
226 | ATA_QCFLAG_CLEAR_EXCL = (1 << 5), /* clear excl_link on completion */ | 225 | ATA_QCFLAG_CLEAR_EXCL = (1 << 5), /* clear excl_link on completion */ |
227 | ATA_QCFLAG_QUIET = (1 << 6), /* don't report device error */ | 226 | ATA_QCFLAG_QUIET = (1 << 6), /* don't report device error */ |
227 | ATA_QCFLAG_RETRY = (1 << 7), /* retry after failure */ | ||
228 | 228 | ||
229 | ATA_QCFLAG_FAILED = (1 << 16), /* cmd failed and is owned by EH */ | 229 | ATA_QCFLAG_FAILED = (1 << 16), /* cmd failed and is owned by EH */ |
230 | ATA_QCFLAG_SENSE_VALID = (1 << 17), /* sense data valid */ | 230 | ATA_QCFLAG_SENSE_VALID = (1 << 17), /* sense data valid */ |
@@ -249,6 +249,25 @@ enum { | |||
249 | */ | 249 | */ |
250 | ATA_TMOUT_FF_WAIT = 4 * HZ / 5, | 250 | ATA_TMOUT_FF_WAIT = 4 * HZ / 5, |
251 | 251 | ||
252 | /* Spec mandates to wait for ">= 2ms" before checking status | ||
253 | * after reset. We wait 150ms, because that was the magic | ||
254 | * delay used for ATAPI devices in Hale Landis's ATADRVR, for | ||
255 | * the period of time between when the ATA command register is | ||
256 | * written, and then status is checked. Because waiting for | ||
257 | * "a while" before checking status is fine, post SRST, we | ||
258 | * perform this magic delay here as well. | ||
259 | * | ||
260 | * Old drivers/ide uses the 2mS rule and then waits for ready. | ||
261 | */ | ||
262 | ATA_WAIT_AFTER_RESET_MSECS = 150, | ||
263 | |||
264 | /* If PMP is supported, we have to do follow-up SRST. As some | ||
265 | * PMPs don't send D2H Reg FIS after hardreset, LLDs are | ||
266 | * advised to wait only for the following duration before | ||
267 | * doing SRST. | ||
268 | */ | ||
269 | ATA_TMOUT_PMP_SRST_WAIT = 1 * HZ, | ||
270 | |||
252 | /* ATA bus states */ | 271 | /* ATA bus states */ |
253 | BUS_UNKNOWN = 0, | 272 | BUS_UNKNOWN = 0, |
254 | BUS_DMA = 1, | 273 | BUS_DMA = 1, |
@@ -292,17 +311,16 @@ enum { | |||
292 | 311 | ||
293 | /* reset / recovery action types */ | 312 | /* reset / recovery action types */ |
294 | ATA_EH_REVALIDATE = (1 << 0), | 313 | ATA_EH_REVALIDATE = (1 << 0), |
295 | ATA_EH_SOFTRESET = (1 << 1), | 314 | ATA_EH_SOFTRESET = (1 << 1), /* meaningful only in ->prereset */ |
296 | ATA_EH_HARDRESET = (1 << 2), | 315 | ATA_EH_HARDRESET = (1 << 2), /* meaningful only in ->prereset */ |
316 | ATA_EH_RESET = ATA_EH_SOFTRESET | ATA_EH_HARDRESET, | ||
297 | ATA_EH_ENABLE_LINK = (1 << 3), | 317 | ATA_EH_ENABLE_LINK = (1 << 3), |
298 | ATA_EH_LPM = (1 << 4), /* link power management action */ | 318 | ATA_EH_LPM = (1 << 4), /* link power management action */ |
299 | 319 | ||
300 | ATA_EH_RESET_MASK = ATA_EH_SOFTRESET | ATA_EH_HARDRESET, | ||
301 | ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE, | 320 | ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE, |
302 | 321 | ||
303 | /* ata_eh_info->flags */ | 322 | /* ata_eh_info->flags */ |
304 | ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */ | 323 | ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */ |
305 | ATA_EHI_RESUME_LINK = (1 << 1), /* resume link (reset modifier) */ | ||
306 | ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */ | 324 | ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */ |
307 | ATA_EHI_QUIET = (1 << 3), /* be quiet */ | 325 | ATA_EHI_QUIET = (1 << 3), /* be quiet */ |
308 | 326 | ||
@@ -313,7 +331,6 @@ enum { | |||
313 | ATA_EHI_POST_SETMODE = (1 << 20), /* revaildating after setmode */ | 331 | ATA_EHI_POST_SETMODE = (1 << 20), /* revaildating after setmode */ |
314 | 332 | ||
315 | ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET, | 333 | ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET, |
316 | ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK, | ||
317 | 334 | ||
318 | /* max tries if error condition is still set after ->error_handler */ | 335 | /* max tries if error condition is still set after ->error_handler */ |
319 | ATA_EH_MAX_TRIES = 5, | 336 | ATA_EH_MAX_TRIES = 5, |
@@ -352,6 +369,22 @@ enum { | |||
352 | ATAPI_READ_CD = 2, /* READ CD [MSF] */ | 369 | ATAPI_READ_CD = 2, /* READ CD [MSF] */ |
353 | ATAPI_PASS_THRU = 3, /* SAT pass-thru */ | 370 | ATAPI_PASS_THRU = 3, /* SAT pass-thru */ |
354 | ATAPI_MISC = 4, /* the rest */ | 371 | ATAPI_MISC = 4, /* the rest */ |
372 | |||
373 | /* Timing constants */ | ||
374 | ATA_TIMING_SETUP = (1 << 0), | ||
375 | ATA_TIMING_ACT8B = (1 << 1), | ||
376 | ATA_TIMING_REC8B = (1 << 2), | ||
377 | ATA_TIMING_CYC8B = (1 << 3), | ||
378 | ATA_TIMING_8BIT = ATA_TIMING_ACT8B | ATA_TIMING_REC8B | | ||
379 | ATA_TIMING_CYC8B, | ||
380 | ATA_TIMING_ACTIVE = (1 << 4), | ||
381 | ATA_TIMING_RECOVER = (1 << 5), | ||
382 | ATA_TIMING_CYCLE = (1 << 6), | ||
383 | ATA_TIMING_UDMA = (1 << 7), | ||
384 | ATA_TIMING_ALL = ATA_TIMING_SETUP | ATA_TIMING_ACT8B | | ||
385 | ATA_TIMING_REC8B | ATA_TIMING_CYC8B | | ||
386 | ATA_TIMING_ACTIVE | ATA_TIMING_RECOVER | | ||
387 | ATA_TIMING_CYCLE | ATA_TIMING_UDMA, | ||
355 | }; | 388 | }; |
356 | 389 | ||
357 | enum ata_xfer_mask { | 390 | enum ata_xfer_mask { |
@@ -412,6 +445,7 @@ enum link_pm { | |||
412 | }; | 445 | }; |
413 | extern struct class_device_attribute class_device_attr_link_power_management_policy; | 446 | extern struct class_device_attribute class_device_attr_link_power_management_policy; |
414 | 447 | ||
448 | #ifdef CONFIG_ATA_SFF | ||
415 | struct ata_ioports { | 449 | struct ata_ioports { |
416 | void __iomem *cmd_addr; | 450 | void __iomem *cmd_addr; |
417 | void __iomem *data_addr; | 451 | void __iomem *data_addr; |
@@ -429,6 +463,7 @@ struct ata_ioports { | |||
429 | void __iomem *bmdma_addr; | 463 | void __iomem *bmdma_addr; |
430 | void __iomem *scr_addr; | 464 | void __iomem *scr_addr; |
431 | }; | 465 | }; |
466 | #endif /* CONFIG_ATA_SFF */ | ||
432 | 467 | ||
433 | struct ata_host { | 468 | struct ata_host { |
434 | spinlock_t lock; | 469 | spinlock_t lock; |
@@ -436,7 +471,7 @@ struct ata_host { | |||
436 | void __iomem * const *iomap; | 471 | void __iomem * const *iomap; |
437 | unsigned int n_ports; | 472 | unsigned int n_ports; |
438 | void *private_data; | 473 | void *private_data; |
439 | const struct ata_port_operations *ops; | 474 | struct ata_port_operations *ops; |
440 | unsigned long flags; | 475 | unsigned long flags; |
441 | #ifdef CONFIG_ATA_ACPI | 476 | #ifdef CONFIG_ATA_ACPI |
442 | acpi_handle acpi_handle; | 477 | acpi_handle acpi_handle; |
@@ -605,7 +640,7 @@ struct ata_link { | |||
605 | 640 | ||
606 | struct ata_port { | 641 | struct ata_port { |
607 | struct Scsi_Host *scsi_host; /* our co-allocated scsi host */ | 642 | struct Scsi_Host *scsi_host; /* our co-allocated scsi host */ |
608 | const struct ata_port_operations *ops; | 643 | struct ata_port_operations *ops; |
609 | spinlock_t *lock; | 644 | spinlock_t *lock; |
610 | unsigned long flags; /* ATA_FLAG_xxx */ | 645 | unsigned long flags; /* ATA_FLAG_xxx */ |
611 | unsigned int pflags; /* ATA_PFLAG_xxx */ | 646 | unsigned int pflags; /* ATA_PFLAG_xxx */ |
@@ -615,7 +650,9 @@ struct ata_port { | |||
615 | struct ata_prd *prd; /* our SG list */ | 650 | struct ata_prd *prd; /* our SG list */ |
616 | dma_addr_t prd_dma; /* and its DMA mapping */ | 651 | dma_addr_t prd_dma; /* and its DMA mapping */ |
617 | 652 | ||
653 | #ifdef CONFIG_ATA_SFF | ||
618 | struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */ | 654 | struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */ |
655 | #endif /* CONFIG_ATA_SFF */ | ||
619 | 656 | ||
620 | u8 ctl; /* cache of ATA control register */ | 657 | u8 ctl; /* cache of ATA control register */ |
621 | u8 last_ctl; /* Cache last written value */ | 658 | u8 last_ctl; /* Cache last written value */ |
@@ -667,81 +704,108 @@ struct ata_port { | |||
667 | u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */ | 704 | u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */ |
668 | }; | 705 | }; |
669 | 706 | ||
670 | struct ata_port_operations { | 707 | /* The following initializer overrides a method to NULL whether one of |
671 | void (*dev_config) (struct ata_device *); | 708 | * its parent has the method defined or not. This is equivalent to |
672 | 709 | * ERR_PTR(-ENOENT). Unfortunately, ERR_PTR doesn't render a constant | |
673 | void (*set_piomode) (struct ata_port *, struct ata_device *); | 710 | * expression and thus can't be used as an initializer. |
674 | void (*set_dmamode) (struct ata_port *, struct ata_device *); | 711 | */ |
675 | unsigned long (*mode_filter) (struct ata_device *, unsigned long); | 712 | #define ATA_OP_NULL (void *)(unsigned long)(-ENOENT) |
676 | |||
677 | void (*tf_load) (struct ata_port *ap, const struct ata_taskfile *tf); | ||
678 | void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf); | ||
679 | |||
680 | void (*exec_command)(struct ata_port *ap, const struct ata_taskfile *tf); | ||
681 | u8 (*check_status)(struct ata_port *ap); | ||
682 | u8 (*check_altstatus)(struct ata_port *ap); | ||
683 | void (*dev_select)(struct ata_port *ap, unsigned int device); | ||
684 | |||
685 | void (*phy_reset) (struct ata_port *ap); /* obsolete */ | ||
686 | int (*set_mode) (struct ata_link *link, struct ata_device **r_failed_dev); | ||
687 | |||
688 | int (*cable_detect) (struct ata_port *ap); | ||
689 | |||
690 | int (*check_atapi_dma) (struct ata_queued_cmd *qc); | ||
691 | |||
692 | void (*bmdma_setup) (struct ata_queued_cmd *qc); | ||
693 | void (*bmdma_start) (struct ata_queued_cmd *qc); | ||
694 | |||
695 | unsigned int (*data_xfer) (struct ata_device *dev, unsigned char *buf, | ||
696 | unsigned int buflen, int rw); | ||
697 | |||
698 | int (*qc_defer) (struct ata_queued_cmd *qc); | ||
699 | void (*qc_prep) (struct ata_queued_cmd *qc); | ||
700 | unsigned int (*qc_issue) (struct ata_queued_cmd *qc); | ||
701 | |||
702 | /* port multiplier */ | ||
703 | void (*pmp_attach) (struct ata_port *ap); | ||
704 | void (*pmp_detach) (struct ata_port *ap); | ||
705 | 713 | ||
706 | /* Error handlers. ->error_handler overrides ->eng_timeout and | 714 | struct ata_port_operations { |
707 | * indicates that new-style EH is in place. | 715 | /* |
716 | * Command execution | ||
708 | */ | 717 | */ |
709 | void (*eng_timeout) (struct ata_port *ap); /* obsolete */ | 718 | int (*qc_defer)(struct ata_queued_cmd *qc); |
710 | 719 | int (*check_atapi_dma)(struct ata_queued_cmd *qc); | |
711 | void (*freeze) (struct ata_port *ap); | 720 | void (*qc_prep)(struct ata_queued_cmd *qc); |
712 | void (*thaw) (struct ata_port *ap); | 721 | unsigned int (*qc_issue)(struct ata_queued_cmd *qc); |
713 | void (*error_handler) (struct ata_port *ap); | 722 | bool (*qc_fill_rtf)(struct ata_queued_cmd *qc); |
714 | void (*post_internal_cmd) (struct ata_queued_cmd *qc); | 723 | |
715 | 724 | /* | |
716 | irq_handler_t irq_handler; | 725 | * Configuration and exception handling |
717 | void (*irq_clear) (struct ata_port *); | 726 | */ |
718 | u8 (*irq_on) (struct ata_port *); | 727 | int (*cable_detect)(struct ata_port *ap); |
719 | 728 | unsigned long (*mode_filter)(struct ata_device *dev, unsigned long xfer_mask); | |
720 | int (*scr_read) (struct ata_port *ap, unsigned int sc_reg, u32 *val); | 729 | void (*set_piomode)(struct ata_port *ap, struct ata_device *dev); |
721 | int (*scr_write) (struct ata_port *ap, unsigned int sc_reg, u32 val); | 730 | void (*set_dmamode)(struct ata_port *ap, struct ata_device *dev); |
731 | int (*set_mode)(struct ata_link *link, struct ata_device **r_failed_dev); | ||
732 | |||
733 | void (*dev_config)(struct ata_device *dev); | ||
734 | |||
735 | void (*freeze)(struct ata_port *ap); | ||
736 | void (*thaw)(struct ata_port *ap); | ||
737 | ata_prereset_fn_t prereset; | ||
738 | ata_reset_fn_t softreset; | ||
739 | ata_reset_fn_t hardreset; | ||
740 | ata_postreset_fn_t postreset; | ||
741 | ata_prereset_fn_t pmp_prereset; | ||
742 | ata_reset_fn_t pmp_softreset; | ||
743 | ata_reset_fn_t pmp_hardreset; | ||
744 | ata_postreset_fn_t pmp_postreset; | ||
745 | void (*error_handler)(struct ata_port *ap); | ||
746 | void (*post_internal_cmd)(struct ata_queued_cmd *qc); | ||
747 | |||
748 | /* | ||
749 | * Optional features | ||
750 | */ | ||
751 | int (*scr_read)(struct ata_port *ap, unsigned int sc_reg, u32 *val); | ||
752 | int (*scr_write)(struct ata_port *ap, unsigned int sc_reg, u32 val); | ||
753 | void (*pmp_attach)(struct ata_port *ap); | ||
754 | void (*pmp_detach)(struct ata_port *ap); | ||
755 | int (*enable_pm)(struct ata_port *ap, enum link_pm policy); | ||
756 | void (*disable_pm)(struct ata_port *ap); | ||
757 | |||
758 | /* | ||
759 | * Start, stop, suspend and resume | ||
760 | */ | ||
761 | int (*port_suspend)(struct ata_port *ap, pm_message_t mesg); | ||
762 | int (*port_resume)(struct ata_port *ap); | ||
763 | int (*port_start)(struct ata_port *ap); | ||
764 | void (*port_stop)(struct ata_port *ap); | ||
765 | void (*host_stop)(struct ata_host *host); | ||
766 | |||
767 | #ifdef CONFIG_ATA_SFF | ||
768 | /* | ||
769 | * SFF / taskfile oriented ops | ||
770 | */ | ||
771 | void (*sff_dev_select)(struct ata_port *ap, unsigned int device); | ||
772 | u8 (*sff_check_status)(struct ata_port *ap); | ||
773 | u8 (*sff_check_altstatus)(struct ata_port *ap); | ||
774 | void (*sff_tf_load)(struct ata_port *ap, const struct ata_taskfile *tf); | ||
775 | void (*sff_tf_read)(struct ata_port *ap, struct ata_taskfile *tf); | ||
776 | void (*sff_exec_command)(struct ata_port *ap, | ||
777 | const struct ata_taskfile *tf); | ||
778 | unsigned int (*sff_data_xfer)(struct ata_device *dev, | ||
779 | unsigned char *buf, unsigned int buflen, int rw); | ||
780 | u8 (*sff_irq_on)(struct ata_port *); | ||
781 | void (*sff_irq_clear)(struct ata_port *); | ||
722 | 782 | ||
723 | int (*port_suspend) (struct ata_port *ap, pm_message_t mesg); | 783 | void (*bmdma_setup)(struct ata_queued_cmd *qc); |
724 | int (*port_resume) (struct ata_port *ap); | 784 | void (*bmdma_start)(struct ata_queued_cmd *qc); |
725 | int (*enable_pm) (struct ata_port *ap, enum link_pm policy); | 785 | void (*bmdma_stop)(struct ata_queued_cmd *qc); |
726 | void (*disable_pm) (struct ata_port *ap); | 786 | u8 (*bmdma_status)(struct ata_port *ap); |
727 | int (*port_start) (struct ata_port *ap); | 787 | #endif /* CONFIG_ATA_SFF */ |
728 | void (*port_stop) (struct ata_port *ap); | ||
729 | 788 | ||
730 | void (*host_stop) (struct ata_host *host); | 789 | /* |
790 | * Obsolete | ||
791 | */ | ||
792 | void (*phy_reset)(struct ata_port *ap); | ||
793 | void (*eng_timeout)(struct ata_port *ap); | ||
731 | 794 | ||
732 | void (*bmdma_stop) (struct ata_queued_cmd *qc); | 795 | /* |
733 | u8 (*bmdma_status) (struct ata_port *ap); | 796 | * ->inherits must be the last field and all the preceding |
797 | * fields must be pointers. | ||
798 | */ | ||
799 | const struct ata_port_operations *inherits; | ||
734 | }; | 800 | }; |
735 | 801 | ||
736 | struct ata_port_info { | 802 | struct ata_port_info { |
737 | struct scsi_host_template *sht; | ||
738 | unsigned long flags; | 803 | unsigned long flags; |
739 | unsigned long link_flags; | 804 | unsigned long link_flags; |
740 | unsigned long pio_mask; | 805 | unsigned long pio_mask; |
741 | unsigned long mwdma_mask; | 806 | unsigned long mwdma_mask; |
742 | unsigned long udma_mask; | 807 | unsigned long udma_mask; |
743 | const struct ata_port_operations *port_ops; | 808 | struct ata_port_operations *port_ops; |
744 | irq_handler_t irq_handler; | ||
745 | void *private_data; | 809 | void *private_data; |
746 | }; | 810 | }; |
747 | 811 | ||
@@ -759,11 +823,14 @@ struct ata_timing { | |||
759 | 823 | ||
760 | #define FIT(v, vmin, vmax) max_t(short, min_t(short, v, vmax), vmin) | 824 | #define FIT(v, vmin, vmax) max_t(short, min_t(short, v, vmax), vmin) |
761 | 825 | ||
826 | /* | ||
827 | * Core layer - drivers/ata/libata-core.c | ||
828 | */ | ||
762 | extern const unsigned long sata_deb_timing_normal[]; | 829 | extern const unsigned long sata_deb_timing_normal[]; |
763 | extern const unsigned long sata_deb_timing_hotplug[]; | 830 | extern const unsigned long sata_deb_timing_hotplug[]; |
764 | extern const unsigned long sata_deb_timing_long[]; | 831 | extern const unsigned long sata_deb_timing_long[]; |
765 | 832 | ||
766 | extern const struct ata_port_operations ata_dummy_port_ops; | 833 | extern struct ata_port_operations ata_dummy_port_ops; |
767 | extern const struct ata_port_info ata_dummy_port_info; | 834 | extern const struct ata_port_info ata_dummy_port_info; |
768 | 835 | ||
769 | static inline const unsigned long * | 836 | static inline const unsigned long * |
@@ -782,22 +849,21 @@ static inline int ata_port_is_dummy(struct ata_port *ap) | |||
782 | 849 | ||
783 | extern void sata_print_link_status(struct ata_link *link); | 850 | extern void sata_print_link_status(struct ata_link *link); |
784 | extern void ata_port_probe(struct ata_port *); | 851 | extern void ata_port_probe(struct ata_port *); |
785 | extern void ata_bus_reset(struct ata_port *ap); | ||
786 | extern int sata_set_spd(struct ata_link *link); | 852 | extern int sata_set_spd(struct ata_link *link); |
853 | extern int ata_std_prereset(struct ata_link *link, unsigned long deadline); | ||
854 | extern int ata_wait_after_reset(struct ata_link *link, unsigned long deadline, | ||
855 | int (*check_ready)(struct ata_link *link)); | ||
787 | extern int sata_link_debounce(struct ata_link *link, | 856 | extern int sata_link_debounce(struct ata_link *link, |
788 | const unsigned long *params, unsigned long deadline); | 857 | const unsigned long *params, unsigned long deadline); |
789 | extern int sata_link_resume(struct ata_link *link, const unsigned long *params, | 858 | extern int sata_link_resume(struct ata_link *link, const unsigned long *params, |
790 | unsigned long deadline); | 859 | unsigned long deadline); |
791 | extern int ata_std_prereset(struct ata_link *link, unsigned long deadline); | ||
792 | extern int ata_std_softreset(struct ata_link *link, unsigned int *classes, | ||
793 | unsigned long deadline); | ||
794 | extern int sata_link_hardreset(struct ata_link *link, | 860 | extern int sata_link_hardreset(struct ata_link *link, |
795 | const unsigned long *timing, unsigned long deadline); | 861 | const unsigned long *timing, unsigned long deadline, |
862 | bool *online, int (*check_ready)(struct ata_link *)); | ||
796 | extern int sata_std_hardreset(struct ata_link *link, unsigned int *class, | 863 | extern int sata_std_hardreset(struct ata_link *link, unsigned int *class, |
797 | unsigned long deadline); | 864 | unsigned long deadline); |
798 | extern void ata_std_postreset(struct ata_link *link, unsigned int *classes); | 865 | extern void ata_std_postreset(struct ata_link *link, unsigned int *classes); |
799 | extern void ata_port_disable(struct ata_port *); | 866 | extern void ata_port_disable(struct ata_port *); |
800 | extern void ata_std_ports(struct ata_ioports *ioaddr); | ||
801 | 867 | ||
802 | extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); | 868 | extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); |
803 | extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, | 869 | extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, |
@@ -810,7 +876,7 @@ extern int ata_host_activate(struct ata_host *host, int irq, | |||
810 | struct scsi_host_template *sht); | 876 | struct scsi_host_template *sht); |
811 | extern void ata_host_detach(struct ata_host *host); | 877 | extern void ata_host_detach(struct ata_host *host); |
812 | extern void ata_host_init(struct ata_host *, struct device *, | 878 | extern void ata_host_init(struct ata_host *, struct device *, |
813 | unsigned long, const struct ata_port_operations *); | 879 | unsigned long, struct ata_port_operations *); |
814 | extern int ata_scsi_detect(struct scsi_host_template *sht); | 880 | extern int ata_scsi_detect(struct scsi_host_template *sht); |
815 | extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); | 881 | extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); |
816 | extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); | 882 | extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); |
@@ -823,7 +889,6 @@ extern void ata_sas_port_stop(struct ata_port *ap); | |||
823 | extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *); | 889 | extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *); |
824 | extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), | 890 | extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), |
825 | struct ata_port *ap); | 891 | struct ata_port *ap); |
826 | extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); | ||
827 | extern int sata_scr_valid(struct ata_link *link); | 892 | extern int sata_scr_valid(struct ata_link *link); |
828 | extern int sata_scr_read(struct ata_link *link, int reg, u32 *val); | 893 | extern int sata_scr_read(struct ata_link *link, int reg, u32 *val); |
829 | extern int sata_scr_write(struct ata_link *link, int reg, u32 val); | 894 | extern int sata_scr_write(struct ata_link *link, int reg, u32 val); |
@@ -835,21 +900,9 @@ extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); | |||
835 | extern void ata_host_resume(struct ata_host *host); | 900 | extern void ata_host_resume(struct ata_host *host); |
836 | #endif | 901 | #endif |
837 | extern int ata_ratelimit(void); | 902 | extern int ata_ratelimit(void); |
838 | extern int ata_busy_sleep(struct ata_port *ap, | ||
839 | unsigned long timeout_pat, unsigned long timeout); | ||
840 | extern void ata_wait_after_reset(struct ata_port *ap, unsigned long deadline); | ||
841 | extern int ata_wait_ready(struct ata_port *ap, unsigned long deadline); | ||
842 | extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, | 903 | extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, |
843 | unsigned long interval_msec, | 904 | unsigned long interval_msec, |
844 | unsigned long timeout_msec); | 905 | unsigned long timeout_msec); |
845 | extern unsigned int ata_dev_try_classify(struct ata_device *dev, int present, | ||
846 | u8 *r_err); | ||
847 | |||
848 | /* | ||
849 | * Default driver ops implementations | ||
850 | */ | ||
851 | extern void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf); | ||
852 | extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf); | ||
853 | extern int atapi_cmd_type(u8 opcode); | 906 | extern int atapi_cmd_type(u8 opcode); |
854 | extern void ata_tf_to_fis(const struct ata_taskfile *tf, | 907 | extern void ata_tf_to_fis(const struct ata_taskfile *tf, |
855 | u8 pmp, int is_cmd, u8 *fis); | 908 | u8 pmp, int is_cmd, u8 *fis); |
@@ -864,23 +917,9 @@ extern unsigned long ata_xfer_mode2mask(u8 xfer_mode); | |||
864 | extern int ata_xfer_mode2shift(unsigned long xfer_mode); | 917 | extern int ata_xfer_mode2shift(unsigned long xfer_mode); |
865 | extern const char *ata_mode_string(unsigned long xfer_mask); | 918 | extern const char *ata_mode_string(unsigned long xfer_mask); |
866 | extern unsigned long ata_id_xfermask(const u16 *id); | 919 | extern unsigned long ata_id_xfermask(const u16 *id); |
867 | extern void ata_noop_dev_select(struct ata_port *ap, unsigned int device); | ||
868 | extern void ata_std_dev_select(struct ata_port *ap, unsigned int device); | ||
869 | extern u8 ata_check_status(struct ata_port *ap); | ||
870 | extern u8 ata_altstatus(struct ata_port *ap); | ||
871 | extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); | ||
872 | extern int ata_port_start(struct ata_port *ap); | 920 | extern int ata_port_start(struct ata_port *ap); |
873 | extern int ata_sff_port_start(struct ata_port *ap); | ||
874 | extern irqreturn_t ata_interrupt(int irq, void *dev_instance); | ||
875 | extern unsigned int ata_data_xfer(struct ata_device *dev, | ||
876 | unsigned char *buf, unsigned int buflen, int rw); | ||
877 | extern unsigned int ata_data_xfer_noirq(struct ata_device *dev, | ||
878 | unsigned char *buf, unsigned int buflen, int rw); | ||
879 | extern int ata_std_qc_defer(struct ata_queued_cmd *qc); | 921 | extern int ata_std_qc_defer(struct ata_queued_cmd *qc); |
880 | extern void ata_dumb_qc_prep(struct ata_queued_cmd *qc); | ||
881 | extern void ata_qc_prep(struct ata_queued_cmd *qc); | ||
882 | extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); | 922 | extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); |
883 | extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc); | ||
884 | extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, | 923 | extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, |
885 | unsigned int n_elem); | 924 | unsigned int n_elem); |
886 | extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); | 925 | extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); |
@@ -889,24 +928,8 @@ extern void ata_id_string(const u16 *id, unsigned char *s, | |||
889 | unsigned int ofs, unsigned int len); | 928 | unsigned int ofs, unsigned int len); |
890 | extern void ata_id_c_string(const u16 *id, unsigned char *s, | 929 | extern void ata_id_c_string(const u16 *id, unsigned char *s, |
891 | unsigned int ofs, unsigned int len); | 930 | unsigned int ofs, unsigned int len); |
892 | extern void ata_bmdma_setup(struct ata_queued_cmd *qc); | ||
893 | extern void ata_bmdma_start(struct ata_queued_cmd *qc); | ||
894 | extern void ata_bmdma_stop(struct ata_queued_cmd *qc); | ||
895 | extern u8 ata_bmdma_status(struct ata_port *ap); | ||
896 | extern void ata_bmdma_irq_clear(struct ata_port *ap); | ||
897 | extern void ata_bmdma_freeze(struct ata_port *ap); | ||
898 | extern void ata_bmdma_thaw(struct ata_port *ap); | ||
899 | extern void ata_bmdma_drive_eh(struct ata_port *ap, ata_prereset_fn_t prereset, | ||
900 | ata_reset_fn_t softreset, | ||
901 | ata_reset_fn_t hardreset, | ||
902 | ata_postreset_fn_t postreset); | ||
903 | extern void ata_bmdma_error_handler(struct ata_port *ap); | ||
904 | extern void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc); | ||
905 | extern int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, | ||
906 | u8 status, int in_wq); | ||
907 | extern void ata_qc_complete(struct ata_queued_cmd *qc); | 931 | extern void ata_qc_complete(struct ata_queued_cmd *qc); |
908 | extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active, | 932 | extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active); |
909 | void (*finish_qc)(struct ata_queued_cmd *)); | ||
910 | extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd, | 933 | extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd, |
911 | void (*done)(struct scsi_cmnd *)); | 934 | void (*done)(struct scsi_cmnd *)); |
912 | extern int ata_std_bios_param(struct scsi_device *sdev, | 935 | extern int ata_std_bios_param(struct scsi_device *sdev, |
@@ -918,7 +941,6 @@ extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, | |||
918 | int queue_depth); | 941 | int queue_depth); |
919 | extern struct ata_device *ata_dev_pair(struct ata_device *adev); | 942 | extern struct ata_device *ata_dev_pair(struct ata_device *adev); |
920 | extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); | 943 | extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); |
921 | extern u8 ata_irq_on(struct ata_port *ap); | ||
922 | 944 | ||
923 | extern int ata_cable_40wire(struct ata_port *ap); | 945 | extern int ata_cable_40wire(struct ata_port *ap); |
924 | extern int ata_cable_80wire(struct ata_port *ap); | 946 | extern int ata_cable_80wire(struct ata_port *ap); |
@@ -926,10 +948,7 @@ extern int ata_cable_sata(struct ata_port *ap); | |||
926 | extern int ata_cable_ignore(struct ata_port *ap); | 948 | extern int ata_cable_ignore(struct ata_port *ap); |
927 | extern int ata_cable_unknown(struct ata_port *ap); | 949 | extern int ata_cable_unknown(struct ata_port *ap); |
928 | 950 | ||
929 | /* | 951 | /* Timing helpers */ |
930 | * Timing helpers | ||
931 | */ | ||
932 | |||
933 | extern unsigned int ata_pio_need_iordy(const struct ata_device *); | 952 | extern unsigned int ata_pio_need_iordy(const struct ata_device *); |
934 | extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode); | 953 | extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode); |
935 | extern int ata_timing_compute(struct ata_device *, unsigned short, | 954 | extern int ata_timing_compute(struct ata_device *, unsigned short, |
@@ -939,24 +958,31 @@ extern void ata_timing_merge(const struct ata_timing *, | |||
939 | unsigned int); | 958 | unsigned int); |
940 | extern u8 ata_timing_cycle2mode(unsigned int xfer_shift, int cycle); | 959 | extern u8 ata_timing_cycle2mode(unsigned int xfer_shift, int cycle); |
941 | 960 | ||
942 | enum { | 961 | /* PCI */ |
943 | ATA_TIMING_SETUP = (1 << 0), | 962 | #ifdef CONFIG_PCI |
944 | ATA_TIMING_ACT8B = (1 << 1), | 963 | struct pci_dev; |
945 | ATA_TIMING_REC8B = (1 << 2), | 964 | |
946 | ATA_TIMING_CYC8B = (1 << 3), | 965 | struct pci_bits { |
947 | ATA_TIMING_8BIT = ATA_TIMING_ACT8B | ATA_TIMING_REC8B | | 966 | unsigned int reg; /* PCI config register to read */ |
948 | ATA_TIMING_CYC8B, | 967 | unsigned int width; /* 1 (8 bit), 2 (16 bit), 4 (32 bit) */ |
949 | ATA_TIMING_ACTIVE = (1 << 4), | 968 | unsigned long mask; |
950 | ATA_TIMING_RECOVER = (1 << 5), | 969 | unsigned long val; |
951 | ATA_TIMING_CYCLE = (1 << 6), | ||
952 | ATA_TIMING_UDMA = (1 << 7), | ||
953 | ATA_TIMING_ALL = ATA_TIMING_SETUP | ATA_TIMING_ACT8B | | ||
954 | ATA_TIMING_REC8B | ATA_TIMING_CYC8B | | ||
955 | ATA_TIMING_ACTIVE | ATA_TIMING_RECOVER | | ||
956 | ATA_TIMING_CYCLE | ATA_TIMING_UDMA, | ||
957 | }; | 970 | }; |
958 | 971 | ||
959 | /* libata-acpi.c */ | 972 | extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); |
973 | extern void ata_pci_remove_one(struct pci_dev *pdev); | ||
974 | |||
975 | #ifdef CONFIG_PM | ||
976 | extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg); | ||
977 | extern int __must_check ata_pci_device_do_resume(struct pci_dev *pdev); | ||
978 | extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); | ||
979 | extern int ata_pci_device_resume(struct pci_dev *pdev); | ||
980 | #endif /* CONFIG_PM */ | ||
981 | #endif /* CONFIG_PCI */ | ||
982 | |||
983 | /* | ||
984 | * ACPI - drivers/ata/libata-acpi.c | ||
985 | */ | ||
960 | #ifdef CONFIG_ATA_ACPI | 986 | #ifdef CONFIG_ATA_ACPI |
961 | static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap) | 987 | static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap) |
962 | { | 988 | { |
@@ -1000,56 +1026,8 @@ static inline int ata_acpi_cbl_80wire(struct ata_port *ap, | |||
1000 | } | 1026 | } |
1001 | #endif | 1027 | #endif |
1002 | 1028 | ||
1003 | #ifdef CONFIG_PCI | ||
1004 | struct pci_dev; | ||
1005 | |||
1006 | extern int ata_pci_init_one(struct pci_dev *pdev, | ||
1007 | const struct ata_port_info * const * ppi); | ||
1008 | extern void ata_pci_remove_one(struct pci_dev *pdev); | ||
1009 | #ifdef CONFIG_PM | ||
1010 | extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg); | ||
1011 | extern int __must_check ata_pci_device_do_resume(struct pci_dev *pdev); | ||
1012 | extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); | ||
1013 | extern int ata_pci_device_resume(struct pci_dev *pdev); | ||
1014 | #endif | ||
1015 | extern int ata_pci_clear_simplex(struct pci_dev *pdev); | ||
1016 | |||
1017 | struct pci_bits { | ||
1018 | unsigned int reg; /* PCI config register to read */ | ||
1019 | unsigned int width; /* 1 (8 bit), 2 (16 bit), 4 (32 bit) */ | ||
1020 | unsigned long mask; | ||
1021 | unsigned long val; | ||
1022 | }; | ||
1023 | |||
1024 | extern int ata_pci_init_sff_host(struct ata_host *host); | ||
1025 | extern int ata_pci_init_bmdma(struct ata_host *host); | ||
1026 | extern int ata_pci_prepare_sff_host(struct pci_dev *pdev, | ||
1027 | const struct ata_port_info * const * ppi, | ||
1028 | struct ata_host **r_host); | ||
1029 | extern int ata_pci_activate_sff_host(struct ata_host *host, | ||
1030 | irq_handler_t irq_handler, | ||
1031 | struct scsi_host_template *sht); | ||
1032 | extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); | ||
1033 | extern unsigned long ata_pci_default_filter(struct ata_device *dev, | ||
1034 | unsigned long xfer_mask); | ||
1035 | #endif /* CONFIG_PCI */ | ||
1036 | |||
1037 | /* | ||
1038 | * PMP | ||
1039 | */ | ||
1040 | extern int sata_pmp_qc_defer_cmd_switch(struct ata_queued_cmd *qc); | ||
1041 | extern int sata_pmp_std_prereset(struct ata_link *link, unsigned long deadline); | ||
1042 | extern int sata_pmp_std_hardreset(struct ata_link *link, unsigned int *class, | ||
1043 | unsigned long deadline); | ||
1044 | extern void sata_pmp_std_postreset(struct ata_link *link, unsigned int *class); | ||
1045 | extern void sata_pmp_do_eh(struct ata_port *ap, | ||
1046 | ata_prereset_fn_t prereset, ata_reset_fn_t softreset, | ||
1047 | ata_reset_fn_t hardreset, ata_postreset_fn_t postreset, | ||
1048 | ata_prereset_fn_t pmp_prereset, ata_reset_fn_t pmp_softreset, | ||
1049 | ata_reset_fn_t pmp_hardreset, ata_postreset_fn_t pmp_postreset); | ||
1050 | |||
1051 | /* | 1029 | /* |
1052 | * EH | 1030 | * EH - drivers/ata/libata-eh.c |
1053 | */ | 1031 | */ |
1054 | extern void ata_port_schedule_eh(struct ata_port *ap); | 1032 | extern void ata_port_schedule_eh(struct ata_port *ap); |
1055 | extern int ata_link_abort(struct ata_link *link); | 1033 | extern int ata_link_abort(struct ata_link *link); |
@@ -1066,6 +1044,92 @@ extern void ata_eh_qc_retry(struct ata_queued_cmd *qc); | |||
1066 | extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, | 1044 | extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, |
1067 | ata_reset_fn_t softreset, ata_reset_fn_t hardreset, | 1045 | ata_reset_fn_t softreset, ata_reset_fn_t hardreset, |
1068 | ata_postreset_fn_t postreset); | 1046 | ata_postreset_fn_t postreset); |
1047 | extern void ata_std_error_handler(struct ata_port *ap); | ||
1048 | |||
1049 | /* | ||
1050 | * Base operations to inherit from and initializers for sht | ||
1051 | * | ||
1052 | * Operations | ||
1053 | * | ||
1054 | * base : Common to all libata drivers. | ||
1055 | * sata : SATA controllers w/ native interface. | ||
1056 | * pmp : SATA controllers w/ PMP support. | ||
1057 | * sff : SFF ATA controllers w/o BMDMA support. | ||
1058 | * bmdma : SFF ATA controllers w/ BMDMA support. | ||
1059 | * | ||
1060 | * sht initializers | ||
1061 | * | ||
1062 | * BASE : Common to all libata drivers. The user must set | ||
1063 | * sg_tablesize and dma_boundary. | ||
1064 | * PIO : SFF ATA controllers w/ only PIO support. | ||
1065 | * BMDMA : SFF ATA controllers w/ BMDMA support. sg_tablesize and | ||
1066 | * dma_boundary are set to BMDMA limits. | ||
1067 | * NCQ : SATA controllers supporting NCQ. The user must set | ||
1068 | * sg_tablesize, dma_boundary and can_queue. | ||
1069 | */ | ||
1070 | extern const struct ata_port_operations ata_base_port_ops; | ||
1071 | extern const struct ata_port_operations sata_port_ops; | ||
1072 | |||
1073 | #define ATA_BASE_SHT(drv_name) \ | ||
1074 | .module = THIS_MODULE, \ | ||
1075 | .name = drv_name, \ | ||
1076 | .ioctl = ata_scsi_ioctl, \ | ||
1077 | .queuecommand = ata_scsi_queuecmd, \ | ||
1078 | .can_queue = ATA_DEF_QUEUE, \ | ||
1079 | .this_id = ATA_SHT_THIS_ID, \ | ||
1080 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, \ | ||
1081 | .emulated = ATA_SHT_EMULATED, \ | ||
1082 | .use_clustering = ATA_SHT_USE_CLUSTERING, \ | ||
1083 | .proc_name = drv_name, \ | ||
1084 | .slave_configure = ata_scsi_slave_config, \ | ||
1085 | .slave_destroy = ata_scsi_slave_destroy, \ | ||
1086 | .bios_param = ata_std_bios_param | ||
1087 | |||
1088 | #define ATA_NCQ_SHT(drv_name) \ | ||
1089 | ATA_BASE_SHT(drv_name), \ | ||
1090 | .change_queue_depth = ata_scsi_change_queue_depth | ||
1091 | |||
1092 | /* | ||
1093 | * PMP helpers | ||
1094 | */ | ||
1095 | #ifdef CONFIG_SATA_PMP | ||
1096 | static inline bool sata_pmp_supported(struct ata_port *ap) | ||
1097 | { | ||
1098 | return ap->flags & ATA_FLAG_PMP; | ||
1099 | } | ||
1100 | |||
1101 | static inline bool sata_pmp_attached(struct ata_port *ap) | ||
1102 | { | ||
1103 | return ap->nr_pmp_links != 0; | ||
1104 | } | ||
1105 | |||
1106 | static inline int ata_is_host_link(const struct ata_link *link) | ||
1107 | { | ||
1108 | return link == &link->ap->link; | ||
1109 | } | ||
1110 | #else /* CONFIG_SATA_PMP */ | ||
1111 | static inline bool sata_pmp_supported(struct ata_port *ap) | ||
1112 | { | ||
1113 | return false; | ||
1114 | } | ||
1115 | |||
1116 | static inline bool sata_pmp_attached(struct ata_port *ap) | ||
1117 | { | ||
1118 | return false; | ||
1119 | } | ||
1120 | |||
1121 | static inline int ata_is_host_link(const struct ata_link *link) | ||
1122 | { | ||
1123 | return 1; | ||
1124 | } | ||
1125 | #endif /* CONFIG_SATA_PMP */ | ||
1126 | |||
1127 | static inline int sata_srst_pmp(struct ata_link *link) | ||
1128 | { | ||
1129 | if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) | ||
1130 | return SATA_PMP_CTRL_PORT; | ||
1131 | return link->pmp; | ||
1132 | } | ||
1069 | 1133 | ||
1070 | /* | 1134 | /* |
1071 | * printk helpers | 1135 | * printk helpers |
@@ -1074,7 +1138,7 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
1074 | printk("%sata%u: "fmt, lv, (ap)->print_id , ##args) | 1138 | printk("%sata%u: "fmt, lv, (ap)->print_id , ##args) |
1075 | 1139 | ||
1076 | #define ata_link_printk(link, lv, fmt, args...) do { \ | 1140 | #define ata_link_printk(link, lv, fmt, args...) do { \ |
1077 | if ((link)->ap->nr_pmp_links) \ | 1141 | if (sata_pmp_attached((link)->ap)) \ |
1078 | printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \ | 1142 | printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \ |
1079 | (link)->pmp , ##args); \ | 1143 | (link)->pmp , ##args); \ |
1080 | else \ | 1144 | else \ |
@@ -1094,18 +1158,11 @@ extern void ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...) | |||
1094 | __attribute__ ((format (printf, 2, 3))); | 1158 | __attribute__ ((format (printf, 2, 3))); |
1095 | extern void ata_ehi_clear_desc(struct ata_eh_info *ehi); | 1159 | extern void ata_ehi_clear_desc(struct ata_eh_info *ehi); |
1096 | 1160 | ||
1097 | static inline void ata_ehi_schedule_probe(struct ata_eh_info *ehi) | ||
1098 | { | ||
1099 | ehi->flags |= ATA_EHI_RESUME_LINK; | ||
1100 | ehi->action |= ATA_EH_SOFTRESET; | ||
1101 | ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1; | ||
1102 | } | ||
1103 | |||
1104 | static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi) | 1161 | static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi) |
1105 | { | 1162 | { |
1106 | ata_ehi_schedule_probe(ehi); | 1163 | ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1; |
1107 | ehi->flags |= ATA_EHI_HOTPLUGGED; | 1164 | ehi->flags |= ATA_EHI_HOTPLUGGED; |
1108 | ehi->action |= ATA_EH_ENABLE_LINK; | 1165 | ehi->action |= ATA_EH_RESET | ATA_EH_ENABLE_LINK; |
1109 | ehi->err_mask |= AC_ERR_ATA_BUS; | 1166 | ehi->err_mask |= AC_ERR_ATA_BUS; |
1110 | } | 1167 | } |
1111 | 1168 | ||
@@ -1126,7 +1183,7 @@ static inline unsigned int ata_tag_valid(unsigned int tag) | |||
1126 | 1183 | ||
1127 | static inline unsigned int ata_tag_internal(unsigned int tag) | 1184 | static inline unsigned int ata_tag_internal(unsigned int tag) |
1128 | { | 1185 | { |
1129 | return tag == ATA_MAX_QUEUE - 1; | 1186 | return tag == ATA_TAG_INTERNAL; |
1130 | } | 1187 | } |
1131 | 1188 | ||
1132 | /* | 1189 | /* |
@@ -1167,11 +1224,6 @@ static inline unsigned int ata_dev_absent(const struct ata_device *dev) | |||
1167 | /* | 1224 | /* |
1168 | * link helpers | 1225 | * link helpers |
1169 | */ | 1226 | */ |
1170 | static inline int ata_is_host_link(const struct ata_link *link) | ||
1171 | { | ||
1172 | return link == &link->ap->link; | ||
1173 | } | ||
1174 | |||
1175 | static inline int ata_link_max_devices(const struct ata_link *link) | 1227 | static inline int ata_link_max_devices(const struct ata_link *link) |
1176 | { | 1228 | { |
1177 | if (ata_is_host_link(link) && link->ap->flags & ATA_FLAG_SLAVE_POSS) | 1229 | if (ata_is_host_link(link) && link->ap->flags & ATA_FLAG_SLAVE_POSS) |
@@ -1186,7 +1238,7 @@ static inline int ata_link_active(struct ata_link *link) | |||
1186 | 1238 | ||
1187 | static inline struct ata_link *ata_port_first_link(struct ata_port *ap) | 1239 | static inline struct ata_link *ata_port_first_link(struct ata_port *ap) |
1188 | { | 1240 | { |
1189 | if (ap->nr_pmp_links) | 1241 | if (sata_pmp_attached(ap)) |
1190 | return ap->pmp_link; | 1242 | return ap->pmp_link; |
1191 | return &ap->link; | 1243 | return &ap->link; |
1192 | } | 1244 | } |
@@ -1195,8 +1247,8 @@ static inline struct ata_link *ata_port_next_link(struct ata_link *link) | |||
1195 | { | 1247 | { |
1196 | struct ata_port *ap = link->ap; | 1248 | struct ata_port *ap = link->ap; |
1197 | 1249 | ||
1198 | if (link == &ap->link) { | 1250 | if (ata_is_host_link(link)) { |
1199 | if (!ap->nr_pmp_links) | 1251 | if (!sata_pmp_attached(ap)) |
1200 | return NULL; | 1252 | return NULL; |
1201 | return ap->pmp_link; | 1253 | return ap->pmp_link; |
1202 | } | 1254 | } |
@@ -1222,11 +1274,6 @@ static inline struct ata_link *ata_port_next_link(struct ata_link *link) | |||
1222 | for ((dev) = (link)->device + ata_link_max_devices(link) - 1; \ | 1274 | for ((dev) = (link)->device + ata_link_max_devices(link) - 1; \ |
1223 | (dev) >= (link)->device || ((dev) = NULL); (dev)--) | 1275 | (dev) >= (link)->device || ((dev) = NULL); (dev)--) |
1224 | 1276 | ||
1225 | static inline u8 ata_chk_status(struct ata_port *ap) | ||
1226 | { | ||
1227 | return ap->ops->check_status(ap); | ||
1228 | } | ||
1229 | |||
1230 | /** | 1277 | /** |
1231 | * ata_ncq_enabled - Test whether NCQ is enabled | 1278 | * ata_ncq_enabled - Test whether NCQ is enabled |
1232 | * @dev: ATA device to test for | 1279 | * @dev: ATA device to test for |
@@ -1243,74 +1290,6 @@ static inline int ata_ncq_enabled(struct ata_device *dev) | |||
1243 | ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ; | 1290 | ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ; |
1244 | } | 1291 | } |
1245 | 1292 | ||
1246 | /** | ||
1247 | * ata_pause - Flush writes and pause 400 nanoseconds. | ||
1248 | * @ap: Port to wait for. | ||
1249 | * | ||
1250 | * LOCKING: | ||
1251 | * Inherited from caller. | ||
1252 | */ | ||
1253 | |||
1254 | static inline void ata_pause(struct ata_port *ap) | ||
1255 | { | ||
1256 | ata_altstatus(ap); | ||
1257 | ndelay(400); | ||
1258 | } | ||
1259 | |||
1260 | |||
1261 | /** | ||
1262 | * ata_busy_wait - Wait for a port status register | ||
1263 | * @ap: Port to wait for. | ||
1264 | * @bits: bits that must be clear | ||
1265 | * @max: number of 10uS waits to perform | ||
1266 | * | ||
1267 | * Waits up to max*10 microseconds for the selected bits in the port's | ||
1268 | * status register to be cleared. | ||
1269 | * Returns final value of status register. | ||
1270 | * | ||
1271 | * LOCKING: | ||
1272 | * Inherited from caller. | ||
1273 | */ | ||
1274 | |||
1275 | static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits, | ||
1276 | unsigned int max) | ||
1277 | { | ||
1278 | u8 status; | ||
1279 | |||
1280 | do { | ||
1281 | udelay(10); | ||
1282 | status = ata_chk_status(ap); | ||
1283 | max--; | ||
1284 | } while (status != 0xff && (status & bits) && (max > 0)); | ||
1285 | |||
1286 | return status; | ||
1287 | } | ||
1288 | |||
1289 | |||
1290 | /** | ||
1291 | * ata_wait_idle - Wait for a port to be idle. | ||
1292 | * @ap: Port to wait for. | ||
1293 | * | ||
1294 | * Waits up to 10ms for port's BUSY and DRQ signals to clear. | ||
1295 | * Returns final value of status register. | ||
1296 | * | ||
1297 | * LOCKING: | ||
1298 | * Inherited from caller. | ||
1299 | */ | ||
1300 | |||
1301 | static inline u8 ata_wait_idle(struct ata_port *ap) | ||
1302 | { | ||
1303 | u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); | ||
1304 | |||
1305 | #ifdef ATA_DEBUG | ||
1306 | if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ))) | ||
1307 | ata_port_printk(ap, KERN_DEBUG, "abnormal Status 0x%X\n", | ||
1308 | status); | ||
1309 | #endif | ||
1310 | |||
1311 | return status; | ||
1312 | } | ||
1313 | |||
1314 | static inline void ata_qc_set_polling(struct ata_queued_cmd *qc) | 1293 | static inline void ata_qc_set_polling(struct ata_queued_cmd *qc) |
1315 | { | 1294 | { |
1316 | qc->tf.ctl |= ATA_NIEN; | 1295 | qc->tf.ctl |= ATA_NIEN; |
@@ -1403,4 +1382,171 @@ static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host) | |||
1403 | return *(struct ata_port **)&host->hostdata[0]; | 1382 | return *(struct ata_port **)&host->hostdata[0]; |
1404 | } | 1383 | } |
1405 | 1384 | ||
1385 | |||
1386 | /************************************************************************** | ||
1387 | * PMP - drivers/ata/libata-pmp.c | ||
1388 | */ | ||
1389 | #ifdef CONFIG_SATA_PMP | ||
1390 | |||
1391 | extern const struct ata_port_operations sata_pmp_port_ops; | ||
1392 | |||
1393 | extern int sata_pmp_qc_defer_cmd_switch(struct ata_queued_cmd *qc); | ||
1394 | extern void sata_pmp_error_handler(struct ata_port *ap); | ||
1395 | |||
1396 | #else /* CONFIG_SATA_PMP */ | ||
1397 | |||
1398 | #define sata_pmp_port_ops sata_port_ops | ||
1399 | #define sata_pmp_qc_defer_cmd_switch ata_std_qc_defer | ||
1400 | #define sata_pmp_error_handler ata_std_error_handler | ||
1401 | |||
1402 | #endif /* CONFIG_SATA_PMP */ | ||
1403 | |||
1404 | |||
1405 | /************************************************************************** | ||
1406 | * SFF - drivers/ata/libata-sff.c | ||
1407 | */ | ||
1408 | #ifdef CONFIG_ATA_SFF | ||
1409 | |||
1410 | extern const struct ata_port_operations ata_sff_port_ops; | ||
1411 | extern const struct ata_port_operations ata_bmdma_port_ops; | ||
1412 | |||
1413 | /* PIO only, sg_tablesize and dma_boundary limits can be removed */ | ||
1414 | #define ATA_PIO_SHT(drv_name) \ | ||
1415 | ATA_BASE_SHT(drv_name), \ | ||
1416 | .sg_tablesize = LIBATA_MAX_PRD, \ | ||
1417 | .dma_boundary = ATA_DMA_BOUNDARY | ||
1418 | |||
1419 | #define ATA_BMDMA_SHT(drv_name) \ | ||
1420 | ATA_BASE_SHT(drv_name), \ | ||
1421 | .sg_tablesize = LIBATA_MAX_PRD, \ | ||
1422 | .dma_boundary = ATA_DMA_BOUNDARY | ||
1423 | |||
1424 | extern void ata_sff_qc_prep(struct ata_queued_cmd *qc); | ||
1425 | extern void ata_sff_dumb_qc_prep(struct ata_queued_cmd *qc); | ||
1426 | extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device); | ||
1427 | extern u8 ata_sff_check_status(struct ata_port *ap); | ||
1428 | extern u8 ata_sff_altstatus(struct ata_port *ap); | ||
1429 | extern int ata_sff_busy_sleep(struct ata_port *ap, | ||
1430 | unsigned long timeout_pat, unsigned long timeout); | ||
1431 | extern int ata_sff_wait_ready(struct ata_link *link, unsigned long deadline); | ||
1432 | extern void ata_sff_tf_load(struct ata_port *ap, const struct ata_taskfile *tf); | ||
1433 | extern void ata_sff_tf_read(struct ata_port *ap, struct ata_taskfile *tf); | ||
1434 | extern void ata_sff_exec_command(struct ata_port *ap, | ||
1435 | const struct ata_taskfile *tf); | ||
1436 | extern unsigned int ata_sff_data_xfer(struct ata_device *dev, | ||
1437 | unsigned char *buf, unsigned int buflen, int rw); | ||
1438 | extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev, | ||
1439 | unsigned char *buf, unsigned int buflen, int rw); | ||
1440 | extern u8 ata_sff_irq_on(struct ata_port *ap); | ||
1441 | extern void ata_sff_irq_clear(struct ata_port *ap); | ||
1442 | extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, | ||
1443 | u8 status, int in_wq); | ||
1444 | extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc); | ||
1445 | extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc); | ||
1446 | extern unsigned int ata_sff_host_intr(struct ata_port *ap, | ||
1447 | struct ata_queued_cmd *qc); | ||
1448 | extern irqreturn_t ata_sff_interrupt(int irq, void *dev_instance); | ||
1449 | extern void ata_sff_freeze(struct ata_port *ap); | ||
1450 | extern void ata_sff_thaw(struct ata_port *ap); | ||
1451 | extern int ata_sff_prereset(struct ata_link *link, unsigned long deadline); | ||
1452 | extern unsigned int ata_sff_dev_classify(struct ata_device *dev, int present, | ||
1453 | u8 *r_err); | ||
1454 | extern int ata_sff_wait_after_reset(struct ata_link *link, unsigned int devmask, | ||
1455 | unsigned long deadline); | ||
1456 | extern int ata_sff_softreset(struct ata_link *link, unsigned int *classes, | ||
1457 | unsigned long deadline); | ||
1458 | extern int sata_sff_hardreset(struct ata_link *link, unsigned int *class, | ||
1459 | unsigned long deadline); | ||
1460 | extern void ata_sff_postreset(struct ata_link *link, unsigned int *classes); | ||
1461 | extern void ata_sff_error_handler(struct ata_port *ap); | ||
1462 | extern void ata_sff_post_internal_cmd(struct ata_queued_cmd *qc); | ||
1463 | extern int ata_sff_port_start(struct ata_port *ap); | ||
1464 | extern void ata_sff_std_ports(struct ata_ioports *ioaddr); | ||
1465 | extern unsigned long ata_bmdma_mode_filter(struct ata_device *dev, | ||
1466 | unsigned long xfer_mask); | ||
1467 | extern void ata_bmdma_setup(struct ata_queued_cmd *qc); | ||
1468 | extern void ata_bmdma_start(struct ata_queued_cmd *qc); | ||
1469 | extern void ata_bmdma_stop(struct ata_queued_cmd *qc); | ||
1470 | extern u8 ata_bmdma_status(struct ata_port *ap); | ||
1471 | extern void ata_bus_reset(struct ata_port *ap); | ||
1472 | |||
1473 | #ifdef CONFIG_PCI | ||
1474 | extern int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev); | ||
1475 | extern int ata_pci_bmdma_init(struct ata_host *host); | ||
1476 | extern int ata_pci_sff_init_host(struct ata_host *host); | ||
1477 | extern int ata_pci_sff_prepare_host(struct pci_dev *pdev, | ||
1478 | const struct ata_port_info * const * ppi, | ||
1479 | struct ata_host **r_host); | ||
1480 | extern int ata_pci_sff_activate_host(struct ata_host *host, | ||
1481 | irq_handler_t irq_handler, | ||
1482 | struct scsi_host_template *sht); | ||
1483 | extern int ata_pci_sff_init_one(struct pci_dev *pdev, | ||
1484 | const struct ata_port_info * const * ppi, | ||
1485 | struct scsi_host_template *sht, void *host_priv); | ||
1486 | #endif /* CONFIG_PCI */ | ||
1487 | |||
1488 | /** | ||
1489 | * ata_sff_pause - Flush writes and pause 400 nanoseconds. | ||
1490 | * @ap: Port to wait for. | ||
1491 | * | ||
1492 | * LOCKING: | ||
1493 | * Inherited from caller. | ||
1494 | */ | ||
1495 | static inline void ata_sff_pause(struct ata_port *ap) | ||
1496 | { | ||
1497 | ata_sff_altstatus(ap); | ||
1498 | ndelay(400); | ||
1499 | } | ||
1500 | |||
1501 | /** | ||
1502 | * ata_sff_busy_wait - Wait for a port status register | ||
1503 | * @ap: Port to wait for. | ||
1504 | * @bits: bits that must be clear | ||
1505 | * @max: number of 10uS waits to perform | ||
1506 | * | ||
1507 | * Waits up to max*10 microseconds for the selected bits in the port's | ||
1508 | * status register to be cleared. | ||
1509 | * Returns final value of status register. | ||
1510 | * | ||
1511 | * LOCKING: | ||
1512 | * Inherited from caller. | ||
1513 | */ | ||
1514 | static inline u8 ata_sff_busy_wait(struct ata_port *ap, unsigned int bits, | ||
1515 | unsigned int max) | ||
1516 | { | ||
1517 | u8 status; | ||
1518 | |||
1519 | do { | ||
1520 | udelay(10); | ||
1521 | status = ap->ops->sff_check_status(ap); | ||
1522 | max--; | ||
1523 | } while (status != 0xff && (status & bits) && (max > 0)); | ||
1524 | |||
1525 | return status; | ||
1526 | } | ||
1527 | |||
1528 | /** | ||
1529 | * ata_wait_idle - Wait for a port to be idle. | ||
1530 | * @ap: Port to wait for. | ||
1531 | * | ||
1532 | * Waits up to 10ms for port's BUSY and DRQ signals to clear. | ||
1533 | * Returns final value of status register. | ||
1534 | * | ||
1535 | * LOCKING: | ||
1536 | * Inherited from caller. | ||
1537 | */ | ||
1538 | static inline u8 ata_wait_idle(struct ata_port *ap) | ||
1539 | { | ||
1540 | u8 status = ata_sff_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); | ||
1541 | |||
1542 | #ifdef ATA_DEBUG | ||
1543 | if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ))) | ||
1544 | ata_port_printk(ap, KERN_DEBUG, "abnormal Status 0x%X\n", | ||
1545 | status); | ||
1546 | #endif | ||
1547 | |||
1548 | return status; | ||
1549 | } | ||
1550 | #endif /* CONFIG_ATA_SFF */ | ||
1551 | |||
1406 | #endif /* __LINUX_LIBATA_H__ */ | 1552 | #endif /* __LINUX_LIBATA_H__ */ |
diff --git a/include/linux/lm_interface.h b/include/linux/lm_interface.h index 1418fdc9ac02..f274997bc283 100644 --- a/include/linux/lm_interface.h +++ b/include/linux/lm_interface.h | |||
@@ -21,9 +21,15 @@ typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data); | |||
21 | * modify the filesystem. The lock module shouldn't assign a journal to the FS | 21 | * modify the filesystem. The lock module shouldn't assign a journal to the FS |
22 | * mount. It shouldn't send recovery callbacks to the FS mount. If the node | 22 | * mount. It shouldn't send recovery callbacks to the FS mount. If the node |
23 | * dies or withdraws, all locks can be wiped immediately. | 23 | * dies or withdraws, all locks can be wiped immediately. |
24 | * | ||
25 | * LM_MFLAG_CONV_NODROP | ||
26 | * Do not allow the dlm to internally resolve conversion deadlocks by demoting | ||
27 | * the lock to unlocked and then reacquiring it in the requested mode. Instead, | ||
28 | * it should cancel the request and return LM_OUT_CONV_DEADLK. | ||
24 | */ | 29 | */ |
25 | 30 | ||
26 | #define LM_MFLAG_SPECTATOR 0x00000001 | 31 | #define LM_MFLAG_SPECTATOR 0x00000001 |
32 | #define LM_MFLAG_CONV_NODROP 0x00000002 | ||
27 | 33 | ||
28 | /* | 34 | /* |
29 | * lm_lockstruct flags | 35 | * lm_lockstruct flags |
@@ -110,6 +116,9 @@ typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data); | |||
110 | * | 116 | * |
111 | * LM_OUT_ASYNC | 117 | * LM_OUT_ASYNC |
112 | * The result of the request will be returned in an LM_CB_ASYNC callback. | 118 | * The result of the request will be returned in an LM_CB_ASYNC callback. |
119 | * | ||
120 | * LM_OUT_CONV_DEADLK | ||
121 | * The lock request was canceled do to a conversion deadlock. | ||
113 | */ | 122 | */ |
114 | 123 | ||
115 | #define LM_OUT_ST_MASK 0x00000003 | 124 | #define LM_OUT_ST_MASK 0x00000003 |
@@ -117,6 +126,7 @@ typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data); | |||
117 | #define LM_OUT_CANCELED 0x00000008 | 126 | #define LM_OUT_CANCELED 0x00000008 |
118 | #define LM_OUT_ASYNC 0x00000080 | 127 | #define LM_OUT_ASYNC 0x00000080 |
119 | #define LM_OUT_ERROR 0x00000100 | 128 | #define LM_OUT_ERROR 0x00000100 |
129 | #define LM_OUT_CONV_DEADLK 0x00000200 | ||
120 | 130 | ||
121 | /* | 131 | /* |
122 | * lm_callback_t types | 132 | * lm_callback_t types |
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h index 7d1eaa97de13..77323a72dd3c 100644 --- a/include/linux/mlx4/cmd.h +++ b/include/linux/mlx4/cmd.h | |||
@@ -81,7 +81,7 @@ enum { | |||
81 | MLX4_CMD_SW2HW_CQ = 0x16, | 81 | MLX4_CMD_SW2HW_CQ = 0x16, |
82 | MLX4_CMD_HW2SW_CQ = 0x17, | 82 | MLX4_CMD_HW2SW_CQ = 0x17, |
83 | MLX4_CMD_QUERY_CQ = 0x18, | 83 | MLX4_CMD_QUERY_CQ = 0x18, |
84 | MLX4_CMD_RESIZE_CQ = 0x2c, | 84 | MLX4_CMD_MODIFY_CQ = 0x2c, |
85 | 85 | ||
86 | /* SRQ commands */ | 86 | /* SRQ commands */ |
87 | MLX4_CMD_SW2HW_SRQ = 0x35, | 87 | MLX4_CMD_SW2HW_SRQ = 0x35, |
diff --git a/include/linux/mlx4/cq.h b/include/linux/mlx4/cq.h index 0181e0a57cbf..071cf96cf01f 100644 --- a/include/linux/mlx4/cq.h +++ b/include/linux/mlx4/cq.h | |||
@@ -45,11 +45,11 @@ struct mlx4_cqe { | |||
45 | u8 sl; | 45 | u8 sl; |
46 | u8 reserved1; | 46 | u8 reserved1; |
47 | __be16 rlid; | 47 | __be16 rlid; |
48 | u32 reserved2; | 48 | __be32 ipoib_status; |
49 | __be32 byte_cnt; | 49 | __be32 byte_cnt; |
50 | __be16 wqe_index; | 50 | __be16 wqe_index; |
51 | __be16 checksum; | 51 | __be16 checksum; |
52 | u8 reserved3[3]; | 52 | u8 reserved2[3]; |
53 | u8 owner_sr_opcode; | 53 | u8 owner_sr_opcode; |
54 | }; | 54 | }; |
55 | 55 | ||
@@ -85,6 +85,16 @@ enum { | |||
85 | MLX4_CQE_SYNDROME_REMOTE_ABORTED_ERR = 0x22, | 85 | MLX4_CQE_SYNDROME_REMOTE_ABORTED_ERR = 0x22, |
86 | }; | 86 | }; |
87 | 87 | ||
88 | enum { | ||
89 | MLX4_CQE_IPOIB_STATUS_IPV4 = 1 << 22, | ||
90 | MLX4_CQE_IPOIB_STATUS_IPV4F = 1 << 23, | ||
91 | MLX4_CQE_IPOIB_STATUS_IPV6 = 1 << 24, | ||
92 | MLX4_CQE_IPOIB_STATUS_IPV4OPT = 1 << 25, | ||
93 | MLX4_CQE_IPOIB_STATUS_TCP = 1 << 26, | ||
94 | MLX4_CQE_IPOIB_STATUS_UDP = 1 << 27, | ||
95 | MLX4_CQE_IPOIB_STATUS_IPOK = 1 << 28, | ||
96 | }; | ||
97 | |||
88 | static inline void mlx4_cq_arm(struct mlx4_cq *cq, u32 cmd, | 98 | static inline void mlx4_cq_arm(struct mlx4_cq *cq, u32 cmd, |
89 | void __iomem *uar_page, | 99 | void __iomem *uar_page, |
90 | spinlock_t *doorbell_lock) | 100 | spinlock_t *doorbell_lock) |
@@ -120,4 +130,9 @@ enum { | |||
120 | MLX4_CQ_DB_REQ_NOT = 2 << 24 | 130 | MLX4_CQ_DB_REQ_NOT = 2 << 24 |
121 | }; | 131 | }; |
122 | 132 | ||
133 | int mlx4_cq_modify(struct mlx4_dev *dev, struct mlx4_cq *cq, | ||
134 | u16 count, u16 period); | ||
135 | int mlx4_cq_resize(struct mlx4_dev *dev, struct mlx4_cq *cq, | ||
136 | int entries, struct mlx4_mtt *mtt); | ||
137 | |||
123 | #endif /* MLX4_CQ_H */ | 138 | #endif /* MLX4_CQ_H */ |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index 6cdf813cd478..ff7df1a2222f 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
@@ -186,6 +186,7 @@ struct mlx4_caps { | |||
186 | u32 flags; | 186 | u32 flags; |
187 | u16 stat_rate_support; | 187 | u16 stat_rate_support; |
188 | u8 port_width_cap[MLX4_MAX_PORTS + 1]; | 188 | u8 port_width_cap[MLX4_MAX_PORTS + 1]; |
189 | int max_gso_sz; | ||
189 | }; | 190 | }; |
190 | 191 | ||
191 | struct mlx4_buf_list { | 192 | struct mlx4_buf_list { |
diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h index 1b835ca49df1..53c5fdb6eac4 100644 --- a/include/linux/mlx4/driver.h +++ b/include/linux/mlx4/driver.h | |||
@@ -48,8 +48,7 @@ struct mlx4_interface { | |||
48 | void * (*add) (struct mlx4_dev *dev); | 48 | void * (*add) (struct mlx4_dev *dev); |
49 | void (*remove)(struct mlx4_dev *dev, void *context); | 49 | void (*remove)(struct mlx4_dev *dev, void *context); |
50 | void (*event) (struct mlx4_dev *dev, void *context, | 50 | void (*event) (struct mlx4_dev *dev, void *context, |
51 | enum mlx4_dev_event event, int subtype, | 51 | enum mlx4_dev_event event, int port); |
52 | int port); | ||
53 | struct list_head list; | 52 | struct list_head list; |
54 | }; | 53 | }; |
55 | 54 | ||
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h index 09a2230923f2..a5e43febee4f 100644 --- a/include/linux/mlx4/qp.h +++ b/include/linux/mlx4/qp.h | |||
@@ -158,10 +158,12 @@ struct mlx4_qp_context { | |||
158 | #define MLX4_FW_VER_WQE_CTRL_NEC mlx4_fw_ver(2, 2, 232) | 158 | #define MLX4_FW_VER_WQE_CTRL_NEC mlx4_fw_ver(2, 2, 232) |
159 | 159 | ||
160 | enum { | 160 | enum { |
161 | MLX4_WQE_CTRL_NEC = 1 << 29, | 161 | MLX4_WQE_CTRL_NEC = 1 << 29, |
162 | MLX4_WQE_CTRL_FENCE = 1 << 6, | 162 | MLX4_WQE_CTRL_FENCE = 1 << 6, |
163 | MLX4_WQE_CTRL_CQ_UPDATE = 3 << 2, | 163 | MLX4_WQE_CTRL_CQ_UPDATE = 3 << 2, |
164 | MLX4_WQE_CTRL_SOLICITED = 1 << 1, | 164 | MLX4_WQE_CTRL_SOLICITED = 1 << 1, |
165 | MLX4_WQE_CTRL_IP_CSUM = 1 << 4, | ||
166 | MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5, | ||
165 | }; | 167 | }; |
166 | 168 | ||
167 | struct mlx4_wqe_ctrl_seg { | 169 | struct mlx4_wqe_ctrl_seg { |
@@ -217,6 +219,11 @@ struct mlx4_wqe_datagram_seg { | |||
217 | __be32 reservd[2]; | 219 | __be32 reservd[2]; |
218 | }; | 220 | }; |
219 | 221 | ||
222 | struct mlx4_lso_seg { | ||
223 | __be32 mss_hdr_size; | ||
224 | __be32 header[0]; | ||
225 | }; | ||
226 | |||
220 | struct mlx4_wqe_bind_seg { | 227 | struct mlx4_wqe_bind_seg { |
221 | __be32 flags1; | 228 | __be32 flags1; |
222 | __be32 flags2; | 229 | __be32 flags2; |
diff --git a/include/linux/mtio.h b/include/linux/mtio.h index 6f8d2d45a8fb..ef01d6aa5934 100644 --- a/include/linux/mtio.h +++ b/include/linux/mtio.h | |||
@@ -192,6 +192,7 @@ struct mtpos { | |||
192 | #define MT_ST_SCSI2LOGICAL 0x800 | 192 | #define MT_ST_SCSI2LOGICAL 0x800 |
193 | #define MT_ST_SYSV 0x1000 | 193 | #define MT_ST_SYSV 0x1000 |
194 | #define MT_ST_NOWAIT 0x2000 | 194 | #define MT_ST_NOWAIT 0x2000 |
195 | #define MT_ST_SILI 0x4000 | ||
195 | 196 | ||
196 | /* The mode parameters to be controlled. Parameter chosen with bits 20-28 */ | 197 | /* The mode parameters to be controlled. Parameter chosen with bits 20-28 */ |
197 | #define MT_ST_CLEAR_DEFAULT 0xfffff | 198 | #define MT_ST_CLEAR_DEFAULT 0xfffff |
diff --git a/include/linux/quota.h b/include/linux/quota.h index 6e0393a5b2ea..eb560d031acd 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
@@ -160,14 +160,18 @@ enum { | |||
160 | 160 | ||
161 | 161 | ||
162 | #ifdef __KERNEL__ | 162 | #ifdef __KERNEL__ |
163 | #include <linux/spinlock.h> | 163 | #include <linux/list.h> |
164 | #include <linux/rwsem.h> | ||
165 | #include <linux/mutex.h> | 164 | #include <linux/mutex.h> |
165 | #include <linux/rwsem.h> | ||
166 | #include <linux/spinlock.h> | ||
167 | #include <linux/wait.h> | ||
166 | 168 | ||
167 | #include <linux/dqblk_xfs.h> | 169 | #include <linux/dqblk_xfs.h> |
168 | #include <linux/dqblk_v1.h> | 170 | #include <linux/dqblk_v1.h> |
169 | #include <linux/dqblk_v2.h> | 171 | #include <linux/dqblk_v2.h> |
170 | 172 | ||
173 | #include <asm/atomic.h> | ||
174 | |||
171 | extern spinlock_t dq_data_lock; | 175 | extern spinlock_t dq_data_lock; |
172 | 176 | ||
173 | /* Maximal numbers of writes for quota operation (insert/delete/update) | 177 | /* Maximal numbers of writes for quota operation (insert/delete/update) |
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index a3d567a974e8..71fc81360048 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h | |||
@@ -213,6 +213,11 @@ int __sg_alloc_table(struct sg_table *, unsigned int, unsigned int, gfp_t, | |||
213 | sg_alloc_fn *); | 213 | sg_alloc_fn *); |
214 | int sg_alloc_table(struct sg_table *, unsigned int, gfp_t); | 214 | int sg_alloc_table(struct sg_table *, unsigned int, gfp_t); |
215 | 215 | ||
216 | size_t sg_copy_from_buffer(struct scatterlist *sgl, unsigned int nents, | ||
217 | void *buf, size_t buflen); | ||
218 | size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents, | ||
219 | void *buf, size_t buflen); | ||
220 | |||
216 | /* | 221 | /* |
217 | * Maximum number of entries that will be allocated in one piece, if | 222 | * Maximum number of entries that will be allocated in one piece, if |
218 | * a list larger than this is required then chaining will be utilized. | 223 | * a list larger than this is required then chaining will be utilized. |
diff --git a/include/linux/semaphore.h b/include/linux/semaphore.h new file mode 100644 index 000000000000..9cae64b00d6b --- /dev/null +++ b/include/linux/semaphore.h | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2008 Intel Corporation | ||
3 | * Author: Matthew Wilcox <willy@linux.intel.com> | ||
4 | * | ||
5 | * Distributed under the terms of the GNU GPL, version 2 | ||
6 | * | ||
7 | * Please see kernel/semaphore.c for documentation of these functions | ||
8 | */ | ||
9 | #ifndef __LINUX_SEMAPHORE_H | ||
10 | #define __LINUX_SEMAPHORE_H | ||
11 | |||
12 | #include <linux/list.h> | ||
13 | #include <linux/spinlock.h> | ||
14 | |||
15 | /* Please don't access any members of this structure directly */ | ||
16 | struct semaphore { | ||
17 | spinlock_t lock; | ||
18 | unsigned int count; | ||
19 | struct list_head wait_list; | ||
20 | }; | ||
21 | |||
22 | #define __SEMAPHORE_INITIALIZER(name, n) \ | ||
23 | { \ | ||
24 | .lock = __SPIN_LOCK_UNLOCKED((name).lock), \ | ||
25 | .count = n, \ | ||
26 | .wait_list = LIST_HEAD_INIT((name).wait_list), \ | ||
27 | } | ||
28 | |||
29 | #define __DECLARE_SEMAPHORE_GENERIC(name, count) \ | ||
30 | struct semaphore name = __SEMAPHORE_INITIALIZER(name, count) | ||
31 | |||
32 | #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name, 1) | ||
33 | |||
34 | static inline void sema_init(struct semaphore *sem, int val) | ||
35 | { | ||
36 | static struct lock_class_key __key; | ||
37 | *sem = (struct semaphore) __SEMAPHORE_INITIALIZER(*sem, val); | ||
38 | lockdep_init_map(&sem->lock.dep_map, "semaphore->lock", &__key, 0); | ||
39 | } | ||
40 | |||
41 | #define init_MUTEX(sem) sema_init(sem, 1) | ||
42 | #define init_MUTEX_LOCKED(sem) sema_init(sem, 0) | ||
43 | |||
44 | extern void down(struct semaphore *sem); | ||
45 | extern int __must_check down_interruptible(struct semaphore *sem); | ||
46 | extern int __must_check down_killable(struct semaphore *sem); | ||
47 | extern int __must_check down_trylock(struct semaphore *sem); | ||
48 | extern int __must_check down_timeout(struct semaphore *sem, long jiffies); | ||
49 | extern void up(struct semaphore *sem); | ||
50 | |||
51 | #endif /* __LINUX_SEMAPHORE_H */ | ||
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 289942fc6655..7cb094a82456 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
@@ -213,6 +213,10 @@ struct uart_ops { | |||
213 | void (*config_port)(struct uart_port *, int); | 213 | void (*config_port)(struct uart_port *, int); |
214 | int (*verify_port)(struct uart_port *, struct serial_struct *); | 214 | int (*verify_port)(struct uart_port *, struct serial_struct *); |
215 | int (*ioctl)(struct uart_port *, unsigned int, unsigned long); | 215 | int (*ioctl)(struct uart_port *, unsigned int, unsigned long); |
216 | #ifdef CONFIG_CONSOLE_POLL | ||
217 | void (*poll_put_char)(struct uart_port *, unsigned char); | ||
218 | int (*poll_get_char)(struct uart_port *); | ||
219 | #endif | ||
216 | }; | 220 | }; |
217 | 221 | ||
218 | #define UART_CONFIG_TYPE (1 << 0) | 222 | #define UART_CONFIG_TYPE (1 << 0) |
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index b00c1c73eb0a..79d59c937fac 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h | |||
@@ -45,9 +45,9 @@ struct kmem_cache_cpu { | |||
45 | struct kmem_cache_node { | 45 | struct kmem_cache_node { |
46 | spinlock_t list_lock; /* Protect partial list and nr_partial */ | 46 | spinlock_t list_lock; /* Protect partial list and nr_partial */ |
47 | unsigned long nr_partial; | 47 | unsigned long nr_partial; |
48 | atomic_long_t nr_slabs; | ||
49 | struct list_head partial; | 48 | struct list_head partial; |
50 | #ifdef CONFIG_SLUB_DEBUG | 49 | #ifdef CONFIG_SLUB_DEBUG |
50 | atomic_long_t nr_slabs; | ||
51 | struct list_head full; | 51 | struct list_head full; |
52 | #endif | 52 | #endif |
53 | }; | 53 | }; |
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 1129ee0a7180..d311a090fae7 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h | |||
@@ -296,43 +296,6 @@ do { \ | |||
296 | }) | 296 | }) |
297 | 297 | ||
298 | /* | 298 | /* |
299 | * Locks two spinlocks l1 and l2. | ||
300 | * l1_first indicates if spinlock l1 should be taken first. | ||
301 | */ | ||
302 | static inline void double_spin_lock(spinlock_t *l1, spinlock_t *l2, | ||
303 | bool l1_first) | ||
304 | __acquires(l1) | ||
305 | __acquires(l2) | ||
306 | { | ||
307 | if (l1_first) { | ||
308 | spin_lock(l1); | ||
309 | spin_lock(l2); | ||
310 | } else { | ||
311 | spin_lock(l2); | ||
312 | spin_lock(l1); | ||
313 | } | ||
314 | } | ||
315 | |||
316 | /* | ||
317 | * Unlocks two spinlocks l1 and l2. | ||
318 | * l1_taken_first indicates if spinlock l1 was taken first and therefore | ||
319 | * should be released after spinlock l2. | ||
320 | */ | ||
321 | static inline void double_spin_unlock(spinlock_t *l1, spinlock_t *l2, | ||
322 | bool l1_taken_first) | ||
323 | __releases(l1) | ||
324 | __releases(l2) | ||
325 | { | ||
326 | if (l1_taken_first) { | ||
327 | spin_unlock(l2); | ||
328 | spin_unlock(l1); | ||
329 | } else { | ||
330 | spin_unlock(l1); | ||
331 | spin_unlock(l2); | ||
332 | } | ||
333 | } | ||
334 | |||
335 | /* | ||
336 | * Pull the atomic_t declaration: | 299 | * Pull the atomic_t declaration: |
337 | * (asm-mips/atomic.h needs above definitions) | 300 | * (asm-mips/atomic.h needs above definitions) |
338 | */ | 301 | */ |
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h index 421323e5a2d6..accd7bad35b0 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h | |||
@@ -9,6 +9,9 @@ | |||
9 | 9 | ||
10 | #include <linux/types.h> | 10 | #include <linux/types.h> |
11 | 11 | ||
12 | struct timespec; | ||
13 | struct compat_timespec; | ||
14 | |||
12 | /* | 15 | /* |
13 | * System call restart block. | 16 | * System call restart block. |
14 | */ | 17 | */ |
@@ -26,6 +29,15 @@ struct restart_block { | |||
26 | u32 bitset; | 29 | u32 bitset; |
27 | u64 time; | 30 | u64 time; |
28 | } futex; | 31 | } futex; |
32 | /* For nanosleep */ | ||
33 | struct { | ||
34 | clockid_t index; | ||
35 | struct timespec __user *rmtp; | ||
36 | #ifdef CONFIG_COMPAT | ||
37 | struct compat_timespec __user *compat_rmtp; | ||
38 | #endif | ||
39 | u64 expires; | ||
40 | } nanosleep; | ||
29 | }; | 41 | }; |
30 | }; | 42 | }; |
31 | 43 | ||
diff --git a/include/linux/transport_class.h b/include/linux/transport_class.h index 1d6cc22e5f42..6696cf79c4f7 100644 --- a/include/linux/transport_class.h +++ b/include/linux/transport_class.h | |||
@@ -86,9 +86,10 @@ static inline int transport_container_register(struct transport_container *tc) | |||
86 | return attribute_container_register(&tc->ac); | 86 | return attribute_container_register(&tc->ac); |
87 | } | 87 | } |
88 | 88 | ||
89 | static inline int transport_container_unregister(struct transport_container *tc) | 89 | static inline void transport_container_unregister(struct transport_container *tc) |
90 | { | 90 | { |
91 | return attribute_container_unregister(&tc->ac); | 91 | if (unlikely(attribute_container_unregister(&tc->ac))) |
92 | BUG(); | ||
92 | } | 93 | } |
93 | 94 | ||
94 | int transport_class_register(struct transport_class *); | 95 | int transport_class_register(struct transport_class *); |
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index 85c95cd39bc3..21f69aca4505 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h | |||
@@ -125,6 +125,7 @@ | |||
125 | #include <linux/cdev.h> | 125 | #include <linux/cdev.h> |
126 | 126 | ||
127 | struct tty_struct; | 127 | struct tty_struct; |
128 | struct tty_driver; | ||
128 | 129 | ||
129 | struct tty_operations { | 130 | struct tty_operations { |
130 | int (*open)(struct tty_struct * tty, struct file * filp); | 131 | int (*open)(struct tty_struct * tty, struct file * filp); |
@@ -157,6 +158,11 @@ struct tty_operations { | |||
157 | int (*tiocmget)(struct tty_struct *tty, struct file *file); | 158 | int (*tiocmget)(struct tty_struct *tty, struct file *file); |
158 | int (*tiocmset)(struct tty_struct *tty, struct file *file, | 159 | int (*tiocmset)(struct tty_struct *tty, struct file *file, |
159 | unsigned int set, unsigned int clear); | 160 | unsigned int set, unsigned int clear); |
161 | #ifdef CONFIG_CONSOLE_POLL | ||
162 | int (*poll_init)(struct tty_driver *driver, int line, char *options); | ||
163 | int (*poll_get_char)(struct tty_driver *driver, int line); | ||
164 | void (*poll_put_char)(struct tty_driver *driver, int line, char ch); | ||
165 | #endif | ||
160 | }; | 166 | }; |
161 | 167 | ||
162 | struct tty_driver { | 168 | struct tty_driver { |
@@ -220,6 +226,11 @@ struct tty_driver { | |||
220 | int (*tiocmget)(struct tty_struct *tty, struct file *file); | 226 | int (*tiocmget)(struct tty_struct *tty, struct file *file); |
221 | int (*tiocmset)(struct tty_struct *tty, struct file *file, | 227 | int (*tiocmset)(struct tty_struct *tty, struct file *file, |
222 | unsigned int set, unsigned int clear); | 228 | unsigned int set, unsigned int clear); |
229 | #ifdef CONFIG_CONSOLE_POLL | ||
230 | int (*poll_init)(struct tty_driver *driver, int line, char *options); | ||
231 | int (*poll_get_char)(struct tty_driver *driver, int line); | ||
232 | void (*poll_put_char)(struct tty_driver *driver, int line, char ch); | ||
233 | #endif | ||
223 | 234 | ||
224 | struct list_head tty_drivers; | 235 | struct list_head tty_drivers; |
225 | }; | 236 | }; |
@@ -230,6 +241,7 @@ struct tty_driver *alloc_tty_driver(int lines); | |||
230 | void put_tty_driver(struct tty_driver *driver); | 241 | void put_tty_driver(struct tty_driver *driver); |
231 | void tty_set_operations(struct tty_driver *driver, | 242 | void tty_set_operations(struct tty_driver *driver, |
232 | const struct tty_operations *op); | 243 | const struct tty_operations *op); |
244 | extern struct tty_driver *tty_find_polling_driver(char *name, int *line); | ||
233 | 245 | ||
234 | /* tty driver magic number */ | 246 | /* tty driver magic number */ |
235 | #define TTY_DRIVER_MAGIC 0x5402 | 247 | #define TTY_DRIVER_MAGIC 0x5402 |
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index 975c963e5789..fec6decfb983 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h | |||
@@ -84,4 +84,26 @@ static inline unsigned long __copy_from_user_nocache(void *to, | |||
84 | ret; \ | 84 | ret; \ |
85 | }) | 85 | }) |
86 | 86 | ||
87 | /* | ||
88 | * probe_kernel_read(): safely attempt to read from a location | ||
89 | * @dst: pointer to the buffer that shall take the data | ||
90 | * @src: address to read from | ||
91 | * @size: size of the data chunk | ||
92 | * | ||
93 | * Safely read from address @src to the buffer at @dst. If a kernel fault | ||
94 | * happens, handle that and return -EFAULT. | ||
95 | */ | ||
96 | extern long probe_kernel_read(void *dst, void *src, size_t size); | ||
97 | |||
98 | /* | ||
99 | * probe_kernel_write(): safely attempt to write to a location | ||
100 | * @dst: address to write to | ||
101 | * @src: pointer to the data that shall be written | ||
102 | * @size: size of the data chunk | ||
103 | * | ||
104 | * Safely write to address @dst from the buffer at @src. If a kernel fault | ||
105 | * happens, handle that and return -EFAULT. | ||
106 | */ | ||
107 | extern long probe_kernel_write(void *dst, void *src, size_t size); | ||
108 | |||
87 | #endif /* __LINUX_UACCESS_H__ */ | 109 | #endif /* __LINUX_UACCESS_H__ */ |