diff options
Diffstat (limited to 'include')
73 files changed, 2190 insertions, 618 deletions
diff --git a/include/drm/Kbuild b/include/drm/Kbuild index 3a60ac889520..a5c0e10fd47d 100644 --- a/include/drm/Kbuild +++ b/include/drm/Kbuild | |||
@@ -1,4 +1,5 @@ | |||
1 | header-y += drm.h | 1 | header-y += drm.h |
2 | header-y += drm_fourcc.h | ||
2 | header-y += drm_mode.h | 3 | header-y += drm_mode.h |
3 | header-y += drm_sarea.h | 4 | header-y += drm_sarea.h |
4 | header-y += i810_drm.h | 5 | header-y += i810_drm.h |
diff --git a/include/drm/drm.h b/include/drm/drm.h index 4be33b4ca2f8..49d94ede2ec2 100644 --- a/include/drm/drm.h +++ b/include/drm/drm.h | |||
@@ -714,6 +714,10 @@ struct drm_get_cap { | |||
714 | #define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb) | 714 | #define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb) |
715 | #define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb) | 715 | #define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb) |
716 | #define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb) | 716 | #define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb) |
717 | #define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res) | ||
718 | #define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane) | ||
719 | #define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane) | ||
720 | #define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2) | ||
717 | 721 | ||
718 | /** | 722 | /** |
719 | * Device specific ioctls should only be in their respective headers | 723 | * Device specific ioctls should only be in their respective headers |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index e8acca892af0..76caa67c22e2 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -918,7 +918,7 @@ struct drm_driver { | |||
918 | int dev_priv_size; | 918 | int dev_priv_size; |
919 | struct drm_ioctl_desc *ioctls; | 919 | struct drm_ioctl_desc *ioctls; |
920 | int num_ioctls; | 920 | int num_ioctls; |
921 | struct file_operations fops; | 921 | const struct file_operations *fops; |
922 | union { | 922 | union { |
923 | struct pci_driver *pci; | 923 | struct pci_driver *pci; |
924 | struct platform_device *platform_device; | 924 | struct platform_device *platform_device; |
@@ -1696,5 +1696,13 @@ extern void drm_platform_exit(struct drm_driver *driver, struct platform_device | |||
1696 | extern int drm_get_platform_dev(struct platform_device *pdev, | 1696 | extern int drm_get_platform_dev(struct platform_device *pdev, |
1697 | struct drm_driver *driver); | 1697 | struct drm_driver *driver); |
1698 | 1698 | ||
1699 | /* returns true if currently okay to sleep */ | ||
1700 | static __inline__ bool drm_can_sleep(void) | ||
1701 | { | ||
1702 | if (in_atomic() || in_dbg_master() || irqs_disabled()) | ||
1703 | return false; | ||
1704 | return true; | ||
1705 | } | ||
1706 | |||
1699 | #endif /* __KERNEL__ */ | 1707 | #endif /* __KERNEL__ */ |
1700 | #endif | 1708 | #endif |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 802079809282..63e4fce67288 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -29,9 +29,10 @@ | |||
29 | #include <linux/spinlock.h> | 29 | #include <linux/spinlock.h> |
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/idr.h> | 31 | #include <linux/idr.h> |
32 | |||
33 | #include <linux/fb.h> | 32 | #include <linux/fb.h> |
34 | 33 | ||
34 | #include <drm/drm_fourcc.h> | ||
35 | |||
35 | struct drm_device; | 36 | struct drm_device; |
36 | struct drm_mode_set; | 37 | struct drm_mode_set; |
37 | struct drm_framebuffer; | 38 | struct drm_framebuffer; |
@@ -44,6 +45,7 @@ struct drm_framebuffer; | |||
44 | #define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0 | 45 | #define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0 |
45 | #define DRM_MODE_OBJECT_FB 0xfbfbfbfb | 46 | #define DRM_MODE_OBJECT_FB 0xfbfbfbfb |
46 | #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb | 47 | #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb |
48 | #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee | ||
47 | 49 | ||
48 | struct drm_mode_object { | 50 | struct drm_mode_object { |
49 | uint32_t id; | 51 | uint32_t id; |
@@ -118,7 +120,6 @@ struct drm_display_mode { | |||
118 | 120 | ||
119 | char name[DRM_DISPLAY_MODE_LEN]; | 121 | char name[DRM_DISPLAY_MODE_LEN]; |
120 | 122 | ||
121 | int connector_count; | ||
122 | enum drm_mode_status status; | 123 | enum drm_mode_status status; |
123 | int type; | 124 | int type; |
124 | 125 | ||
@@ -238,13 +239,15 @@ struct drm_framebuffer { | |||
238 | struct list_head head; | 239 | struct list_head head; |
239 | struct drm_mode_object base; | 240 | struct drm_mode_object base; |
240 | const struct drm_framebuffer_funcs *funcs; | 241 | const struct drm_framebuffer_funcs *funcs; |
241 | unsigned int pitch; | 242 | unsigned int pitches[4]; |
243 | unsigned int offsets[4]; | ||
242 | unsigned int width; | 244 | unsigned int width; |
243 | unsigned int height; | 245 | unsigned int height; |
244 | /* depth can be 15 or 16 */ | 246 | /* depth can be 15 or 16 */ |
245 | unsigned int depth; | 247 | unsigned int depth; |
246 | int bits_per_pixel; | 248 | int bits_per_pixel; |
247 | int flags; | 249 | int flags; |
250 | uint32_t pixel_format; /* fourcc format */ | ||
248 | struct list_head filp_head; | 251 | struct list_head filp_head; |
249 | /* if you are using the helper */ | 252 | /* if you are using the helper */ |
250 | void *helper_private; | 253 | void *helper_private; |
@@ -278,6 +281,7 @@ struct drm_crtc; | |||
278 | struct drm_connector; | 281 | struct drm_connector; |
279 | struct drm_encoder; | 282 | struct drm_encoder; |
280 | struct drm_pending_vblank_event; | 283 | struct drm_pending_vblank_event; |
284 | struct drm_plane; | ||
281 | 285 | ||
282 | /** | 286 | /** |
283 | * drm_crtc_funcs - control CRTCs for a given device | 287 | * drm_crtc_funcs - control CRTCs for a given device |
@@ -341,10 +345,21 @@ struct drm_crtc_funcs { | |||
341 | 345 | ||
342 | /** | 346 | /** |
343 | * drm_crtc - central CRTC control structure | 347 | * drm_crtc - central CRTC control structure |
348 | * @dev: parent DRM device | ||
349 | * @head: list management | ||
350 | * @base: base KMS object for ID tracking etc. | ||
344 | * @enabled: is this CRTC enabled? | 351 | * @enabled: is this CRTC enabled? |
352 | * @mode: current mode timings | ||
353 | * @hwmode: mode timings as programmed to hw regs | ||
345 | * @x: x position on screen | 354 | * @x: x position on screen |
346 | * @y: y position on screen | 355 | * @y: y position on screen |
347 | * @funcs: CRTC control functions | 356 | * @funcs: CRTC control functions |
357 | * @gamma_size: size of gamma ramp | ||
358 | * @gamma_store: gamma ramp values | ||
359 | * @framedur_ns: precise frame timing | ||
360 | * @framedur_ns: precise line timing | ||
361 | * @pixeldur_ns: precise pixel timing | ||
362 | * @helper_private: mid-layer private data | ||
348 | * | 363 | * |
349 | * Each CRTC may have one or more connectors associated with it. This structure | 364 | * Each CRTC may have one or more connectors associated with it. This structure |
350 | * allows the CRTC to be controlled. | 365 | * allows the CRTC to be controlled. |
@@ -423,6 +438,13 @@ struct drm_connector_funcs { | |||
423 | void (*force)(struct drm_connector *connector); | 438 | void (*force)(struct drm_connector *connector); |
424 | }; | 439 | }; |
425 | 440 | ||
441 | /** | ||
442 | * drm_encoder_funcs - encoder controls | ||
443 | * @reset: reset state (e.g. at init or resume time) | ||
444 | * @destroy: cleanup and free associated data | ||
445 | * | ||
446 | * Encoders sit between CRTCs and connectors. | ||
447 | */ | ||
426 | struct drm_encoder_funcs { | 448 | struct drm_encoder_funcs { |
427 | void (*reset)(struct drm_encoder *encoder); | 449 | void (*reset)(struct drm_encoder *encoder); |
428 | void (*destroy)(struct drm_encoder *encoder); | 450 | void (*destroy)(struct drm_encoder *encoder); |
@@ -435,6 +457,18 @@ struct drm_encoder_funcs { | |||
435 | 457 | ||
436 | /** | 458 | /** |
437 | * drm_encoder - central DRM encoder structure | 459 | * drm_encoder - central DRM encoder structure |
460 | * @dev: parent DRM device | ||
461 | * @head: list management | ||
462 | * @base: base KMS object | ||
463 | * @encoder_type: one of the %DRM_MODE_ENCODER_<foo> types in drm_mode.h | ||
464 | * @possible_crtcs: bitmask of potential CRTC bindings | ||
465 | * @possible_clones: bitmask of potential sibling encoders for cloning | ||
466 | * @crtc: currently bound CRTC | ||
467 | * @funcs: control functions | ||
468 | * @helper_private: mid-layer private data | ||
469 | * | ||
470 | * CRTCs drive pixels to encoders, which convert them into signals | ||
471 | * appropriate for a given connector or set of connectors. | ||
438 | */ | 472 | */ |
439 | struct drm_encoder { | 473 | struct drm_encoder { |
440 | struct drm_device *dev; | 474 | struct drm_device *dev; |
@@ -470,14 +504,37 @@ enum drm_connector_force { | |||
470 | 504 | ||
471 | /** | 505 | /** |
472 | * drm_connector - central DRM connector control structure | 506 | * drm_connector - central DRM connector control structure |
473 | * @crtc: CRTC this connector is currently connected to, NULL if none | 507 | * @dev: parent DRM device |
508 | * @kdev: kernel device for sysfs attributes | ||
509 | * @attr: sysfs attributes | ||
510 | * @head: list management | ||
511 | * @base: base KMS object | ||
512 | * @connector_type: one of the %DRM_MODE_CONNECTOR_<foo> types from drm_mode.h | ||
513 | * @connector_type_id: index into connector type enum | ||
474 | * @interlace_allowed: can this connector handle interlaced modes? | 514 | * @interlace_allowed: can this connector handle interlaced modes? |
475 | * @doublescan_allowed: can this connector handle doublescan? | 515 | * @doublescan_allowed: can this connector handle doublescan? |
476 | * @available_modes: modes available on this connector (from get_modes() + user) | 516 | * @modes: modes available on this connector (from fill_modes() + user) |
477 | * @initial_x: initial x position for this connector | 517 | * @status: one of the drm_connector_status enums (connected, not, or unknown) |
478 | * @initial_y: initial y position for this connector | 518 | * @probed_modes: list of modes derived directly from the display |
479 | * @status: connector connected? | 519 | * @display_info: information about attached display (e.g. from EDID) |
480 | * @funcs: connector control functions | 520 | * @funcs: connector control functions |
521 | * @user_modes: user added mode list | ||
522 | * @edid_blob_ptr: DRM property containing EDID if present | ||
523 | * @property_ids: property tracking for this connector | ||
524 | * @property_values: value pointers or data for properties | ||
525 | * @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling | ||
526 | * @dpms: current dpms state | ||
527 | * @helper_private: mid-layer private data | ||
528 | * @force: a %DRM_FORCE_<foo> state for forced mode sets | ||
529 | * @encoder_ids: valid encoders for this connector | ||
530 | * @encoder: encoder driving this connector, if any | ||
531 | * @eld: EDID-like data, if present | ||
532 | * @dvi_dual: dual link DVI, if found | ||
533 | * @max_tmds_clock: max clock rate, if found | ||
534 | * @latency_present: AV delay info from ELD, if found | ||
535 | * @video_latency: video latency info from ELD, if found | ||
536 | * @audio_latency: audio latency info from ELD, if found | ||
537 | * @null_edid_counter: track sinks that give us all zeros for the EDID | ||
481 | * | 538 | * |
482 | * Each connector may be connected to one or more CRTCs, or may be clonable by | 539 | * Each connector may be connected to one or more CRTCs, or may be clonable by |
483 | * another connector if they can share a CRTC. Each connector also has a specific | 540 | * another connector if they can share a CRTC. Each connector also has a specific |
@@ -498,7 +555,6 @@ struct drm_connector { | |||
498 | bool doublescan_allowed; | 555 | bool doublescan_allowed; |
499 | struct list_head modes; /* list of modes on this connector */ | 556 | struct list_head modes; /* list of modes on this connector */ |
500 | 557 | ||
501 | int initial_x, initial_y; | ||
502 | enum drm_connector_status status; | 558 | enum drm_connector_status status; |
503 | 559 | ||
504 | /* these are modes added by probing with DDC or the BIOS */ | 560 | /* these are modes added by probing with DDC or the BIOS */ |
@@ -522,7 +578,6 @@ struct drm_connector { | |||
522 | /* forced on connector */ | 578 | /* forced on connector */ |
523 | enum drm_connector_force force; | 579 | enum drm_connector_force force; |
524 | uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; | 580 | uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; |
525 | uint32_t force_encoder_id; | ||
526 | struct drm_encoder *encoder; /* currently active encoder */ | 581 | struct drm_encoder *encoder; /* currently active encoder */ |
527 | 582 | ||
528 | /* EDID bits */ | 583 | /* EDID bits */ |
@@ -536,7 +591,71 @@ struct drm_connector { | |||
536 | }; | 591 | }; |
537 | 592 | ||
538 | /** | 593 | /** |
539 | * struct drm_mode_set | 594 | * drm_plane_funcs - driver plane control functions |
595 | * @update_plane: update the plane configuration | ||
596 | * @disable_plane: shut down the plane | ||
597 | * @destroy: clean up plane resources | ||
598 | */ | ||
599 | struct drm_plane_funcs { | ||
600 | int (*update_plane)(struct drm_plane *plane, | ||
601 | struct drm_crtc *crtc, struct drm_framebuffer *fb, | ||
602 | int crtc_x, int crtc_y, | ||
603 | unsigned int crtc_w, unsigned int crtc_h, | ||
604 | uint32_t src_x, uint32_t src_y, | ||
605 | uint32_t src_w, uint32_t src_h); | ||
606 | int (*disable_plane)(struct drm_plane *plane); | ||
607 | void (*destroy)(struct drm_plane *plane); | ||
608 | }; | ||
609 | |||
610 | /** | ||
611 | * drm_plane - central DRM plane control structure | ||
612 | * @dev: DRM device this plane belongs to | ||
613 | * @head: for list management | ||
614 | * @base: base mode object | ||
615 | * @possible_crtcs: pipes this plane can be bound to | ||
616 | * @format_types: array of formats supported by this plane | ||
617 | * @format_count: number of formats supported | ||
618 | * @crtc: currently bound CRTC | ||
619 | * @fb: currently bound fb | ||
620 | * @gamma_size: size of gamma table | ||
621 | * @gamma_store: gamma correction table | ||
622 | * @enabled: enabled flag | ||
623 | * @funcs: helper functions | ||
624 | * @helper_private: storage for drver layer | ||
625 | */ | ||
626 | struct drm_plane { | ||
627 | struct drm_device *dev; | ||
628 | struct list_head head; | ||
629 | |||
630 | struct drm_mode_object base; | ||
631 | |||
632 | uint32_t possible_crtcs; | ||
633 | uint32_t *format_types; | ||
634 | uint32_t format_count; | ||
635 | |||
636 | struct drm_crtc *crtc; | ||
637 | struct drm_framebuffer *fb; | ||
638 | |||
639 | /* CRTC gamma size for reporting to userspace */ | ||
640 | uint32_t gamma_size; | ||
641 | uint16_t *gamma_store; | ||
642 | |||
643 | bool enabled; | ||
644 | |||
645 | const struct drm_plane_funcs *funcs; | ||
646 | void *helper_private; | ||
647 | }; | ||
648 | |||
649 | /** | ||
650 | * drm_mode_set - new values for a CRTC config change | ||
651 | * @head: list management | ||
652 | * @fb: framebuffer to use for new config | ||
653 | * @crtc: CRTC whose configuration we're about to change | ||
654 | * @mode: mode timings to use | ||
655 | * @x: position of this CRTC relative to @fb | ||
656 | * @y: position of this CRTC relative to @fb | ||
657 | * @connectors: array of connectors to drive with this CRTC if possible | ||
658 | * @num_connectors: size of @connectors array | ||
540 | * | 659 | * |
541 | * Represents a single crtc the connectors that it drives with what mode | 660 | * Represents a single crtc the connectors that it drives with what mode |
542 | * and from which framebuffer it scans out from. | 661 | * and from which framebuffer it scans out from. |
@@ -558,13 +677,33 @@ struct drm_mode_set { | |||
558 | }; | 677 | }; |
559 | 678 | ||
560 | /** | 679 | /** |
561 | * struct drm_mode_config_funcs - configure CRTCs for a given screen layout | 680 | * struct drm_mode_config_funcs - basic driver provided mode setting functions |
681 | * @fb_create: create a new framebuffer object | ||
682 | * @output_poll_changed: function to handle output configuration changes | ||
683 | * | ||
684 | * Some global (i.e. not per-CRTC, connector, etc) mode setting functions that | ||
685 | * involve drivers. | ||
562 | */ | 686 | */ |
563 | struct drm_mode_config_funcs { | 687 | struct drm_mode_config_funcs { |
564 | struct drm_framebuffer *(*fb_create)(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd *mode_cmd); | 688 | struct drm_framebuffer *(*fb_create)(struct drm_device *dev, |
689 | struct drm_file *file_priv, | ||
690 | struct drm_mode_fb_cmd2 *mode_cmd); | ||
565 | void (*output_poll_changed)(struct drm_device *dev); | 691 | void (*output_poll_changed)(struct drm_device *dev); |
566 | }; | 692 | }; |
567 | 693 | ||
694 | /** | ||
695 | * drm_mode_group - group of mode setting resources for potential sub-grouping | ||
696 | * @num_crtcs: CRTC count | ||
697 | * @num_encoders: encoder count | ||
698 | * @num_connectors: connector count | ||
699 | * @id_list: list of KMS object IDs in this group | ||
700 | * | ||
701 | * Currently this simply tracks the global mode setting state. But in the | ||
702 | * future it could allow groups of objects to be set aside into independent | ||
703 | * control groups for use by different user level processes (e.g. two X servers | ||
704 | * running simultaneously on different heads, each with their own mode | ||
705 | * configuration and freedom of mode setting). | ||
706 | */ | ||
568 | struct drm_mode_group { | 707 | struct drm_mode_group { |
569 | uint32_t num_crtcs; | 708 | uint32_t num_crtcs; |
570 | uint32_t num_encoders; | 709 | uint32_t num_encoders; |
@@ -576,7 +715,30 @@ struct drm_mode_group { | |||
576 | 715 | ||
577 | /** | 716 | /** |
578 | * drm_mode_config - Mode configuration control structure | 717 | * drm_mode_config - Mode configuration control structure |
718 | * @mutex: mutex protecting KMS related lists and structures | ||
719 | * @idr_mutex: mutex for KMS ID allocation and management | ||
720 | * @crtc_idr: main KMS ID tracking object | ||
721 | * @num_fb: number of fbs available | ||
722 | * @fb_list: list of framebuffers available | ||
723 | * @num_connector: number of connectors on this device | ||
724 | * @connector_list: list of connector objects | ||
725 | * @num_encoder: number of encoders on this device | ||
726 | * @encoder_list: list of encoder objects | ||
727 | * @num_crtc: number of CRTCs on this device | ||
728 | * @crtc_list: list of CRTC objects | ||
729 | * @min_width: minimum pixel width on this device | ||
730 | * @min_height: minimum pixel height on this device | ||
731 | * @max_width: maximum pixel width on this device | ||
732 | * @max_height: maximum pixel height on this device | ||
733 | * @funcs: core driver provided mode setting functions | ||
734 | * @fb_base: base address of the framebuffer | ||
735 | * @poll_enabled: track polling status for this device | ||
736 | * @output_poll_work: delayed work for polling in process context | ||
737 | * @*_property: core property tracking | ||
579 | * | 738 | * |
739 | * Core mode resource tracking structure. All CRTC, encoders, and connectors | ||
740 | * enumerated by the driver are added here, as are global properties. Some | ||
741 | * global restrictions are also here, e.g. dimension restrictions. | ||
580 | */ | 742 | */ |
581 | struct drm_mode_config { | 743 | struct drm_mode_config { |
582 | struct mutex mutex; /* protects configuration (mode lists etc.) */ | 744 | struct mutex mutex; /* protects configuration (mode lists etc.) */ |
@@ -589,6 +751,8 @@ struct drm_mode_config { | |||
589 | struct list_head connector_list; | 751 | struct list_head connector_list; |
590 | int num_encoder; | 752 | int num_encoder; |
591 | struct list_head encoder_list; | 753 | struct list_head encoder_list; |
754 | int num_plane; | ||
755 | struct list_head plane_list; | ||
592 | 756 | ||
593 | int num_crtc; | 757 | int num_crtc; |
594 | struct list_head crtc_list; | 758 | struct list_head crtc_list; |
@@ -641,6 +805,7 @@ struct drm_mode_config { | |||
641 | #define obj_to_fb(x) container_of(x, struct drm_framebuffer, base) | 805 | #define obj_to_fb(x) container_of(x, struct drm_framebuffer, base) |
642 | #define obj_to_property(x) container_of(x, struct drm_property, base) | 806 | #define obj_to_property(x) container_of(x, struct drm_property, base) |
643 | #define obj_to_blob(x) container_of(x, struct drm_property_blob, base) | 807 | #define obj_to_blob(x) container_of(x, struct drm_property_blob, base) |
808 | #define obj_to_plane(x) container_of(x, struct drm_plane, base) | ||
644 | 809 | ||
645 | 810 | ||
646 | extern void drm_crtc_init(struct drm_device *dev, | 811 | extern void drm_crtc_init(struct drm_device *dev, |
@@ -660,6 +825,14 @@ extern void drm_encoder_init(struct drm_device *dev, | |||
660 | const struct drm_encoder_funcs *funcs, | 825 | const struct drm_encoder_funcs *funcs, |
661 | int encoder_type); | 826 | int encoder_type); |
662 | 827 | ||
828 | extern int drm_plane_init(struct drm_device *dev, | ||
829 | struct drm_plane *plane, | ||
830 | unsigned long possible_crtcs, | ||
831 | const struct drm_plane_funcs *funcs, | ||
832 | const uint32_t *formats, uint32_t format_count, | ||
833 | bool priv); | ||
834 | extern void drm_plane_cleanup(struct drm_plane *plane); | ||
835 | |||
663 | extern void drm_encoder_cleanup(struct drm_encoder *encoder); | 836 | extern void drm_encoder_cleanup(struct drm_encoder *encoder); |
664 | 837 | ||
665 | extern char *drm_get_connector_name(struct drm_connector *connector); | 838 | extern char *drm_get_connector_name(struct drm_connector *connector); |
@@ -753,17 +926,25 @@ extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, | |||
753 | /* IOCTLs */ | 926 | /* IOCTLs */ |
754 | extern int drm_mode_getresources(struct drm_device *dev, | 927 | extern int drm_mode_getresources(struct drm_device *dev, |
755 | void *data, struct drm_file *file_priv); | 928 | void *data, struct drm_file *file_priv); |
756 | 929 | extern int drm_mode_getplane_res(struct drm_device *dev, void *data, | |
930 | struct drm_file *file_priv); | ||
757 | extern int drm_mode_getcrtc(struct drm_device *dev, | 931 | extern int drm_mode_getcrtc(struct drm_device *dev, |
758 | void *data, struct drm_file *file_priv); | 932 | void *data, struct drm_file *file_priv); |
759 | extern int drm_mode_getconnector(struct drm_device *dev, | 933 | extern int drm_mode_getconnector(struct drm_device *dev, |
760 | void *data, struct drm_file *file_priv); | 934 | void *data, struct drm_file *file_priv); |
761 | extern int drm_mode_setcrtc(struct drm_device *dev, | 935 | extern int drm_mode_setcrtc(struct drm_device *dev, |
762 | void *data, struct drm_file *file_priv); | 936 | void *data, struct drm_file *file_priv); |
937 | extern int drm_mode_getplane(struct drm_device *dev, | ||
938 | void *data, struct drm_file *file_priv); | ||
939 | extern int drm_mode_setplane(struct drm_device *dev, | ||
940 | void *data, struct drm_file *file_priv); | ||
763 | extern int drm_mode_cursor_ioctl(struct drm_device *dev, | 941 | extern int drm_mode_cursor_ioctl(struct drm_device *dev, |
764 | void *data, struct drm_file *file_priv); | 942 | void *data, struct drm_file *file_priv); |
765 | extern int drm_mode_addfb(struct drm_device *dev, | 943 | extern int drm_mode_addfb(struct drm_device *dev, |
766 | void *data, struct drm_file *file_priv); | 944 | void *data, struct drm_file *file_priv); |
945 | extern int drm_mode_addfb2(struct drm_device *dev, | ||
946 | void *data, struct drm_file *file_priv); | ||
947 | extern uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth); | ||
767 | extern int drm_mode_rmfb(struct drm_device *dev, | 948 | extern int drm_mode_rmfb(struct drm_device *dev, |
768 | void *data, struct drm_file *file_priv); | 949 | void *data, struct drm_file *file_priv); |
769 | extern int drm_mode_getfb(struct drm_device *dev, | 950 | extern int drm_mode_getfb(struct drm_device *dev, |
@@ -824,4 +1005,7 @@ extern int drm_mode_mmap_dumb_ioctl(struct drm_device *dev, | |||
824 | void *data, struct drm_file *file_priv); | 1005 | void *data, struct drm_file *file_priv); |
825 | extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev, | 1006 | extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev, |
826 | void *data, struct drm_file *file_priv); | 1007 | void *data, struct drm_file *file_priv); |
1008 | |||
1009 | extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, | ||
1010 | int *bpp); | ||
827 | #endif /* __DRM_CRTC_H__ */ | 1011 | #endif /* __DRM_CRTC_H__ */ |
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h index 73b071203dcc..37515d1afab3 100644 --- a/include/drm/drm_crtc_helper.h +++ b/include/drm/drm_crtc_helper.h | |||
@@ -117,7 +117,7 @@ extern bool drm_helper_encoder_in_use(struct drm_encoder *encoder); | |||
117 | extern void drm_helper_connector_dpms(struct drm_connector *connector, int mode); | 117 | extern void drm_helper_connector_dpms(struct drm_connector *connector, int mode); |
118 | 118 | ||
119 | extern int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb, | 119 | extern int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb, |
120 | struct drm_mode_fb_cmd *mode_cmd); | 120 | struct drm_mode_fb_cmd2 *mode_cmd); |
121 | 121 | ||
122 | static inline void drm_crtc_helper_add(struct drm_crtc *crtc, | 122 | static inline void drm_crtc_helper_add(struct drm_crtc *crtc, |
123 | const struct drm_crtc_helper_funcs *funcs) | 123 | const struct drm_crtc_helper_funcs *funcs) |
@@ -144,4 +144,7 @@ extern void drm_helper_hpd_irq_event(struct drm_device *dev); | |||
144 | 144 | ||
145 | extern void drm_kms_helper_poll_disable(struct drm_device *dev); | 145 | extern void drm_kms_helper_poll_disable(struct drm_device *dev); |
146 | extern void drm_kms_helper_poll_enable(struct drm_device *dev); | 146 | extern void drm_kms_helper_poll_enable(struct drm_device *dev); |
147 | |||
148 | extern int drm_format_num_planes(uint32_t format); | ||
149 | |||
147 | #endif | 150 | #endif |
diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h new file mode 100644 index 000000000000..bdf0152cbbe9 --- /dev/null +++ b/include/drm/drm_fourcc.h | |||
@@ -0,0 +1,137 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Intel Corporation | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice (including the next | ||
12 | * paragraph) shall be included in all copies or substantial portions of the | ||
13 | * Software. | ||
14 | * | ||
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
18 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
21 | * OTHER DEALINGS IN THE SOFTWARE. | ||
22 | */ | ||
23 | |||
24 | #ifndef DRM_FOURCC_H | ||
25 | #define DRM_FOURCC_H | ||
26 | |||
27 | #include <linux/types.h> | ||
28 | |||
29 | #define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \ | ||
30 | ((__u32)(c) << 16) | ((__u32)(d) << 24)) | ||
31 | |||
32 | #define DRM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */ | ||
33 | |||
34 | /* color index */ | ||
35 | #define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C */ | ||
36 | |||
37 | /* 8 bpp RGB */ | ||
38 | #define DRM_FORMAT_RGB332 fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */ | ||
39 | #define DRM_FORMAT_BGR233 fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */ | ||
40 | |||
41 | /* 16 bpp RGB */ | ||
42 | #define DRM_FORMAT_XRGB4444 fourcc_code('X', 'R', '1', '2') /* [15:0] x:R:G:B 4:4:4:4 little endian */ | ||
43 | #define DRM_FORMAT_XBGR4444 fourcc_code('X', 'B', '1', '2') /* [15:0] x:B:G:R 4:4:4:4 little endian */ | ||
44 | #define DRM_FORMAT_RGBX4444 fourcc_code('R', 'X', '1', '2') /* [15:0] R:G:B:x 4:4:4:4 little endian */ | ||
45 | #define DRM_FORMAT_BGRX4444 fourcc_code('B', 'X', '1', '2') /* [15:0] B:G:R:x 4:4:4:4 little endian */ | ||
46 | |||
47 | #define DRM_FORMAT_ARGB4444 fourcc_code('A', 'R', '1', '2') /* [15:0] A:R:G:B 4:4:4:4 little endian */ | ||
48 | #define DRM_FORMAT_ABGR4444 fourcc_code('A', 'B', '1', '2') /* [15:0] A:B:G:R 4:4:4:4 little endian */ | ||
49 | #define DRM_FORMAT_RGBA4444 fourcc_code('R', 'A', '1', '2') /* [15:0] R:G:B:A 4:4:4:4 little endian */ | ||
50 | #define DRM_FORMAT_BGRA4444 fourcc_code('B', 'A', '1', '2') /* [15:0] B:G:R:A 4:4:4:4 little endian */ | ||
51 | |||
52 | #define DRM_FORMAT_XRGB1555 fourcc_code('X', 'R', '1', '5') /* [15:0] x:R:G:B 1:5:5:5 little endian */ | ||
53 | #define DRM_FORMAT_XBGR1555 fourcc_code('X', 'B', '1', '5') /* [15:0] x:B:G:R 1:5:5:5 little endian */ | ||
54 | #define DRM_FORMAT_RGBX5551 fourcc_code('R', 'X', '1', '5') /* [15:0] R:G:B:x 5:5:5:1 little endian */ | ||
55 | #define DRM_FORMAT_BGRX5551 fourcc_code('B', 'X', '1', '5') /* [15:0] B:G:R:x 5:5:5:1 little endian */ | ||
56 | |||
57 | #define DRM_FORMAT_ARGB1555 fourcc_code('A', 'R', '1', '5') /* [15:0] A:R:G:B 1:5:5:5 little endian */ | ||
58 | #define DRM_FORMAT_ABGR1555 fourcc_code('A', 'B', '1', '5') /* [15:0] A:B:G:R 1:5:5:5 little endian */ | ||
59 | #define DRM_FORMAT_RGBA5551 fourcc_code('R', 'A', '1', '5') /* [15:0] R:G:B:A 5:5:5:1 little endian */ | ||
60 | #define DRM_FORMAT_BGRA5551 fourcc_code('B', 'A', '1', '5') /* [15:0] B:G:R:A 5:5:5:1 little endian */ | ||
61 | |||
62 | #define DRM_FORMAT_RGB565 fourcc_code('R', 'G', '1', '6') /* [15:0] R:G:B 5:6:5 little endian */ | ||
63 | #define DRM_FORMAT_BGR565 fourcc_code('B', 'G', '1', '6') /* [15:0] B:G:R 5:6:5 little endian */ | ||
64 | |||
65 | /* 24 bpp RGB */ | ||
66 | #define DRM_FORMAT_RGB888 fourcc_code('R', 'G', '2', '4') /* [23:0] R:G:B little endian */ | ||
67 | #define DRM_FORMAT_BGR888 fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */ | ||
68 | |||
69 | /* 32 bpp RGB */ | ||
70 | #define DRM_FORMAT_XRGB8888 fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */ | ||
71 | #define DRM_FORMAT_XBGR8888 fourcc_code('X', 'B', '2', '4') /* [31:0] x:B:G:R 8:8:8:8 little endian */ | ||
72 | #define DRM_FORMAT_RGBX8888 fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */ | ||
73 | #define DRM_FORMAT_BGRX8888 fourcc_code('B', 'X', '2', '4') /* [31:0] B:G:R:x 8:8:8:8 little endian */ | ||
74 | |||
75 | #define DRM_FORMAT_ARGB8888 fourcc_code('A', 'R', '2', '4') /* [31:0] A:R:G:B 8:8:8:8 little endian */ | ||
76 | #define DRM_FORMAT_ABGR8888 fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */ | ||
77 | #define DRM_FORMAT_RGBA8888 fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */ | ||
78 | #define DRM_FORMAT_BGRA8888 fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */ | ||
79 | |||
80 | #define DRM_FORMAT_XRGB2101010 fourcc_code('X', 'R', '3', '0') /* [31:0] x:R:G:B 2:10:10:10 little endian */ | ||
81 | #define DRM_FORMAT_XBGR2101010 fourcc_code('X', 'B', '3', '0') /* [31:0] x:B:G:R 2:10:10:10 little endian */ | ||
82 | #define DRM_FORMAT_RGBX1010102 fourcc_code('R', 'X', '3', '0') /* [31:0] R:G:B:x 10:10:10:2 little endian */ | ||
83 | #define DRM_FORMAT_BGRX1010102 fourcc_code('B', 'X', '3', '0') /* [31:0] B:G:R:x 10:10:10:2 little endian */ | ||
84 | |||
85 | #define DRM_FORMAT_ARGB2101010 fourcc_code('A', 'R', '3', '0') /* [31:0] A:R:G:B 2:10:10:10 little endian */ | ||
86 | #define DRM_FORMAT_ABGR2101010 fourcc_code('A', 'B', '3', '0') /* [31:0] A:B:G:R 2:10:10:10 little endian */ | ||
87 | #define DRM_FORMAT_RGBA1010102 fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */ | ||
88 | #define DRM_FORMAT_BGRA1010102 fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */ | ||
89 | |||
90 | /* packed YCbCr */ | ||
91 | #define DRM_FORMAT_YUYV fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */ | ||
92 | #define DRM_FORMAT_YVYU fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */ | ||
93 | #define DRM_FORMAT_UYVY fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */ | ||
94 | #define DRM_FORMAT_VYUY fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */ | ||
95 | |||
96 | #define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */ | ||
97 | |||
98 | /* | ||
99 | * 2 plane YCbCr | ||
100 | * index 0 = Y plane, [7:0] Y | ||
101 | * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian | ||
102 | * or | ||
103 | * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian | ||
104 | */ | ||
105 | #define DRM_FORMAT_NV12 fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */ | ||
106 | #define DRM_FORMAT_NV21 fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */ | ||
107 | #define DRM_FORMAT_NV16 fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */ | ||
108 | #define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */ | ||
109 | |||
110 | /* 2 non contiguous plane YCbCr */ | ||
111 | #define DRM_FORMAT_NV12M fourcc_code('N', 'M', '1', '2') /* 2x2 subsampled Cr:Cb plane */ | ||
112 | #define DRM_FORMAT_NV12MT fourcc_code('T', 'M', '1', '2') /* 2x2 subsampled Cr:Cb plane 64x32 macroblocks */ | ||
113 | |||
114 | /* | ||
115 | * 3 plane YCbCr | ||
116 | * index 0: Y plane, [7:0] Y | ||
117 | * index 1: Cb plane, [7:0] Cb | ||
118 | * index 2: Cr plane, [7:0] Cr | ||
119 | * or | ||
120 | * index 1: Cr plane, [7:0] Cr | ||
121 | * index 2: Cb plane, [7:0] Cb | ||
122 | */ | ||
123 | #define DRM_FORMAT_YUV410 fourcc_code('Y', 'U', 'V', '9') /* 4x4 subsampled Cb (1) and Cr (2) planes */ | ||
124 | #define DRM_FORMAT_YVU410 fourcc_code('Y', 'V', 'U', '9') /* 4x4 subsampled Cr (1) and Cb (2) planes */ | ||
125 | #define DRM_FORMAT_YUV411 fourcc_code('Y', 'U', '1', '1') /* 4x1 subsampled Cb (1) and Cr (2) planes */ | ||
126 | #define DRM_FORMAT_YVU411 fourcc_code('Y', 'V', '1', '1') /* 4x1 subsampled Cr (1) and Cb (2) planes */ | ||
127 | #define DRM_FORMAT_YUV420 fourcc_code('Y', 'U', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */ | ||
128 | #define DRM_FORMAT_YVU420 fourcc_code('Y', 'V', '1', '2') /* 2x2 subsampled Cr (1) and Cb (2) planes */ | ||
129 | #define DRM_FORMAT_YUV422 fourcc_code('Y', 'U', '1', '6') /* 2x1 subsampled Cb (1) and Cr (2) planes */ | ||
130 | #define DRM_FORMAT_YVU422 fourcc_code('Y', 'V', '1', '6') /* 2x1 subsampled Cr (1) and Cb (2) planes */ | ||
131 | #define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */ | ||
132 | #define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */ | ||
133 | |||
134 | /* 3 non contiguous plane YCbCr */ | ||
135 | #define DRM_FORMAT_YUV420M fourcc_code('Y', 'M', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */ | ||
136 | |||
137 | #endif /* DRM_FOURCC_H */ | ||
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h index ddd46db65b57..2a2acda8b437 100644 --- a/include/drm/drm_mode.h +++ b/include/drm/drm_mode.h | |||
@@ -120,11 +120,48 @@ struct drm_mode_crtc { | |||
120 | struct drm_mode_modeinfo mode; | 120 | struct drm_mode_modeinfo mode; |
121 | }; | 121 | }; |
122 | 122 | ||
123 | #define DRM_MODE_ENCODER_NONE 0 | 123 | #define DRM_MODE_PRESENT_TOP_FIELD (1<<0) |
124 | #define DRM_MODE_ENCODER_DAC 1 | 124 | #define DRM_MODE_PRESENT_BOTTOM_FIELD (1<<1) |
125 | #define DRM_MODE_ENCODER_TMDS 2 | 125 | |
126 | #define DRM_MODE_ENCODER_LVDS 3 | 126 | /* Planes blend with or override other bits on the CRTC */ |
127 | #define DRM_MODE_ENCODER_TVDAC 4 | 127 | struct drm_mode_set_plane { |
128 | __u32 plane_id; | ||
129 | __u32 crtc_id; | ||
130 | __u32 fb_id; /* fb object contains surface format type */ | ||
131 | __u32 flags; /* see above flags */ | ||
132 | |||
133 | /* Signed dest location allows it to be partially off screen */ | ||
134 | __s32 crtc_x, crtc_y; | ||
135 | __u32 crtc_w, crtc_h; | ||
136 | |||
137 | /* Source values are 16.16 fixed point */ | ||
138 | __u32 src_x, src_y; | ||
139 | __u32 src_h, src_w; | ||
140 | }; | ||
141 | |||
142 | struct drm_mode_get_plane { | ||
143 | __u32 plane_id; | ||
144 | |||
145 | __u32 crtc_id; | ||
146 | __u32 fb_id; | ||
147 | |||
148 | __u32 possible_crtcs; | ||
149 | __u32 gamma_size; | ||
150 | |||
151 | __u32 count_format_types; | ||
152 | __u64 format_type_ptr; | ||
153 | }; | ||
154 | |||
155 | struct drm_mode_get_plane_res { | ||
156 | __u64 plane_id_ptr; | ||
157 | __u32 count_planes; | ||
158 | }; | ||
159 | |||
160 | #define DRM_MODE_ENCODER_NONE 0 | ||
161 | #define DRM_MODE_ENCODER_DAC 1 | ||
162 | #define DRM_MODE_ENCODER_TMDS 2 | ||
163 | #define DRM_MODE_ENCODER_LVDS 3 | ||
164 | #define DRM_MODE_ENCODER_TVDAC 4 | ||
128 | #define DRM_MODE_ENCODER_VIRTUAL 5 | 165 | #define DRM_MODE_ENCODER_VIRTUAL 5 |
129 | 166 | ||
130 | struct drm_mode_get_encoder { | 167 | struct drm_mode_get_encoder { |
@@ -231,6 +268,33 @@ struct drm_mode_fb_cmd { | |||
231 | __u32 handle; | 268 | __u32 handle; |
232 | }; | 269 | }; |
233 | 270 | ||
271 | #define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */ | ||
272 | |||
273 | struct drm_mode_fb_cmd2 { | ||
274 | __u32 fb_id; | ||
275 | __u32 width, height; | ||
276 | __u32 pixel_format; /* fourcc code from drm_fourcc.h */ | ||
277 | __u32 flags; /* see above flags */ | ||
278 | |||
279 | /* | ||
280 | * In case of planar formats, this ioctl allows up to 4 | ||
281 | * buffer objects with offets and pitches per plane. | ||
282 | * The pitch and offset order is dictated by the fourcc, | ||
283 | * e.g. NV12 (http://fourcc.org/yuv.php#NV12) is described as: | ||
284 | * | ||
285 | * YUV 4:2:0 image with a plane of 8 bit Y samples | ||
286 | * followed by an interleaved U/V plane containing | ||
287 | * 8 bit 2x2 subsampled colour difference samples. | ||
288 | * | ||
289 | * So it would consist of Y as offset[0] and UV as | ||
290 | * offeset[1]. Note that offset[0] will generally | ||
291 | * be 0. | ||
292 | */ | ||
293 | __u32 handles[4]; | ||
294 | __u32 pitches[4]; /* pitch for each plane */ | ||
295 | __u32 offsets[4]; /* offset of each plane */ | ||
296 | }; | ||
297 | |||
234 | #define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01 | 298 | #define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01 |
235 | #define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02 | 299 | #define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02 |
236 | #define DRM_MODE_FB_DIRTY_FLAGS 0x03 | 300 | #define DRM_MODE_FB_DIRTY_FLAGS 0x03 |
diff --git a/include/drm/drm_sman.h b/include/drm/drm_sman.h deleted file mode 100644 index 08ecf83ad5d4..000000000000 --- a/include/drm/drm_sman.h +++ /dev/null | |||
@@ -1,176 +0,0 @@ | |||
1 | /************************************************************************** | ||
2 | * | ||
3 | * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA. | ||
4 | * All Rights Reserved. | ||
5 | * | ||
6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
7 | * copy of this software and associated documentation files (the | ||
8 | * "Software"), to deal in the Software without restriction, including | ||
9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
10 | * distribute, sub license, and/or sell copies of the Software, and to | ||
11 | * permit persons to whom the Software is furnished to do so, subject to | ||
12 | * the following conditions: | ||
13 | * | ||
14 | * The above copyright notice and this permission notice (including the | ||
15 | * next paragraph) shall be included in all copies or substantial portions | ||
16 | * of the Software. | ||
17 | * | ||
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
25 | * | ||
26 | * | ||
27 | **************************************************************************/ | ||
28 | /* | ||
29 | * Simple memory MANager interface that keeps track on allocate regions on a | ||
30 | * per "owner" basis. All regions associated with an "owner" can be released | ||
31 | * with a simple call. Typically if the "owner" exists. The owner is any | ||
32 | * "unsigned long" identifier. Can typically be a pointer to a file private | ||
33 | * struct or a context identifier. | ||
34 | * | ||
35 | * Authors: | ||
36 | * Thomas Hellström <thomas-at-tungstengraphics-dot-com> | ||
37 | */ | ||
38 | |||
39 | #ifndef DRM_SMAN_H | ||
40 | #define DRM_SMAN_H | ||
41 | |||
42 | #include "drmP.h" | ||
43 | #include "drm_hashtab.h" | ||
44 | |||
45 | /* | ||
46 | * A class that is an abstration of a simple memory allocator. | ||
47 | * The sman implementation provides a default such allocator | ||
48 | * using the drm_mm.c implementation. But the user can replace it. | ||
49 | * See the SiS implementation, which may use the SiS FB kernel module | ||
50 | * for memory management. | ||
51 | */ | ||
52 | |||
53 | struct drm_sman_mm { | ||
54 | /* private info. If allocated, needs to be destroyed by the destroy | ||
55 | function */ | ||
56 | void *private; | ||
57 | |||
58 | /* Allocate a memory block with given size and alignment. | ||
59 | Return an opaque reference to the memory block */ | ||
60 | |||
61 | void *(*allocate) (void *private, unsigned long size, | ||
62 | unsigned alignment); | ||
63 | |||
64 | /* Free a memory block. "ref" is the opaque reference that we got from | ||
65 | the "alloc" function */ | ||
66 | |||
67 | void (*free) (void *private, void *ref); | ||
68 | |||
69 | /* Free all resources associated with this allocator */ | ||
70 | |||
71 | void (*destroy) (void *private); | ||
72 | |||
73 | /* Return a memory offset from the opaque reference returned from the | ||
74 | "alloc" function */ | ||
75 | |||
76 | unsigned long (*offset) (void *private, void *ref); | ||
77 | }; | ||
78 | |||
79 | struct drm_memblock_item { | ||
80 | struct list_head owner_list; | ||
81 | struct drm_hash_item user_hash; | ||
82 | void *mm_info; | ||
83 | struct drm_sman_mm *mm; | ||
84 | struct drm_sman *sman; | ||
85 | }; | ||
86 | |||
87 | struct drm_sman { | ||
88 | struct drm_sman_mm *mm; | ||
89 | int num_managers; | ||
90 | struct drm_open_hash owner_hash_tab; | ||
91 | struct drm_open_hash user_hash_tab; | ||
92 | struct list_head owner_items; | ||
93 | }; | ||
94 | |||
95 | /* | ||
96 | * Take down a memory manager. This function should only be called after a | ||
97 | * successful init and after a call to drm_sman_cleanup. | ||
98 | */ | ||
99 | |||
100 | extern void drm_sman_takedown(struct drm_sman * sman); | ||
101 | |||
102 | /* | ||
103 | * Allocate structures for a manager. | ||
104 | * num_managers are the number of memory pools to manage. (VRAM, AGP, ....) | ||
105 | * user_order is the log2 of the number of buckets in the user hash table. | ||
106 | * set this to approximately log2 of the max number of memory regions | ||
107 | * that will be allocated for _all_ pools together. | ||
108 | * owner_order is the log2 of the number of buckets in the owner hash table. | ||
109 | * set this to approximately log2 of | ||
110 | * the number of client file connections that will | ||
111 | * be using the manager. | ||
112 | * | ||
113 | */ | ||
114 | |||
115 | extern int drm_sman_init(struct drm_sman * sman, unsigned int num_managers, | ||
116 | unsigned int user_order, unsigned int owner_order); | ||
117 | |||
118 | /* | ||
119 | * Initialize a drm_mm.c allocator. Should be called only once for each | ||
120 | * manager unless a customized allogator is used. | ||
121 | */ | ||
122 | |||
123 | extern int drm_sman_set_range(struct drm_sman * sman, unsigned int manager, | ||
124 | unsigned long start, unsigned long size); | ||
125 | |||
126 | /* | ||
127 | * Initialize a customized allocator for one of the managers. | ||
128 | * (See the SiS module). The object pointed to by "allocator" is copied, | ||
129 | * so it can be destroyed after this call. | ||
130 | */ | ||
131 | |||
132 | extern int drm_sman_set_manager(struct drm_sman * sman, unsigned int mananger, | ||
133 | struct drm_sman_mm * allocator); | ||
134 | |||
135 | /* | ||
136 | * Allocate a memory block. Aligment is not implemented yet. | ||
137 | */ | ||
138 | |||
139 | extern struct drm_memblock_item *drm_sman_alloc(struct drm_sman * sman, | ||
140 | unsigned int manager, | ||
141 | unsigned long size, | ||
142 | unsigned alignment, | ||
143 | unsigned long owner); | ||
144 | /* | ||
145 | * Free a memory block identified by its user hash key. | ||
146 | */ | ||
147 | |||
148 | extern int drm_sman_free_key(struct drm_sman * sman, unsigned int key); | ||
149 | |||
150 | /* | ||
151 | * returns 1 iff there are no stale memory blocks associated with this owner. | ||
152 | * Typically called to determine if we need to idle the hardware and call | ||
153 | * drm_sman_owner_cleanup. If there are no stale memory blocks, it removes all | ||
154 | * resources associated with owner. | ||
155 | */ | ||
156 | |||
157 | extern int drm_sman_owner_clean(struct drm_sman * sman, unsigned long owner); | ||
158 | |||
159 | /* | ||
160 | * Frees all stale memory blocks associated with this owner. Note that this | ||
161 | * requires that the hardware is finished with all blocks, so the graphics engine | ||
162 | * should be idled before this call is made. This function also frees | ||
163 | * any resources associated with "owner" and should be called when owner | ||
164 | * is not going to be referenced anymore. | ||
165 | */ | ||
166 | |||
167 | extern void drm_sman_owner_cleanup(struct drm_sman * sman, unsigned long owner); | ||
168 | |||
169 | /* | ||
170 | * Frees all stale memory blocks associated with the memory manager. | ||
171 | * See idling above. | ||
172 | */ | ||
173 | |||
174 | extern void drm_sman_cleanup(struct drm_sman * sman); | ||
175 | |||
176 | #endif | ||
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h index 12050434d57a..5e120f1c5cd9 100644 --- a/include/drm/exynos_drm.h +++ b/include/drm/exynos_drm.h | |||
@@ -74,9 +74,16 @@ struct drm_exynos_gem_mmap { | |||
74 | uint64_t mapped; | 74 | uint64_t mapped; |
75 | }; | 75 | }; |
76 | 76 | ||
77 | struct drm_exynos_plane_set_zpos { | ||
78 | __u32 plane_id; | ||
79 | __s32 zpos; | ||
80 | }; | ||
81 | |||
77 | #define DRM_EXYNOS_GEM_CREATE 0x00 | 82 | #define DRM_EXYNOS_GEM_CREATE 0x00 |
78 | #define DRM_EXYNOS_GEM_MAP_OFFSET 0x01 | 83 | #define DRM_EXYNOS_GEM_MAP_OFFSET 0x01 |
79 | #define DRM_EXYNOS_GEM_MMAP 0x02 | 84 | #define DRM_EXYNOS_GEM_MMAP 0x02 |
85 | /* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */ | ||
86 | #define DRM_EXYNOS_PLANE_SET_ZPOS 0x06 | ||
80 | 87 | ||
81 | #define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \ | 88 | #define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \ |
82 | DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create) | 89 | DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create) |
@@ -87,6 +94,9 @@ struct drm_exynos_gem_mmap { | |||
87 | #define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \ | 94 | #define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \ |
88 | DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap) | 95 | DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap) |
89 | 96 | ||
97 | #define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \ | ||
98 | DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos) | ||
99 | |||
90 | /** | 100 | /** |
91 | * Platform Specific Structure for DRM based FIMD. | 101 | * Platform Specific Structure for DRM based FIMD. |
92 | * | 102 | * |
@@ -102,4 +112,31 @@ struct exynos_drm_fimd_pdata { | |||
102 | unsigned int bpp; | 112 | unsigned int bpp; |
103 | }; | 113 | }; |
104 | 114 | ||
115 | /** | ||
116 | * Platform Specific Structure for DRM based HDMI. | ||
117 | * | ||
118 | * @hdmi_dev: device point to specific hdmi driver. | ||
119 | * @mixer_dev: device point to specific mixer driver. | ||
120 | * | ||
121 | * this structure is used for common hdmi driver and each device object | ||
122 | * would be used to access specific device driver(hdmi or mixer driver) | ||
123 | */ | ||
124 | struct exynos_drm_common_hdmi_pd { | ||
125 | struct device *hdmi_dev; | ||
126 | struct device *mixer_dev; | ||
127 | }; | ||
128 | |||
129 | /** | ||
130 | * Platform Specific Structure for DRM based HDMI core. | ||
131 | * | ||
132 | * @timing: default video mode for initializing | ||
133 | * @default_win: default window layer number to be used for UI. | ||
134 | * @bpp: default bit per pixel. | ||
135 | */ | ||
136 | struct exynos_drm_hdmi_pdata { | ||
137 | struct fb_videomode timing; | ||
138 | unsigned int default_win; | ||
139 | unsigned int bpp; | ||
140 | }; | ||
141 | |||
105 | #endif | 142 | #endif |
diff --git a/include/drm/gma_drm.h b/include/drm/gma_drm.h new file mode 100644 index 000000000000..113686785717 --- /dev/null +++ b/include/drm/gma_drm.h | |||
@@ -0,0 +1,91 @@ | |||
1 | /************************************************************************** | ||
2 | * Copyright (c) 2007-2011, Intel Corporation. | ||
3 | * All Rights Reserved. | ||
4 | * Copyright (c) 2008, Tungsten Graphics Inc. Cedar Park, TX., USA. | ||
5 | * All Rights Reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms and conditions of the GNU General Public License, | ||
9 | * version 2, as published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
14 | * more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along with | ||
17 | * this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
19 | * | ||
20 | **************************************************************************/ | ||
21 | |||
22 | #ifndef _PSB_DRM_H_ | ||
23 | #define _PSB_DRM_H_ | ||
24 | |||
25 | /* | ||
26 | * Manage the LUT for an output | ||
27 | */ | ||
28 | struct drm_psb_dpst_lut_arg { | ||
29 | uint8_t lut[256]; | ||
30 | int output_id; | ||
31 | }; | ||
32 | |||
33 | /* | ||
34 | * Validate modes | ||
35 | */ | ||
36 | struct drm_psb_mode_operation_arg { | ||
37 | u32 obj_id; | ||
38 | u16 operation; | ||
39 | struct drm_mode_modeinfo mode; | ||
40 | u64 data; | ||
41 | }; | ||
42 | |||
43 | /* | ||
44 | * Query the stolen memory for smarter management of | ||
45 | * memory by the server | ||
46 | */ | ||
47 | struct drm_psb_stolen_memory_arg { | ||
48 | u32 base; | ||
49 | u32 size; | ||
50 | }; | ||
51 | |||
52 | struct drm_psb_get_pipe_from_crtc_id_arg { | ||
53 | /** ID of CRTC being requested **/ | ||
54 | u32 crtc_id; | ||
55 | /** pipe of requested CRTC **/ | ||
56 | u32 pipe; | ||
57 | }; | ||
58 | |||
59 | struct drm_psb_gem_create { | ||
60 | __u64 size; | ||
61 | __u32 handle; | ||
62 | __u32 flags; | ||
63 | #define GMA_GEM_CREATE_STOLEN 1 /* Stolen memory can be used */ | ||
64 | }; | ||
65 | |||
66 | struct drm_psb_gem_mmap { | ||
67 | __u32 handle; | ||
68 | __u32 pad; | ||
69 | /** | ||
70 | * Fake offset to use for subsequent mmap call | ||
71 | * | ||
72 | * This is a fixed-size type for 32/64 compatibility. | ||
73 | */ | ||
74 | __u64 offset; | ||
75 | }; | ||
76 | |||
77 | /* Controlling the kernel modesetting buffers */ | ||
78 | |||
79 | #define DRM_GMA_GEM_CREATE 0x00 /* Create a GEM object */ | ||
80 | #define DRM_GMA_GEM_MMAP 0x01 /* Map GEM memory */ | ||
81 | #define DRM_GMA_STOLEN_MEMORY 0x02 /* Report stolen memory */ | ||
82 | #define DRM_GMA_2D_OP 0x03 /* Will be merged later */ | ||
83 | #define DRM_GMA_GAMMA 0x04 /* Set gamma table */ | ||
84 | #define DRM_GMA_ADB 0x05 /* Get backlight */ | ||
85 | #define DRM_GMA_DPST_BL 0x06 /* Set backlight */ | ||
86 | #define DRM_GMA_GET_PIPE_FROM_CRTC_ID 0x1 /* CRTC to physical pipe# */ | ||
87 | #define DRM_GMA_MODE_OPERATION 0x07 /* Mode validation/DC set */ | ||
88 | #define PSB_MODE_OPERATION_MODE_VALID 0x01 | ||
89 | |||
90 | |||
91 | #endif | ||
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h index 28c0d114cb52..924f6a454fed 100644 --- a/include/drm/i915_drm.h +++ b/include/drm/i915_drm.h | |||
@@ -198,6 +198,8 @@ typedef struct _drm_i915_sarea { | |||
198 | #define DRM_I915_OVERLAY_PUT_IMAGE 0x27 | 198 | #define DRM_I915_OVERLAY_PUT_IMAGE 0x27 |
199 | #define DRM_I915_OVERLAY_ATTRS 0x28 | 199 | #define DRM_I915_OVERLAY_ATTRS 0x28 |
200 | #define DRM_I915_GEM_EXECBUFFER2 0x29 | 200 | #define DRM_I915_GEM_EXECBUFFER2 0x29 |
201 | #define DRM_I915_GET_SPRITE_COLORKEY 0x2a | ||
202 | #define DRM_I915_SET_SPRITE_COLORKEY 0x2b | ||
201 | 203 | ||
202 | #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) | 204 | #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) |
203 | #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) | 205 | #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) |
@@ -239,6 +241,8 @@ typedef struct _drm_i915_sarea { | |||
239 | #define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise) | 241 | #define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise) |
240 | #define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image) | 242 | #define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image) |
241 | #define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs) | 243 | #define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs) |
244 | #define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey) | ||
245 | #define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey) | ||
242 | 246 | ||
243 | /* Allow drivers to submit batchbuffers directly to hardware, relying | 247 | /* Allow drivers to submit batchbuffers directly to hardware, relying |
244 | * on the security mechanisms provided by hardware. | 248 | * on the security mechanisms provided by hardware. |
@@ -291,6 +295,7 @@ typedef struct drm_i915_irq_wait { | |||
291 | #define I915_PARAM_HAS_COHERENT_RINGS 13 | 295 | #define I915_PARAM_HAS_COHERENT_RINGS 13 |
292 | #define I915_PARAM_HAS_EXEC_CONSTANTS 14 | 296 | #define I915_PARAM_HAS_EXEC_CONSTANTS 14 |
293 | #define I915_PARAM_HAS_RELAXED_DELTA 15 | 297 | #define I915_PARAM_HAS_RELAXED_DELTA 15 |
298 | #define I915_PARAM_HAS_GEN7_SOL_RESET 16 | ||
294 | 299 | ||
295 | typedef struct drm_i915_getparam { | 300 | typedef struct drm_i915_getparam { |
296 | int param; | 301 | int param; |
@@ -653,6 +658,9 @@ struct drm_i915_gem_execbuffer2 { | |||
653 | __u64 rsvd2; | 658 | __u64 rsvd2; |
654 | }; | 659 | }; |
655 | 660 | ||
661 | /** Resets the SO write offset registers for transform feedback on gen7. */ | ||
662 | #define I915_EXEC_GEN7_SOL_RESET (1<<8) | ||
663 | |||
656 | struct drm_i915_gem_pin { | 664 | struct drm_i915_gem_pin { |
657 | /** Handle of the buffer to be pinned. */ | 665 | /** Handle of the buffer to be pinned. */ |
658 | __u32 handle; | 666 | __u32 handle; |
@@ -844,4 +852,36 @@ struct drm_intel_overlay_attrs { | |||
844 | __u32 gamma5; | 852 | __u32 gamma5; |
845 | }; | 853 | }; |
846 | 854 | ||
855 | /* | ||
856 | * Intel sprite handling | ||
857 | * | ||
858 | * Color keying works with a min/mask/max tuple. Both source and destination | ||
859 | * color keying is allowed. | ||
860 | * | ||
861 | * Source keying: | ||
862 | * Sprite pixels within the min & max values, masked against the color channels | ||
863 | * specified in the mask field, will be transparent. All other pixels will | ||
864 | * be displayed on top of the primary plane. For RGB surfaces, only the min | ||
865 | * and mask fields will be used; ranged compares are not allowed. | ||
866 | * | ||
867 | * Destination keying: | ||
868 | * Primary plane pixels that match the min value, masked against the color | ||
869 | * channels specified in the mask field, will be replaced by corresponding | ||
870 | * pixels from the sprite plane. | ||
871 | * | ||
872 | * Note that source & destination keying are exclusive; only one can be | ||
873 | * active on a given plane. | ||
874 | */ | ||
875 | |||
876 | #define I915_SET_COLORKEY_NONE (1<<0) /* disable color key matching */ | ||
877 | #define I915_SET_COLORKEY_DESTINATION (1<<1) | ||
878 | #define I915_SET_COLORKEY_SOURCE (1<<2) | ||
879 | struct drm_intel_sprite_colorkey { | ||
880 | __u32 plane_id; | ||
881 | __u32 min_value; | ||
882 | __u32 channel_mask; | ||
883 | __u32 max_value; | ||
884 | __u32 flags; | ||
885 | }; | ||
886 | |||
847 | #endif /* _I915_DRM_H_ */ | 887 | #endif /* _I915_DRM_H_ */ |
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h index be94be6d6f17..b55da40953fd 100644 --- a/include/drm/radeon_drm.h +++ b/include/drm/radeon_drm.h | |||
@@ -509,6 +509,7 @@ typedef struct { | |||
509 | #define DRM_RADEON_GEM_SET_TILING 0x28 | 509 | #define DRM_RADEON_GEM_SET_TILING 0x28 |
510 | #define DRM_RADEON_GEM_GET_TILING 0x29 | 510 | #define DRM_RADEON_GEM_GET_TILING 0x29 |
511 | #define DRM_RADEON_GEM_BUSY 0x2a | 511 | #define DRM_RADEON_GEM_BUSY 0x2a |
512 | #define DRM_RADEON_GEM_VA 0x2b | ||
512 | 513 | ||
513 | #define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t) | 514 | #define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t) |
514 | #define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START) | 515 | #define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START) |
@@ -550,6 +551,7 @@ typedef struct { | |||
550 | #define DRM_IOCTL_RADEON_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling) | 551 | #define DRM_IOCTL_RADEON_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling) |
551 | #define DRM_IOCTL_RADEON_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling) | 552 | #define DRM_IOCTL_RADEON_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling) |
552 | #define DRM_IOCTL_RADEON_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy) | 553 | #define DRM_IOCTL_RADEON_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy) |
554 | #define DRM_IOCTL_RADEON_GEM_VA DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_VA, struct drm_radeon_gem_va) | ||
553 | 555 | ||
554 | typedef struct drm_radeon_init { | 556 | typedef struct drm_radeon_init { |
555 | enum { | 557 | enum { |
@@ -872,12 +874,39 @@ struct drm_radeon_gem_pwrite { | |||
872 | uint64_t data_ptr; | 874 | uint64_t data_ptr; |
873 | }; | 875 | }; |
874 | 876 | ||
877 | #define RADEON_VA_MAP 1 | ||
878 | #define RADEON_VA_UNMAP 2 | ||
879 | |||
880 | #define RADEON_VA_RESULT_OK 0 | ||
881 | #define RADEON_VA_RESULT_ERROR 1 | ||
882 | #define RADEON_VA_RESULT_VA_EXIST 2 | ||
883 | |||
884 | #define RADEON_VM_PAGE_VALID (1 << 0) | ||
885 | #define RADEON_VM_PAGE_READABLE (1 << 1) | ||
886 | #define RADEON_VM_PAGE_WRITEABLE (1 << 2) | ||
887 | #define RADEON_VM_PAGE_SYSTEM (1 << 3) | ||
888 | #define RADEON_VM_PAGE_SNOOPED (1 << 4) | ||
889 | |||
890 | struct drm_radeon_gem_va { | ||
891 | uint32_t handle; | ||
892 | uint32_t operation; | ||
893 | uint32_t vm_id; | ||
894 | uint32_t flags; | ||
895 | uint64_t offset; | ||
896 | }; | ||
897 | |||
875 | #define RADEON_CHUNK_ID_RELOCS 0x01 | 898 | #define RADEON_CHUNK_ID_RELOCS 0x01 |
876 | #define RADEON_CHUNK_ID_IB 0x02 | 899 | #define RADEON_CHUNK_ID_IB 0x02 |
877 | #define RADEON_CHUNK_ID_FLAGS 0x03 | 900 | #define RADEON_CHUNK_ID_FLAGS 0x03 |
878 | 901 | ||
879 | /* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */ | 902 | /* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */ |
880 | #define RADEON_CS_KEEP_TILING_FLAGS 0x01 | 903 | #define RADEON_CS_KEEP_TILING_FLAGS 0x01 |
904 | #define RADEON_CS_USE_VM 0x02 | ||
905 | /* The second dword of RADEON_CHUNK_ID_FLAGS is a uint32 that sets the ring type */ | ||
906 | #define RADEON_CS_RING_GFX 0 | ||
907 | #define RADEON_CS_RING_COMPUTE 1 | ||
908 | /* The third dword of RADEON_CHUNK_ID_FLAGS is a sint32 that sets the priority */ | ||
909 | /* 0 = normal, + = higher priority, - = lower priority */ | ||
881 | 910 | ||
882 | struct drm_radeon_cs_chunk { | 911 | struct drm_radeon_cs_chunk { |
883 | uint32_t chunk_id; | 912 | uint32_t chunk_id; |
@@ -885,6 +914,9 @@ struct drm_radeon_cs_chunk { | |||
885 | uint64_t chunk_data; | 914 | uint64_t chunk_data; |
886 | }; | 915 | }; |
887 | 916 | ||
917 | /* drm_radeon_cs_reloc.flags */ | ||
918 | #define RADEON_RELOC_DONT_SYNC 0x01 | ||
919 | |||
888 | struct drm_radeon_cs_reloc { | 920 | struct drm_radeon_cs_reloc { |
889 | uint32_t handle; | 921 | uint32_t handle; |
890 | uint32_t read_domains; | 922 | uint32_t read_domains; |
@@ -916,6 +948,10 @@ struct drm_radeon_cs { | |||
916 | #define RADEON_INFO_NUM_TILE_PIPES 0x0b /* tile pipes for r600+ */ | 948 | #define RADEON_INFO_NUM_TILE_PIPES 0x0b /* tile pipes for r600+ */ |
917 | #define RADEON_INFO_FUSION_GART_WORKING 0x0c /* fusion writes to GTT were broken before this */ | 949 | #define RADEON_INFO_FUSION_GART_WORKING 0x0c /* fusion writes to GTT were broken before this */ |
918 | #define RADEON_INFO_BACKEND_MAP 0x0d /* pipe to backend map, needed by mesa */ | 950 | #define RADEON_INFO_BACKEND_MAP 0x0d /* pipe to backend map, needed by mesa */ |
951 | /* virtual address start, va < start are reserved by the kernel */ | ||
952 | #define RADEON_INFO_VA_START 0x0e | ||
953 | /* maximum size of ib using the virtual memory cs */ | ||
954 | #define RADEON_INFO_IB_VM_MAX_SIZE 0x0f | ||
919 | 955 | ||
920 | struct drm_radeon_info { | 956 | struct drm_radeon_info { |
921 | uint32_t request; | 957 | uint32_t request; |
diff --git a/include/drm/sis_drm.h b/include/drm/sis_drm.h index 30f7b3827466..035b804dda6d 100644 --- a/include/drm/sis_drm.h +++ b/include/drm/sis_drm.h | |||
@@ -64,4 +64,8 @@ typedef struct { | |||
64 | unsigned int offset, size; | 64 | unsigned int offset, size; |
65 | } drm_sis_fb_t; | 65 | } drm_sis_fb_t; |
66 | 66 | ||
67 | struct sis_file_private { | ||
68 | struct list_head obj_list; | ||
69 | }; | ||
70 | |||
67 | #endif /* __SIS_DRM_H__ */ | 71 | #endif /* __SIS_DRM_H__ */ |
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index 42e346985186..974c8f801c39 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h | |||
@@ -122,17 +122,12 @@ struct ttm_mem_reg { | |||
122 | * be mmapped by user space. Each of these bos occupy a slot in the | 122 | * be mmapped by user space. Each of these bos occupy a slot in the |
123 | * device address space, that can be used for normal vm operations. | 123 | * device address space, that can be used for normal vm operations. |
124 | * | 124 | * |
125 | * @ttm_bo_type_user: These are user-space memory areas that are made | ||
126 | * available to the GPU by mapping the buffer pages into the GPU aperture | ||
127 | * space. These buffers cannot be mmaped from the device address space. | ||
128 | * | ||
129 | * @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers, | 125 | * @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers, |
130 | * but they cannot be accessed from user-space. For kernel-only use. | 126 | * but they cannot be accessed from user-space. For kernel-only use. |
131 | */ | 127 | */ |
132 | 128 | ||
133 | enum ttm_bo_type { | 129 | enum ttm_bo_type { |
134 | ttm_bo_type_device, | 130 | ttm_bo_type_device, |
135 | ttm_bo_type_user, | ||
136 | ttm_bo_type_kernel | 131 | ttm_bo_type_kernel |
137 | }; | 132 | }; |
138 | 133 | ||
@@ -434,9 +429,9 @@ extern void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev, | |||
434 | * -EBUSY if the buffer is busy and no_wait is true. | 429 | * -EBUSY if the buffer is busy and no_wait is true. |
435 | * -ERESTARTSYS if interrupted by a signal. | 430 | * -ERESTARTSYS if interrupted by a signal. |
436 | */ | 431 | */ |
437 | |||
438 | extern int | 432 | extern int |
439 | ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait); | 433 | ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait); |
434 | |||
440 | /** | 435 | /** |
441 | * ttm_bo_synccpu_write_release: | 436 | * ttm_bo_synccpu_write_release: |
442 | * | 437 | * |
@@ -447,6 +442,22 @@ ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait); | |||
447 | extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo); | 442 | extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo); |
448 | 443 | ||
449 | /** | 444 | /** |
445 | * ttm_bo_acc_size | ||
446 | * | ||
447 | * @bdev: Pointer to a ttm_bo_device struct. | ||
448 | * @bo_size: size of the buffer object in byte. | ||
449 | * @struct_size: size of the structure holding buffer object datas | ||
450 | * | ||
451 | * Returns size to account for a buffer object | ||
452 | */ | ||
453 | size_t ttm_bo_acc_size(struct ttm_bo_device *bdev, | ||
454 | unsigned long bo_size, | ||
455 | unsigned struct_size); | ||
456 | size_t ttm_bo_dma_acc_size(struct ttm_bo_device *bdev, | ||
457 | unsigned long bo_size, | ||
458 | unsigned struct_size); | ||
459 | |||
460 | /** | ||
450 | * ttm_bo_init | 461 | * ttm_bo_init |
451 | * | 462 | * |
452 | * @bdev: Pointer to a ttm_bo_device struct. | 463 | * @bdev: Pointer to a ttm_bo_device struct. |
@@ -493,6 +504,7 @@ extern int ttm_bo_init(struct ttm_bo_device *bdev, | |||
493 | struct file *persistent_swap_storage, | 504 | struct file *persistent_swap_storage, |
494 | size_t acc_size, | 505 | size_t acc_size, |
495 | void (*destroy) (struct ttm_buffer_object *)); | 506 | void (*destroy) (struct ttm_buffer_object *)); |
507 | |||
496 | /** | 508 | /** |
497 | * ttm_bo_synccpu_object_init | 509 | * ttm_bo_synccpu_object_init |
498 | * | 510 | * |
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 94eb1434316e..d43e892307ff 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
@@ -43,36 +43,9 @@ struct ttm_backend; | |||
43 | 43 | ||
44 | struct ttm_backend_func { | 44 | struct ttm_backend_func { |
45 | /** | 45 | /** |
46 | * struct ttm_backend_func member populate | ||
47 | * | ||
48 | * @backend: Pointer to a struct ttm_backend. | ||
49 | * @num_pages: Number of pages to populate. | ||
50 | * @pages: Array of pointers to ttm pages. | ||
51 | * @dummy_read_page: Page to be used instead of NULL pages in the | ||
52 | * array @pages. | ||
53 | * @dma_addrs: Array of DMA (bus) address of the ttm pages. | ||
54 | * | ||
55 | * Populate the backend with ttm pages. Depending on the backend, | ||
56 | * it may or may not copy the @pages array. | ||
57 | */ | ||
58 | int (*populate) (struct ttm_backend *backend, | ||
59 | unsigned long num_pages, struct page **pages, | ||
60 | struct page *dummy_read_page, | ||
61 | dma_addr_t *dma_addrs); | ||
62 | /** | ||
63 | * struct ttm_backend_func member clear | ||
64 | * | ||
65 | * @backend: Pointer to a struct ttm_backend. | ||
66 | * | ||
67 | * This is an "unpopulate" function. Release all resources | ||
68 | * allocated with populate. | ||
69 | */ | ||
70 | void (*clear) (struct ttm_backend *backend); | ||
71 | |||
72 | /** | ||
73 | * struct ttm_backend_func member bind | 46 | * struct ttm_backend_func member bind |
74 | * | 47 | * |
75 | * @backend: Pointer to a struct ttm_backend. | 48 | * @ttm: Pointer to a struct ttm_tt. |
76 | * @bo_mem: Pointer to a struct ttm_mem_reg describing the | 49 | * @bo_mem: Pointer to a struct ttm_mem_reg describing the |
77 | * memory type and location for binding. | 50 | * memory type and location for binding. |
78 | * | 51 | * |
@@ -80,46 +53,29 @@ struct ttm_backend_func { | |||
80 | * indicated by @bo_mem. This function should be able to handle | 53 | * indicated by @bo_mem. This function should be able to handle |
81 | * differences between aperture and system page sizes. | 54 | * differences between aperture and system page sizes. |
82 | */ | 55 | */ |
83 | int (*bind) (struct ttm_backend *backend, struct ttm_mem_reg *bo_mem); | 56 | int (*bind) (struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem); |
84 | 57 | ||
85 | /** | 58 | /** |
86 | * struct ttm_backend_func member unbind | 59 | * struct ttm_backend_func member unbind |
87 | * | 60 | * |
88 | * @backend: Pointer to a struct ttm_backend. | 61 | * @ttm: Pointer to a struct ttm_tt. |
89 | * | 62 | * |
90 | * Unbind previously bound backend pages. This function should be | 63 | * Unbind previously bound backend pages. This function should be |
91 | * able to handle differences between aperture and system page sizes. | 64 | * able to handle differences between aperture and system page sizes. |
92 | */ | 65 | */ |
93 | int (*unbind) (struct ttm_backend *backend); | 66 | int (*unbind) (struct ttm_tt *ttm); |
94 | 67 | ||
95 | /** | 68 | /** |
96 | * struct ttm_backend_func member destroy | 69 | * struct ttm_backend_func member destroy |
97 | * | 70 | * |
98 | * @backend: Pointer to a struct ttm_backend. | 71 | * @ttm: Pointer to a struct ttm_tt. |
99 | * | 72 | * |
100 | * Destroy the backend. | 73 | * Destroy the backend. This will be call back from ttm_tt_destroy so |
74 | * don't call ttm_tt_destroy from the callback or infinite loop. | ||
101 | */ | 75 | */ |
102 | void (*destroy) (struct ttm_backend *backend); | 76 | void (*destroy) (struct ttm_tt *ttm); |
103 | }; | ||
104 | |||
105 | /** | ||
106 | * struct ttm_backend | ||
107 | * | ||
108 | * @bdev: Pointer to a struct ttm_bo_device. | ||
109 | * @flags: For driver use. | ||
110 | * @func: Pointer to a struct ttm_backend_func that describes | ||
111 | * the backend methods. | ||
112 | * | ||
113 | */ | ||
114 | |||
115 | struct ttm_backend { | ||
116 | struct ttm_bo_device *bdev; | ||
117 | uint32_t flags; | ||
118 | struct ttm_backend_func *func; | ||
119 | }; | 77 | }; |
120 | 78 | ||
121 | #define TTM_PAGE_FLAG_USER (1 << 1) | ||
122 | #define TTM_PAGE_FLAG_USER_DIRTY (1 << 2) | ||
123 | #define TTM_PAGE_FLAG_WRITE (1 << 3) | 79 | #define TTM_PAGE_FLAG_WRITE (1 << 3) |
124 | #define TTM_PAGE_FLAG_SWAPPED (1 << 4) | 80 | #define TTM_PAGE_FLAG_SWAPPED (1 << 4) |
125 | #define TTM_PAGE_FLAG_PERSISTENT_SWAP (1 << 5) | 81 | #define TTM_PAGE_FLAG_PERSISTENT_SWAP (1 << 5) |
@@ -135,23 +91,18 @@ enum ttm_caching_state { | |||
135 | /** | 91 | /** |
136 | * struct ttm_tt | 92 | * struct ttm_tt |
137 | * | 93 | * |
94 | * @bdev: Pointer to a struct ttm_bo_device. | ||
95 | * @func: Pointer to a struct ttm_backend_func that describes | ||
96 | * the backend methods. | ||
138 | * @dummy_read_page: Page to map where the ttm_tt page array contains a NULL | 97 | * @dummy_read_page: Page to map where the ttm_tt page array contains a NULL |
139 | * pointer. | 98 | * pointer. |
140 | * @pages: Array of pages backing the data. | 99 | * @pages: Array of pages backing the data. |
141 | * @first_himem_page: Himem pages are put last in the page array, which | ||
142 | * enables us to run caching attribute changes on only the first part | ||
143 | * of the page array containing lomem pages. This is the index of the | ||
144 | * first himem page. | ||
145 | * @last_lomem_page: Index of the last lomem page in the page array. | ||
146 | * @num_pages: Number of pages in the page array. | 100 | * @num_pages: Number of pages in the page array. |
147 | * @bdev: Pointer to the current struct ttm_bo_device. | 101 | * @bdev: Pointer to the current struct ttm_bo_device. |
148 | * @be: Pointer to the ttm backend. | 102 | * @be: Pointer to the ttm backend. |
149 | * @tsk: The task for user ttm. | ||
150 | * @start: virtual address for user ttm. | ||
151 | * @swap_storage: Pointer to shmem struct file for swap storage. | 103 | * @swap_storage: Pointer to shmem struct file for swap storage. |
152 | * @caching_state: The current caching state of the pages. | 104 | * @caching_state: The current caching state of the pages. |
153 | * @state: The current binding state of the pages. | 105 | * @state: The current binding state of the pages. |
154 | * @dma_address: The DMA (bus) addresses of the pages (if TTM_PAGE_FLAG_DMA32) | ||
155 | * | 106 | * |
156 | * This is a structure holding the pages, caching- and aperture binding | 107 | * This is a structure holding the pages, caching- and aperture binding |
157 | * status for a buffer object that isn't backed by fixed (VRAM / AGP) | 108 | * status for a buffer object that isn't backed by fixed (VRAM / AGP) |
@@ -159,16 +110,14 @@ enum ttm_caching_state { | |||
159 | */ | 110 | */ |
160 | 111 | ||
161 | struct ttm_tt { | 112 | struct ttm_tt { |
113 | struct ttm_bo_device *bdev; | ||
114 | struct ttm_backend_func *func; | ||
162 | struct page *dummy_read_page; | 115 | struct page *dummy_read_page; |
163 | struct page **pages; | 116 | struct page **pages; |
164 | long first_himem_page; | ||
165 | long last_lomem_page; | ||
166 | uint32_t page_flags; | 117 | uint32_t page_flags; |
167 | unsigned long num_pages; | 118 | unsigned long num_pages; |
168 | struct ttm_bo_global *glob; | 119 | struct ttm_bo_global *glob; |
169 | struct ttm_backend *be; | 120 | struct ttm_backend *be; |
170 | struct task_struct *tsk; | ||
171 | unsigned long start; | ||
172 | struct file *swap_storage; | 121 | struct file *swap_storage; |
173 | enum ttm_caching_state caching_state; | 122 | enum ttm_caching_state caching_state; |
174 | enum { | 123 | enum { |
@@ -176,7 +125,23 @@ struct ttm_tt { | |||
176 | tt_unbound, | 125 | tt_unbound, |
177 | tt_unpopulated, | 126 | tt_unpopulated, |
178 | } state; | 127 | } state; |
128 | }; | ||
129 | |||
130 | /** | ||
131 | * struct ttm_dma_tt | ||
132 | * | ||
133 | * @ttm: Base ttm_tt struct. | ||
134 | * @dma_address: The DMA (bus) addresses of the pages | ||
135 | * @pages_list: used by some page allocation backend | ||
136 | * | ||
137 | * This is a structure holding the pages, caching- and aperture binding | ||
138 | * status for a buffer object that isn't backed by fixed (VRAM / AGP) | ||
139 | * memory. | ||
140 | */ | ||
141 | struct ttm_dma_tt { | ||
142 | struct ttm_tt ttm; | ||
179 | dma_addr_t *dma_address; | 143 | dma_addr_t *dma_address; |
144 | struct list_head pages_list; | ||
180 | }; | 145 | }; |
181 | 146 | ||
182 | #define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */ | 147 | #define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */ |
@@ -351,15 +316,42 @@ struct ttm_mem_type_manager { | |||
351 | 316 | ||
352 | struct ttm_bo_driver { | 317 | struct ttm_bo_driver { |
353 | /** | 318 | /** |
354 | * struct ttm_bo_driver member create_ttm_backend_entry | 319 | * ttm_tt_create |
355 | * | 320 | * |
356 | * @bdev: The buffer object device. | 321 | * @bdev: pointer to a struct ttm_bo_device: |
322 | * @size: Size of the data needed backing. | ||
323 | * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags. | ||
324 | * @dummy_read_page: See struct ttm_bo_device. | ||
357 | * | 325 | * |
358 | * Create a driver specific struct ttm_backend. | 326 | * Create a struct ttm_tt to back data with system memory pages. |
327 | * No pages are actually allocated. | ||
328 | * Returns: | ||
329 | * NULL: Out of memory. | ||
359 | */ | 330 | */ |
331 | struct ttm_tt *(*ttm_tt_create)(struct ttm_bo_device *bdev, | ||
332 | unsigned long size, | ||
333 | uint32_t page_flags, | ||
334 | struct page *dummy_read_page); | ||
360 | 335 | ||
361 | struct ttm_backend *(*create_ttm_backend_entry) | 336 | /** |
362 | (struct ttm_bo_device *bdev); | 337 | * ttm_tt_populate |
338 | * | ||
339 | * @ttm: The struct ttm_tt to contain the backing pages. | ||
340 | * | ||
341 | * Allocate all backing pages | ||
342 | * Returns: | ||
343 | * -ENOMEM: Out of memory. | ||
344 | */ | ||
345 | int (*ttm_tt_populate)(struct ttm_tt *ttm); | ||
346 | |||
347 | /** | ||
348 | * ttm_tt_unpopulate | ||
349 | * | ||
350 | * @ttm: The struct ttm_tt to contain the backing pages. | ||
351 | * | ||
352 | * Free all backing page | ||
353 | */ | ||
354 | void (*ttm_tt_unpopulate)(struct ttm_tt *ttm); | ||
363 | 355 | ||
364 | /** | 356 | /** |
365 | * struct ttm_bo_driver member invalidate_caches | 357 | * struct ttm_bo_driver member invalidate_caches |
@@ -477,9 +469,6 @@ struct ttm_bo_global_ref { | |||
477 | * @dummy_read_page: Pointer to a dummy page used for mapping requests | 469 | * @dummy_read_page: Pointer to a dummy page used for mapping requests |
478 | * of unpopulated pages. | 470 | * of unpopulated pages. |
479 | * @shrink: A shrink callback object used for buffer object swap. | 471 | * @shrink: A shrink callback object used for buffer object swap. |
480 | * @ttm_bo_extra_size: Extra size (sizeof(struct ttm_buffer_object) excluded) | ||
481 | * used by a buffer object. This is excluding page arrays and backing pages. | ||
482 | * @ttm_bo_size: This is @ttm_bo_extra_size + sizeof(struct ttm_buffer_object). | ||
483 | * @device_list_mutex: Mutex protecting the device list. | 472 | * @device_list_mutex: Mutex protecting the device list. |
484 | * This mutex is held while traversing the device list for pm options. | 473 | * This mutex is held while traversing the device list for pm options. |
485 | * @lru_lock: Spinlock protecting the bo subsystem lru lists. | 474 | * @lru_lock: Spinlock protecting the bo subsystem lru lists. |
@@ -497,8 +486,6 @@ struct ttm_bo_global { | |||
497 | struct ttm_mem_global *mem_glob; | 486 | struct ttm_mem_global *mem_glob; |
498 | struct page *dummy_read_page; | 487 | struct page *dummy_read_page; |
499 | struct ttm_mem_shrink shrink; | 488 | struct ttm_mem_shrink shrink; |
500 | size_t ttm_bo_extra_size; | ||
501 | size_t ttm_bo_size; | ||
502 | struct mutex device_list_mutex; | 489 | struct mutex device_list_mutex; |
503 | spinlock_t lru_lock; | 490 | spinlock_t lru_lock; |
504 | 491 | ||
@@ -600,8 +587,9 @@ ttm_flag_masked(uint32_t *old, uint32_t new, uint32_t mask) | |||
600 | } | 587 | } |
601 | 588 | ||
602 | /** | 589 | /** |
603 | * ttm_tt_create | 590 | * ttm_tt_init |
604 | * | 591 | * |
592 | * @ttm: The struct ttm_tt. | ||
605 | * @bdev: pointer to a struct ttm_bo_device: | 593 | * @bdev: pointer to a struct ttm_bo_device: |
606 | * @size: Size of the data needed backing. | 594 | * @size: Size of the data needed backing. |
607 | * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags. | 595 | * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags. |
@@ -612,28 +600,22 @@ ttm_flag_masked(uint32_t *old, uint32_t new, uint32_t mask) | |||
612 | * Returns: | 600 | * Returns: |
613 | * NULL: Out of memory. | 601 | * NULL: Out of memory. |
614 | */ | 602 | */ |
615 | extern struct ttm_tt *ttm_tt_create(struct ttm_bo_device *bdev, | 603 | extern int ttm_tt_init(struct ttm_tt *ttm, struct ttm_bo_device *bdev, |
616 | unsigned long size, | 604 | unsigned long size, uint32_t page_flags, |
617 | uint32_t page_flags, | 605 | struct page *dummy_read_page); |
618 | struct page *dummy_read_page); | 606 | extern int ttm_dma_tt_init(struct ttm_dma_tt *ttm_dma, struct ttm_bo_device *bdev, |
607 | unsigned long size, uint32_t page_flags, | ||
608 | struct page *dummy_read_page); | ||
619 | 609 | ||
620 | /** | 610 | /** |
621 | * ttm_tt_set_user: | 611 | * ttm_tt_fini |
622 | * | 612 | * |
623 | * @ttm: The struct ttm_tt to populate. | 613 | * @ttm: the ttm_tt structure. |
624 | * @tsk: A struct task_struct for which @start is a valid user-space address. | ||
625 | * @start: A valid user-space address. | ||
626 | * @num_pages: Size in pages of the user memory area. | ||
627 | * | 614 | * |
628 | * Populate a struct ttm_tt with a user-space memory area after first pinning | 615 | * Free memory of ttm_tt structure |
629 | * the pages backing it. | ||
630 | * Returns: | ||
631 | * !0: Error. | ||
632 | */ | 616 | */ |
633 | 617 | extern void ttm_tt_fini(struct ttm_tt *ttm); | |
634 | extern int ttm_tt_set_user(struct ttm_tt *ttm, | 618 | extern void ttm_dma_tt_fini(struct ttm_dma_tt *ttm_dma); |
635 | struct task_struct *tsk, | ||
636 | unsigned long start, unsigned long num_pages); | ||
637 | 619 | ||
638 | /** | 620 | /** |
639 | * ttm_ttm_bind: | 621 | * ttm_ttm_bind: |
@@ -646,20 +628,11 @@ extern int ttm_tt_set_user(struct ttm_tt *ttm, | |||
646 | extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem); | 628 | extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem); |
647 | 629 | ||
648 | /** | 630 | /** |
649 | * ttm_tt_populate: | ||
650 | * | ||
651 | * @ttm: The struct ttm_tt to contain the backing pages. | ||
652 | * | ||
653 | * Add backing pages to all of @ttm | ||
654 | */ | ||
655 | extern int ttm_tt_populate(struct ttm_tt *ttm); | ||
656 | |||
657 | /** | ||
658 | * ttm_ttm_destroy: | 631 | * ttm_ttm_destroy: |
659 | * | 632 | * |
660 | * @ttm: The struct ttm_tt. | 633 | * @ttm: The struct ttm_tt. |
661 | * | 634 | * |
662 | * Unbind, unpopulate and destroy a struct ttm_tt. | 635 | * Unbind, unpopulate and destroy common struct ttm_tt. |
663 | */ | 636 | */ |
664 | extern void ttm_tt_destroy(struct ttm_tt *ttm); | 637 | extern void ttm_tt_destroy(struct ttm_tt *ttm); |
665 | 638 | ||
@@ -673,19 +646,13 @@ extern void ttm_tt_destroy(struct ttm_tt *ttm); | |||
673 | extern void ttm_tt_unbind(struct ttm_tt *ttm); | 646 | extern void ttm_tt_unbind(struct ttm_tt *ttm); |
674 | 647 | ||
675 | /** | 648 | /** |
676 | * ttm_ttm_destroy: | 649 | * ttm_tt_swapin: |
677 | * | 650 | * |
678 | * @ttm: The struct ttm_tt. | 651 | * @ttm: The struct ttm_tt. |
679 | * @index: Index of the desired page. | ||
680 | * | ||
681 | * Return a pointer to the struct page backing @ttm at page | ||
682 | * index @index. If the page is unpopulated, one will be allocated to | ||
683 | * populate that index. | ||
684 | * | 652 | * |
685 | * Returns: | 653 | * Swap in a previously swap out ttm_tt. |
686 | * NULL on OOM. | ||
687 | */ | 654 | */ |
688 | extern struct page *ttm_tt_get_page(struct ttm_tt *ttm, int index); | 655 | extern int ttm_tt_swapin(struct ttm_tt *ttm); |
689 | 656 | ||
690 | /** | 657 | /** |
691 | * ttm_tt_cache_flush: | 658 | * ttm_tt_cache_flush: |
@@ -1046,17 +1013,25 @@ extern const struct ttm_mem_type_manager_func ttm_bo_manager_func; | |||
1046 | #include <linux/agp_backend.h> | 1013 | #include <linux/agp_backend.h> |
1047 | 1014 | ||
1048 | /** | 1015 | /** |
1049 | * ttm_agp_backend_init | 1016 | * ttm_agp_tt_create |
1050 | * | 1017 | * |
1051 | * @bdev: Pointer to a struct ttm_bo_device. | 1018 | * @bdev: Pointer to a struct ttm_bo_device. |
1052 | * @bridge: The agp bridge this device is sitting on. | 1019 | * @bridge: The agp bridge this device is sitting on. |
1020 | * @size: Size of the data needed backing. | ||
1021 | * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags. | ||
1022 | * @dummy_read_page: See struct ttm_bo_device. | ||
1023 | * | ||
1053 | * | 1024 | * |
1054 | * Create a TTM backend that uses the indicated AGP bridge as an aperture | 1025 | * Create a TTM backend that uses the indicated AGP bridge as an aperture |
1055 | * for TT memory. This function uses the linux agpgart interface to | 1026 | * for TT memory. This function uses the linux agpgart interface to |
1056 | * bind and unbind memory backing a ttm_tt. | 1027 | * bind and unbind memory backing a ttm_tt. |
1057 | */ | 1028 | */ |
1058 | extern struct ttm_backend *ttm_agp_backend_init(struct ttm_bo_device *bdev, | 1029 | extern struct ttm_tt *ttm_agp_tt_create(struct ttm_bo_device *bdev, |
1059 | struct agp_bridge_data *bridge); | 1030 | struct agp_bridge_data *bridge, |
1031 | unsigned long size, uint32_t page_flags, | ||
1032 | struct page *dummy_read_page); | ||
1033 | int ttm_agp_tt_populate(struct ttm_tt *ttm); | ||
1034 | void ttm_agp_tt_unpopulate(struct ttm_tt *ttm); | ||
1060 | #endif | 1035 | #endif |
1061 | 1036 | ||
1062 | #endif | 1037 | #endif |
diff --git a/include/drm/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h index 129de12353f1..5fe27400d176 100644 --- a/include/drm/ttm/ttm_page_alloc.h +++ b/include/drm/ttm/ttm_page_alloc.h | |||
@@ -30,45 +30,70 @@ | |||
30 | #include "ttm_memory.h" | 30 | #include "ttm_memory.h" |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Get count number of pages from pool to pages list. | 33 | * Initialize pool allocator. |
34 | */ | ||
35 | int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages); | ||
36 | /** | ||
37 | * Free pool allocator. | ||
38 | */ | ||
39 | void ttm_page_alloc_fini(void); | ||
40 | |||
41 | /** | ||
42 | * ttm_pool_populate: | ||
43 | * | ||
44 | * @ttm: The struct ttm_tt to contain the backing pages. | ||
34 | * | 45 | * |
35 | * @pages: head of empty linked list where pages are filled. | 46 | * Add backing pages to all of @ttm |
36 | * @flags: ttm flags for page allocation. | ||
37 | * @cstate: ttm caching state for the page. | ||
38 | * @count: number of pages to allocate. | ||
39 | * @dma_address: The DMA (bus) address of pages (if TTM_PAGE_FLAG_DMA32 set). | ||
40 | */ | 47 | */ |
41 | int ttm_get_pages(struct list_head *pages, | 48 | extern int ttm_pool_populate(struct ttm_tt *ttm); |
42 | int flags, | 49 | |
43 | enum ttm_caching_state cstate, | ||
44 | unsigned count, | ||
45 | dma_addr_t *dma_address); | ||
46 | /** | 50 | /** |
47 | * Put linked list of pages to pool. | 51 | * ttm_pool_unpopulate: |
52 | * | ||
53 | * @ttm: The struct ttm_tt which to free backing pages. | ||
48 | * | 54 | * |
49 | * @pages: list of pages to free. | 55 | * Free all pages of @ttm |
50 | * @page_count: number of pages in the list. Zero can be passed for unknown | ||
51 | * count. | ||
52 | * @flags: ttm flags for page allocation. | ||
53 | * @cstate: ttm caching state. | ||
54 | * @dma_address: The DMA (bus) address of pages (if TTM_PAGE_FLAG_DMA32 set). | ||
55 | */ | 56 | */ |
56 | void ttm_put_pages(struct list_head *pages, | 57 | extern void ttm_pool_unpopulate(struct ttm_tt *ttm); |
57 | unsigned page_count, | 58 | |
58 | int flags, | 59 | /** |
59 | enum ttm_caching_state cstate, | 60 | * Output the state of pools to debugfs file |
60 | dma_addr_t *dma_address); | 61 | */ |
62 | extern int ttm_page_alloc_debugfs(struct seq_file *m, void *data); | ||
63 | |||
64 | |||
65 | #ifdef CONFIG_SWIOTLB | ||
61 | /** | 66 | /** |
62 | * Initialize pool allocator. | 67 | * Initialize pool allocator. |
63 | */ | 68 | */ |
64 | int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages); | 69 | int ttm_dma_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages); |
70 | |||
65 | /** | 71 | /** |
66 | * Free pool allocator. | 72 | * Free pool allocator. |
67 | */ | 73 | */ |
68 | void ttm_page_alloc_fini(void); | 74 | void ttm_dma_page_alloc_fini(void); |
69 | 75 | ||
70 | /** | 76 | /** |
71 | * Output the state of pools to debugfs file | 77 | * Output the state of pools to debugfs file |
72 | */ | 78 | */ |
73 | extern int ttm_page_alloc_debugfs(struct seq_file *m, void *data); | 79 | extern int ttm_dma_page_alloc_debugfs(struct seq_file *m, void *data); |
80 | |||
81 | extern int ttm_dma_populate(struct ttm_dma_tt *ttm_dma, struct device *dev); | ||
82 | extern void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev); | ||
83 | |||
84 | #else | ||
85 | static inline int ttm_dma_page_alloc_init(struct ttm_mem_global *glob, | ||
86 | unsigned max_pages) | ||
87 | { | ||
88 | return -ENODEV; | ||
89 | } | ||
90 | |||
91 | static inline void ttm_dma_page_alloc_fini(void) { return; } | ||
92 | |||
93 | static inline int ttm_dma_page_alloc_debugfs(struct seq_file *m, void *data) | ||
94 | { | ||
95 | return 0; | ||
96 | } | ||
97 | #endif | ||
98 | |||
74 | #endif | 99 | #endif |
diff --git a/include/drm/via_drm.h b/include/drm/via_drm.h index fd11a5bd892d..79b3b6e0f6b3 100644 --- a/include/drm/via_drm.h +++ b/include/drm/via_drm.h | |||
@@ -274,4 +274,8 @@ typedef struct drm_via_dmablit { | |||
274 | drm_via_blitsync_t sync; | 274 | drm_via_blitsync_t sync; |
275 | } drm_via_dmablit_t; | 275 | } drm_via_dmablit_t; |
276 | 276 | ||
277 | struct via_file_private { | ||
278 | struct list_head obj_list; | ||
279 | }; | ||
280 | |||
277 | #endif /* _VIA_DRM_H_ */ | 281 | #endif /* _VIA_DRM_H_ */ |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 6001b4da39dd..627a3a42e4d8 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -302,6 +302,10 @@ extern bool osc_sb_apei_support_acked; | |||
302 | OSC_PCI_EXPRESS_PME_CONTROL | \ | 302 | OSC_PCI_EXPRESS_PME_CONTROL | \ |
303 | OSC_PCI_EXPRESS_AER_CONTROL | \ | 303 | OSC_PCI_EXPRESS_AER_CONTROL | \ |
304 | OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL) | 304 | OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL) |
305 | |||
306 | #define OSC_PCI_NATIVE_HOTPLUG (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \ | ||
307 | OSC_SHPC_NATIVE_HP_CONTROL) | ||
308 | |||
305 | extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, | 309 | extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, |
306 | u32 *mask, u32 req); | 310 | u32 *mask, u32 req); |
307 | extern void acpi_early_init(void); | 311 | extern void acpi_early_init(void); |
diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h index be3d9a77d6ed..73a25005d88a 100644 --- a/include/linux/ahci_platform.h +++ b/include/linux/ahci_platform.h | |||
@@ -23,6 +23,8 @@ struct ata_port_info; | |||
23 | struct ahci_platform_data { | 23 | struct ahci_platform_data { |
24 | int (*init)(struct device *dev, void __iomem *addr); | 24 | int (*init)(struct device *dev, void __iomem *addr); |
25 | void (*exit)(struct device *dev); | 25 | void (*exit)(struct device *dev); |
26 | int (*suspend)(struct device *dev); | ||
27 | int (*resume)(struct device *dev); | ||
26 | const struct ata_port_info *ata_port_info; | 28 | const struct ata_port_info *ata_port_info; |
27 | unsigned int force_port_map; | 29 | unsigned int force_port_map; |
28 | unsigned int mask_port_map; | 30 | unsigned int mask_port_map; |
diff --git a/include/linux/amd-iommu.h b/include/linux/amd-iommu.h index a6863a2dec1f..ef00610837d4 100644 --- a/include/linux/amd-iommu.h +++ b/include/linux/amd-iommu.h | |||
@@ -20,12 +20,148 @@ | |||
20 | #ifndef _ASM_X86_AMD_IOMMU_H | 20 | #ifndef _ASM_X86_AMD_IOMMU_H |
21 | #define _ASM_X86_AMD_IOMMU_H | 21 | #define _ASM_X86_AMD_IOMMU_H |
22 | 22 | ||
23 | #include <linux/irqreturn.h> | 23 | #include <linux/types.h> |
24 | 24 | ||
25 | #ifdef CONFIG_AMD_IOMMU | 25 | #ifdef CONFIG_AMD_IOMMU |
26 | 26 | ||
27 | struct task_struct; | ||
28 | struct pci_dev; | ||
29 | |||
27 | extern int amd_iommu_detect(void); | 30 | extern int amd_iommu_detect(void); |
28 | 31 | ||
32 | |||
33 | /** | ||
34 | * amd_iommu_enable_device_erratum() - Enable erratum workaround for device | ||
35 | * in the IOMMUv2 driver | ||
36 | * @pdev: The PCI device the workaround is necessary for | ||
37 | * @erratum: The erratum workaround to enable | ||
38 | * | ||
39 | * The function needs to be called before amd_iommu_init_device(). | ||
40 | * Possible values for the erratum number are for now: | ||
41 | * - AMD_PRI_DEV_ERRATUM_ENABLE_RESET - Reset PRI capability when PRI | ||
42 | * is enabled | ||
43 | * - AMD_PRI_DEV_ERRATUM_LIMIT_REQ_ONE - Limit number of outstanding PRI | ||
44 | * requests to one | ||
45 | */ | ||
46 | #define AMD_PRI_DEV_ERRATUM_ENABLE_RESET 0 | ||
47 | #define AMD_PRI_DEV_ERRATUM_LIMIT_REQ_ONE 1 | ||
48 | |||
49 | extern void amd_iommu_enable_device_erratum(struct pci_dev *pdev, u32 erratum); | ||
50 | |||
51 | /** | ||
52 | * amd_iommu_init_device() - Init device for use with IOMMUv2 driver | ||
53 | * @pdev: The PCI device to initialize | ||
54 | * @pasids: Number of PASIDs to support for this device | ||
55 | * | ||
56 | * This function does all setup for the device pdev so that it can be | ||
57 | * used with IOMMUv2. | ||
58 | * Returns 0 on success or negative value on error. | ||
59 | */ | ||
60 | extern int amd_iommu_init_device(struct pci_dev *pdev, int pasids); | ||
61 | |||
62 | /** | ||
63 | * amd_iommu_free_device() - Free all IOMMUv2 related device resources | ||
64 | * and disable IOMMUv2 usage for this device | ||
65 | * @pdev: The PCI device to disable IOMMUv2 usage for' | ||
66 | */ | ||
67 | extern void amd_iommu_free_device(struct pci_dev *pdev); | ||
68 | |||
69 | /** | ||
70 | * amd_iommu_bind_pasid() - Bind a given task to a PASID on a device | ||
71 | * @pdev: The PCI device to bind the task to | ||
72 | * @pasid: The PASID on the device the task should be bound to | ||
73 | * @task: the task to bind | ||
74 | * | ||
75 | * The function returns 0 on success or a negative value on error. | ||
76 | */ | ||
77 | extern int amd_iommu_bind_pasid(struct pci_dev *pdev, int pasid, | ||
78 | struct task_struct *task); | ||
79 | |||
80 | /** | ||
81 | * amd_iommu_unbind_pasid() - Unbind a PASID from its task on | ||
82 | * a device | ||
83 | * @pdev: The device of the PASID | ||
84 | * @pasid: The PASID to unbind | ||
85 | * | ||
86 | * When this function returns the device is no longer using the PASID | ||
87 | * and the PASID is no longer bound to its task. | ||
88 | */ | ||
89 | extern void amd_iommu_unbind_pasid(struct pci_dev *pdev, int pasid); | ||
90 | |||
91 | /** | ||
92 | * amd_iommu_set_invalid_ppr_cb() - Register a call-back for failed | ||
93 | * PRI requests | ||
94 | * @pdev: The PCI device the call-back should be registered for | ||
95 | * @cb: The call-back function | ||
96 | * | ||
97 | * The IOMMUv2 driver invokes this call-back when it is unable to | ||
98 | * successfully handle a PRI request. The device driver can then decide | ||
99 | * which PRI response the device should see. Possible return values for | ||
100 | * the call-back are: | ||
101 | * | ||
102 | * - AMD_IOMMU_INV_PRI_RSP_SUCCESS - Send SUCCESS back to the device | ||
103 | * - AMD_IOMMU_INV_PRI_RSP_INVALID - Send INVALID back to the device | ||
104 | * - AMD_IOMMU_INV_PRI_RSP_FAIL - Send Failure back to the device, | ||
105 | * the device is required to disable | ||
106 | * PRI when it receives this response | ||
107 | * | ||
108 | * The function returns 0 on success or negative value on error. | ||
109 | */ | ||
110 | #define AMD_IOMMU_INV_PRI_RSP_SUCCESS 0 | ||
111 | #define AMD_IOMMU_INV_PRI_RSP_INVALID 1 | ||
112 | #define AMD_IOMMU_INV_PRI_RSP_FAIL 2 | ||
113 | |||
114 | typedef int (*amd_iommu_invalid_ppr_cb)(struct pci_dev *pdev, | ||
115 | int pasid, | ||
116 | unsigned long address, | ||
117 | u16); | ||
118 | |||
119 | extern int amd_iommu_set_invalid_ppr_cb(struct pci_dev *pdev, | ||
120 | amd_iommu_invalid_ppr_cb cb); | ||
121 | |||
122 | /** | ||
123 | * amd_iommu_device_info() - Get information about IOMMUv2 support of a | ||
124 | * PCI device | ||
125 | * @pdev: PCI device to query information from | ||
126 | * @info: A pointer to an amd_iommu_device_info structure which will contain | ||
127 | * the information about the PCI device | ||
128 | * | ||
129 | * Returns 0 on success, negative value on error | ||
130 | */ | ||
131 | |||
132 | #define AMD_IOMMU_DEVICE_FLAG_ATS_SUP 0x1 /* ATS feature supported */ | ||
133 | #define AMD_IOMMU_DEVICE_FLAG_PRI_SUP 0x2 /* PRI feature supported */ | ||
134 | #define AMD_IOMMU_DEVICE_FLAG_PASID_SUP 0x4 /* PASID context supported */ | ||
135 | #define AMD_IOMMU_DEVICE_FLAG_EXEC_SUP 0x8 /* Device may request execution | ||
136 | on memory pages */ | ||
137 | #define AMD_IOMMU_DEVICE_FLAG_PRIV_SUP 0x10 /* Device may request | ||
138 | super-user privileges */ | ||
139 | |||
140 | struct amd_iommu_device_info { | ||
141 | int max_pasids; | ||
142 | u32 flags; | ||
143 | }; | ||
144 | |||
145 | extern int amd_iommu_device_info(struct pci_dev *pdev, | ||
146 | struct amd_iommu_device_info *info); | ||
147 | |||
148 | /** | ||
149 | * amd_iommu_set_invalidate_ctx_cb() - Register a call-back for invalidating | ||
150 | * a pasid context. This call-back is | ||
151 | * invoked when the IOMMUv2 driver needs to | ||
152 | * invalidate a PASID context, for example | ||
153 | * because the task that is bound to that | ||
154 | * context is about to exit. | ||
155 | * | ||
156 | * @pdev: The PCI device the call-back should be registered for | ||
157 | * @cb: The call-back function | ||
158 | */ | ||
159 | |||
160 | typedef void (*amd_iommu_invalidate_ctx)(struct pci_dev *pdev, int pasid); | ||
161 | |||
162 | extern int amd_iommu_set_invalidate_ctx_cb(struct pci_dev *pdev, | ||
163 | amd_iommu_invalidate_ctx cb); | ||
164 | |||
29 | #else | 165 | #else |
30 | 166 | ||
31 | static inline int amd_iommu_detect(void) { return -ENODEV; } | 167 | static inline int amd_iommu_detect(void) { return -ENODEV; } |
diff --git a/include/linux/dlm.h b/include/linux/dlm.h index d4e02f5353a0..6c7f6e9546c7 100644 --- a/include/linux/dlm.h +++ b/include/linux/dlm.h | |||
@@ -2,7 +2,7 @@ | |||
2 | ******************************************************************************* | 2 | ******************************************************************************* |
3 | ** | 3 | ** |
4 | ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. | 4 | ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. |
5 | ** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. | 5 | ** Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. |
6 | ** | 6 | ** |
7 | ** This copyrighted material is made available to anyone wishing to use, | 7 | ** This copyrighted material is made available to anyone wishing to use, |
8 | ** modify, copy, or redistribute it subject to the terms and conditions | 8 | ** modify, copy, or redistribute it subject to the terms and conditions |
@@ -74,15 +74,76 @@ struct dlm_lksb { | |||
74 | 74 | ||
75 | #ifdef __KERNEL__ | 75 | #ifdef __KERNEL__ |
76 | 76 | ||
77 | struct dlm_slot { | ||
78 | int nodeid; /* 1 to MAX_INT */ | ||
79 | int slot; /* 1 to MAX_INT */ | ||
80 | }; | ||
81 | |||
82 | /* | ||
83 | * recover_prep: called before the dlm begins lock recovery. | ||
84 | * Notfies lockspace user that locks from failed members will be granted. | ||
85 | * recover_slot: called after recover_prep and before recover_done. | ||
86 | * Identifies a failed lockspace member. | ||
87 | * recover_done: called after the dlm completes lock recovery. | ||
88 | * Identifies lockspace members and lockspace generation number. | ||
89 | */ | ||
90 | |||
91 | struct dlm_lockspace_ops { | ||
92 | void (*recover_prep) (void *ops_arg); | ||
93 | void (*recover_slot) (void *ops_arg, struct dlm_slot *slot); | ||
94 | void (*recover_done) (void *ops_arg, struct dlm_slot *slots, | ||
95 | int num_slots, int our_slot, uint32_t generation); | ||
96 | }; | ||
97 | |||
77 | /* | 98 | /* |
78 | * dlm_new_lockspace | 99 | * dlm_new_lockspace |
79 | * | 100 | * |
80 | * Starts a lockspace with the given name. If the named lockspace exists in | 101 | * Create/join a lockspace. |
81 | * the cluster, the calling node joins it. | 102 | * |
103 | * name: lockspace name, null terminated, up to DLM_LOCKSPACE_LEN (not | ||
104 | * including terminating null). | ||
105 | * | ||
106 | * cluster: cluster name, null terminated, up to DLM_LOCKSPACE_LEN (not | ||
107 | * including terminating null). Optional. When cluster is null, it | ||
108 | * is not used. When set, dlm_new_lockspace() returns -EBADR if cluster | ||
109 | * is not equal to the dlm cluster name. | ||
110 | * | ||
111 | * flags: | ||
112 | * DLM_LSFL_NODIR | ||
113 | * The dlm should not use a resource directory, but statically assign | ||
114 | * resource mastery to nodes based on the name hash that is otherwise | ||
115 | * used to select the directory node. Must be the same on all nodes. | ||
116 | * DLM_LSFL_TIMEWARN | ||
117 | * The dlm should emit netlink messages if locks have been waiting | ||
118 | * for a configurable amount of time. (Unused.) | ||
119 | * DLM_LSFL_FS | ||
120 | * The lockspace user is in the kernel (i.e. filesystem). Enables | ||
121 | * direct bast/cast callbacks. | ||
122 | * DLM_LSFL_NEWEXCL | ||
123 | * dlm_new_lockspace() should return -EEXIST if the lockspace exists. | ||
124 | * | ||
125 | * lvblen: length of lvb in bytes. Must be multiple of 8. | ||
126 | * dlm_new_lockspace() returns an error if this does not match | ||
127 | * what other nodes are using. | ||
128 | * | ||
129 | * ops: callbacks that indicate lockspace recovery points so the | ||
130 | * caller can coordinate its recovery and know lockspace members. | ||
131 | * This is only used by the initial dlm_new_lockspace() call. | ||
132 | * Optional. | ||
133 | * | ||
134 | * ops_arg: arg for ops callbacks. | ||
135 | * | ||
136 | * ops_result: tells caller if the ops callbacks (if provided) will | ||
137 | * be used or not. 0: will be used, -EXXX will not be used. | ||
138 | * -EOPNOTSUPP: the dlm does not have recovery_callbacks enabled. | ||
139 | * | ||
140 | * lockspace: handle for dlm functions | ||
82 | */ | 141 | */ |
83 | 142 | ||
84 | int dlm_new_lockspace(const char *name, int namelen, | 143 | int dlm_new_lockspace(const char *name, const char *cluster, |
85 | dlm_lockspace_t **lockspace, uint32_t flags, int lvblen); | 144 | uint32_t flags, int lvblen, |
145 | const struct dlm_lockspace_ops *ops, void *ops_arg, | ||
146 | int *ops_result, dlm_lockspace_t **lockspace); | ||
86 | 147 | ||
87 | /* | 148 | /* |
88 | * dlm_release_lockspace | 149 | * dlm_release_lockspace |
diff --git a/include/linux/hid.h b/include/linux/hid.h index c235e4e8767c..3a95da60fd3e 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
@@ -72,6 +72,7 @@ | |||
72 | #include <linux/workqueue.h> | 72 | #include <linux/workqueue.h> |
73 | #include <linux/input.h> | 73 | #include <linux/input.h> |
74 | #include <linux/semaphore.h> | 74 | #include <linux/semaphore.h> |
75 | #include <linux/power_supply.h> | ||
75 | 76 | ||
76 | /* | 77 | /* |
77 | * We parse each description item into this structure. Short items data | 78 | * We parse each description item into this structure. Short items data |
@@ -190,6 +191,7 @@ struct hid_item { | |||
190 | #define HID_UP_UNDEFINED 0x00000000 | 191 | #define HID_UP_UNDEFINED 0x00000000 |
191 | #define HID_UP_GENDESK 0x00010000 | 192 | #define HID_UP_GENDESK 0x00010000 |
192 | #define HID_UP_SIMULATION 0x00020000 | 193 | #define HID_UP_SIMULATION 0x00020000 |
194 | #define HID_UP_GENDEVCTRLS 0x00060000 | ||
193 | #define HID_UP_KEYBOARD 0x00070000 | 195 | #define HID_UP_KEYBOARD 0x00070000 |
194 | #define HID_UP_LED 0x00080000 | 196 | #define HID_UP_LED 0x00080000 |
195 | #define HID_UP_BUTTON 0x00090000 | 197 | #define HID_UP_BUTTON 0x00090000 |
@@ -239,6 +241,8 @@ struct hid_item { | |||
239 | #define HID_GD_RIGHT 0x00010092 | 241 | #define HID_GD_RIGHT 0x00010092 |
240 | #define HID_GD_LEFT 0x00010093 | 242 | #define HID_GD_LEFT 0x00010093 |
241 | 243 | ||
244 | #define HID_DC_BATTERYSTRENGTH 0x00060020 | ||
245 | |||
242 | #define HID_DG_DIGITIZER 0x000d0001 | 246 | #define HID_DG_DIGITIZER 0x000d0001 |
243 | #define HID_DG_PEN 0x000d0002 | 247 | #define HID_DG_PEN 0x000d0002 |
244 | #define HID_DG_LIGHTPEN 0x000d0003 | 248 | #define HID_DG_LIGHTPEN 0x000d0003 |
@@ -482,6 +486,19 @@ struct hid_device { /* device report descriptor */ | |||
482 | struct hid_driver *driver; | 486 | struct hid_driver *driver; |
483 | struct hid_ll_driver *ll_driver; | 487 | struct hid_ll_driver *ll_driver; |
484 | 488 | ||
489 | #ifdef CONFIG_HID_BATTERY_STRENGTH | ||
490 | /* | ||
491 | * Power supply information for HID devices which report | ||
492 | * battery strength. power_supply is registered iff | ||
493 | * battery.name is non-NULL. | ||
494 | */ | ||
495 | struct power_supply battery; | ||
496 | __s32 battery_min; | ||
497 | __s32 battery_max; | ||
498 | __s32 battery_report_type; | ||
499 | __s32 battery_report_id; | ||
500 | #endif | ||
501 | |||
485 | unsigned int status; /* see STAT flags above */ | 502 | unsigned int status; /* see STAT flags above */ |
486 | unsigned claimed; /* Claimed by hidinput, hiddev? */ | 503 | unsigned claimed; /* Claimed by hidinput, hiddev? */ |
487 | unsigned quirks; /* Various quirks the device can pull on us */ | 504 | unsigned quirks; /* Various quirks the device can pull on us */ |
@@ -712,6 +729,8 @@ extern void hidinput_disconnect(struct hid_device *); | |||
712 | int hid_set_field(struct hid_field *, unsigned, __s32); | 729 | int hid_set_field(struct hid_field *, unsigned, __s32); |
713 | int hid_input_report(struct hid_device *, int type, u8 *, int, int); | 730 | int hid_input_report(struct hid_device *, int type, u8 *, int, int); |
714 | int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); | 731 | int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); |
732 | struct hid_field *hidinput_get_led_field(struct hid_device *hid); | ||
733 | unsigned int hidinput_count_leds(struct hid_device *hid); | ||
715 | void hid_output_report(struct hid_report *report, __u8 *data); | 734 | void hid_output_report(struct hid_report *report, __u8 *data); |
716 | struct hid_device *hid_allocate_device(void); | 735 | struct hid_device *hid_allocate_device(void); |
717 | struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); | 736 | struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); |
@@ -719,6 +738,8 @@ int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); | |||
719 | int hid_check_keys_pressed(struct hid_device *hid); | 738 | int hid_check_keys_pressed(struct hid_device *hid); |
720 | int hid_connect(struct hid_device *hid, unsigned int connect_mask); | 739 | int hid_connect(struct hid_device *hid, unsigned int connect_mask); |
721 | void hid_disconnect(struct hid_device *hid); | 740 | void hid_disconnect(struct hid_device *hid); |
741 | const struct hid_device_id *hid_match_id(struct hid_device *hdev, | ||
742 | const struct hid_device_id *id); | ||
722 | 743 | ||
723 | /** | 744 | /** |
724 | * hid_map_usage - map usage input bits | 745 | * hid_map_usage - map usage input bits |
diff --git a/include/linux/input/auo-pixcir-ts.h b/include/linux/input/auo-pixcir-ts.h new file mode 100644 index 000000000000..75d4be717714 --- /dev/null +++ b/include/linux/input/auo-pixcir-ts.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * Driver for AUO in-cell touchscreens | ||
3 | * | ||
4 | * Copyright (c) 2011 Heiko Stuebner <heiko@sntech.de> | ||
5 | * | ||
6 | * based on auo_touch.h from Dell Streak kernel | ||
7 | * | ||
8 | * Copyright (c) 2008 QUALCOMM Incorporated. | ||
9 | * Copyright (c) 2008 QUALCOMM USA, INC. | ||
10 | * | ||
11 | * | ||
12 | * This software is licensed under the terms of the GNU General Public | ||
13 | * License version 2, as published by the Free Software Foundation, and | ||
14 | * may be copied, distributed, and modified under those terms. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #ifndef __AUO_PIXCIR_TS_H__ | ||
24 | #define __AUO_PIXCIR_TS_H__ | ||
25 | |||
26 | /* | ||
27 | * Interrupt modes: | ||
28 | * periodical: interrupt is asserted periodicaly | ||
29 | * compare coordinates: interrupt is asserted when coordinates change | ||
30 | * indicate touch: interrupt is asserted during touch | ||
31 | */ | ||
32 | #define AUO_PIXCIR_INT_PERIODICAL 0x00 | ||
33 | #define AUO_PIXCIR_INT_COMP_COORD 0x01 | ||
34 | #define AUO_PIXCIR_INT_TOUCH_IND 0x02 | ||
35 | |||
36 | /* | ||
37 | * @gpio_int interrupt gpio | ||
38 | * @int_setting one of AUO_PIXCIR_INT_* | ||
39 | * @init_hw hardwarespecific init | ||
40 | * @exit_hw hardwarespecific shutdown | ||
41 | * @x_max x-resolution | ||
42 | * @y_max y-resolution | ||
43 | */ | ||
44 | struct auo_pixcir_ts_platdata { | ||
45 | int gpio_int; | ||
46 | |||
47 | int int_setting; | ||
48 | |||
49 | void (*init_hw)(struct i2c_client *); | ||
50 | void (*exit_hw)(struct i2c_client *); | ||
51 | |||
52 | unsigned int x_max; | ||
53 | unsigned int y_max; | ||
54 | }; | ||
55 | |||
56 | #endif | ||
diff --git a/include/linux/input/gp2ap002a00f.h b/include/linux/input/gp2ap002a00f.h new file mode 100644 index 000000000000..aad2fd44a61a --- /dev/null +++ b/include/linux/input/gp2ap002a00f.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef _GP2AP002A00F_H_ | ||
2 | #define _GP2AP002A00F_H_ | ||
3 | |||
4 | #include <linux/i2c.h> | ||
5 | |||
6 | #define GP2A_I2C_NAME "gp2ap002a00f" | ||
7 | |||
8 | /** | ||
9 | * struct gp2a_platform_data - Sharp gp2ap002a00f proximity platform data | ||
10 | * @vout_gpio: The gpio connected to the object detected pin (VOUT) | ||
11 | * @wakeup: Set to true if the proximity can wake the device from suspend | ||
12 | * @hw_setup: Callback for setting up hardware such as gpios and vregs | ||
13 | * @hw_shutdown: Callback for properly shutting down hardware | ||
14 | */ | ||
15 | struct gp2a_platform_data { | ||
16 | int vout_gpio; | ||
17 | bool wakeup; | ||
18 | int (*hw_setup)(struct i2c_client *client); | ||
19 | int (*hw_shutdown)(struct i2c_client *client); | ||
20 | }; | ||
21 | |||
22 | #endif | ||
diff --git a/include/linux/input/gpio_tilt.h b/include/linux/input/gpio_tilt.h new file mode 100644 index 000000000000..c1cc52d380e0 --- /dev/null +++ b/include/linux/input/gpio_tilt.h | |||
@@ -0,0 +1,73 @@ | |||
1 | #ifndef _INPUT_GPIO_TILT_H | ||
2 | #define _INPUT_GPIO_TILT_H | ||
3 | |||
4 | /** | ||
5 | * struct gpio_tilt_axis - Axis used by the tilt switch | ||
6 | * @axis: Constant describing the axis, e.g. ABS_X | ||
7 | * @min: minimum value for abs_param | ||
8 | * @max: maximum value for abs_param | ||
9 | * @fuzz: fuzz value for abs_param | ||
10 | * @flat: flat value for abs_param | ||
11 | */ | ||
12 | struct gpio_tilt_axis { | ||
13 | int axis; | ||
14 | int min; | ||
15 | int max; | ||
16 | int fuzz; | ||
17 | int flat; | ||
18 | }; | ||
19 | |||
20 | /** | ||
21 | * struct gpio_tilt_state - state description | ||
22 | * @gpios: bitfield of gpio target-states for the value | ||
23 | * @axes: array containing the axes settings for the gpio state | ||
24 | * The array indizes must correspond to the axes defined | ||
25 | * in platform_data | ||
26 | * | ||
27 | * This structure describes a supported axis settings | ||
28 | * and the necessary gpio-state which represent it. | ||
29 | * | ||
30 | * The n-th bit in the bitfield describes the state of the n-th GPIO | ||
31 | * from the gpios-array defined in gpio_regulator_config below. | ||
32 | */ | ||
33 | struct gpio_tilt_state { | ||
34 | int gpios; | ||
35 | int *axes; | ||
36 | }; | ||
37 | |||
38 | /** | ||
39 | * struct gpio_tilt_platform_data | ||
40 | * @gpios: Array containing the gpios determining the tilt state | ||
41 | * @nr_gpios: Number of gpios | ||
42 | * @axes: Array of gpio_tilt_axis descriptions | ||
43 | * @nr_axes: Number of axes | ||
44 | * @states: Array of gpio_tilt_state entries describing | ||
45 | * the gpio state for specific tilts | ||
46 | * @nr_states: Number of states available | ||
47 | * @debounce_interval: debounce ticks interval in msecs | ||
48 | * @poll_interval: polling interval in msecs - for polling driver only | ||
49 | * @enable: callback to enable the tilt switch | ||
50 | * @disable: callback to disable the tilt switch | ||
51 | * | ||
52 | * This structure contains gpio-tilt-switch configuration | ||
53 | * information that must be passed by platform code to the | ||
54 | * gpio-tilt input driver. | ||
55 | */ | ||
56 | struct gpio_tilt_platform_data { | ||
57 | struct gpio *gpios; | ||
58 | int nr_gpios; | ||
59 | |||
60 | struct gpio_tilt_axis *axes; | ||
61 | int nr_axes; | ||
62 | |||
63 | struct gpio_tilt_state *states; | ||
64 | int nr_states; | ||
65 | |||
66 | int debounce_interval; | ||
67 | |||
68 | unsigned int poll_interval; | ||
69 | int (*enable)(struct device *dev); | ||
70 | void (*disable)(struct device *dev); | ||
71 | }; | ||
72 | |||
73 | #endif | ||
diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h new file mode 100644 index 000000000000..7163d91c0373 --- /dev/null +++ b/include/linux/input/pixcir_ts.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef _PIXCIR_I2C_TS_H | ||
2 | #define _PIXCIR_I2C_TS_H | ||
3 | |||
4 | struct pixcir_ts_platform_data { | ||
5 | int (*attb_read_val)(void); | ||
6 | int x_max; | ||
7 | int y_max; | ||
8 | }; | ||
9 | |||
10 | #endif | ||
diff --git a/include/linux/input/samsung-keypad.h b/include/linux/input/samsung-keypad.h new file mode 100644 index 000000000000..f25619bfd8a8 --- /dev/null +++ b/include/linux/input/samsung-keypad.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * Samsung Keypad platform data definitions | ||
3 | * | ||
4 | * Copyright (C) 2010 Samsung Electronics Co.Ltd | ||
5 | * Author: Joonyoung Shim <jy0922.shim@samsung.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef __SAMSUNG_KEYPAD_H | ||
14 | #define __SAMSUNG_KEYPAD_H | ||
15 | |||
16 | #include <linux/input/matrix_keypad.h> | ||
17 | |||
18 | #define SAMSUNG_MAX_ROWS 8 | ||
19 | #define SAMSUNG_MAX_COLS 8 | ||
20 | |||
21 | /** | ||
22 | * struct samsung_keypad_platdata - Platform device data for Samsung Keypad. | ||
23 | * @keymap_data: pointer to &matrix_keymap_data. | ||
24 | * @rows: number of keypad row supported. | ||
25 | * @cols: number of keypad col supported. | ||
26 | * @no_autorepeat: disable key autorepeat. | ||
27 | * @wakeup: controls whether the device should be set up as wakeup source. | ||
28 | * @cfg_gpio: configure the GPIO. | ||
29 | * | ||
30 | * Initialisation data specific to either the machine or the platform | ||
31 | * for the device driver to use or call-back when configuring gpio. | ||
32 | */ | ||
33 | struct samsung_keypad_platdata { | ||
34 | const struct matrix_keymap_data *keymap_data; | ||
35 | unsigned int rows; | ||
36 | unsigned int cols; | ||
37 | bool no_autorepeat; | ||
38 | bool wakeup; | ||
39 | |||
40 | void (*cfg_gpio)(unsigned int rows, unsigned int cols); | ||
41 | }; | ||
42 | |||
43 | #endif /* __SAMSUNG_KEYPAD_H */ | ||
diff --git a/include/linux/input/tca8418_keypad.h b/include/linux/input/tca8418_keypad.h new file mode 100644 index 000000000000..e71a85dc2cbd --- /dev/null +++ b/include/linux/input/tca8418_keypad.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * TCA8418 keypad platform support | ||
3 | * | ||
4 | * Copyright (C) 2011 Fuel7, Inc. All rights reserved. | ||
5 | * | ||
6 | * Author: Kyle Manna <kyle.manna@fuel7.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public | ||
10 | * License v2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public | ||
18 | * License along with this program; if not, write to the | ||
19 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
20 | * Boston, MA 021110-1307, USA. | ||
21 | * | ||
22 | * If you can't comply with GPLv2, alternative licensing terms may be | ||
23 | * arranged. Please contact Fuel7, Inc. (http://fuel7.com/) for proprietary | ||
24 | * alternative licensing inquiries. | ||
25 | */ | ||
26 | |||
27 | #ifndef _TCA8418_KEYPAD_H | ||
28 | #define _TCA8418_KEYPAD_H | ||
29 | |||
30 | #include <linux/types.h> | ||
31 | #include <linux/input/matrix_keypad.h> | ||
32 | |||
33 | #define TCA8418_I2C_ADDR 0x34 | ||
34 | #define TCA8418_NAME "tca8418_keypad" | ||
35 | |||
36 | struct tca8418_keypad_platform_data { | ||
37 | const struct matrix_keymap_data *keymap_data; | ||
38 | unsigned rows; | ||
39 | unsigned cols; | ||
40 | bool rep; | ||
41 | bool irq_is_gpio; | ||
42 | }; | ||
43 | |||
44 | #endif | ||
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 432acc4c054d..d937580417ba 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h | |||
@@ -48,19 +48,34 @@ struct iommu_domain { | |||
48 | 48 | ||
49 | #ifdef CONFIG_IOMMU_API | 49 | #ifdef CONFIG_IOMMU_API |
50 | 50 | ||
51 | /** | ||
52 | * struct iommu_ops - iommu ops and capabilities | ||
53 | * @domain_init: init iommu domain | ||
54 | * @domain_destroy: destroy iommu domain | ||
55 | * @attach_dev: attach device to an iommu domain | ||
56 | * @detach_dev: detach device from an iommu domain | ||
57 | * @map: map a physically contiguous memory region to an iommu domain | ||
58 | * @unmap: unmap a physically contiguous memory region from an iommu domain | ||
59 | * @iova_to_phys: translate iova to physical address | ||
60 | * @domain_has_cap: domain capabilities query | ||
61 | * @commit: commit iommu domain | ||
62 | * @pgsize_bitmap: bitmap of supported page sizes | ||
63 | */ | ||
51 | struct iommu_ops { | 64 | struct iommu_ops { |
52 | int (*domain_init)(struct iommu_domain *domain); | 65 | int (*domain_init)(struct iommu_domain *domain); |
53 | void (*domain_destroy)(struct iommu_domain *domain); | 66 | void (*domain_destroy)(struct iommu_domain *domain); |
54 | int (*attach_dev)(struct iommu_domain *domain, struct device *dev); | 67 | int (*attach_dev)(struct iommu_domain *domain, struct device *dev); |
55 | void (*detach_dev)(struct iommu_domain *domain, struct device *dev); | 68 | void (*detach_dev)(struct iommu_domain *domain, struct device *dev); |
56 | int (*map)(struct iommu_domain *domain, unsigned long iova, | 69 | int (*map)(struct iommu_domain *domain, unsigned long iova, |
57 | phys_addr_t paddr, int gfp_order, int prot); | 70 | phys_addr_t paddr, size_t size, int prot); |
58 | int (*unmap)(struct iommu_domain *domain, unsigned long iova, | 71 | size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, |
59 | int gfp_order); | 72 | size_t size); |
60 | phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, | 73 | phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, |
61 | unsigned long iova); | 74 | unsigned long iova); |
62 | int (*domain_has_cap)(struct iommu_domain *domain, | 75 | int (*domain_has_cap)(struct iommu_domain *domain, |
63 | unsigned long cap); | 76 | unsigned long cap); |
77 | int (*device_group)(struct device *dev, unsigned int *groupid); | ||
78 | unsigned long pgsize_bitmap; | ||
64 | }; | 79 | }; |
65 | 80 | ||
66 | extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops); | 81 | extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops); |
@@ -72,15 +87,16 @@ extern int iommu_attach_device(struct iommu_domain *domain, | |||
72 | extern void iommu_detach_device(struct iommu_domain *domain, | 87 | extern void iommu_detach_device(struct iommu_domain *domain, |
73 | struct device *dev); | 88 | struct device *dev); |
74 | extern int iommu_map(struct iommu_domain *domain, unsigned long iova, | 89 | extern int iommu_map(struct iommu_domain *domain, unsigned long iova, |
75 | phys_addr_t paddr, int gfp_order, int prot); | 90 | phys_addr_t paddr, size_t size, int prot); |
76 | extern int iommu_unmap(struct iommu_domain *domain, unsigned long iova, | 91 | extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, |
77 | int gfp_order); | 92 | size_t size); |
78 | extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, | 93 | extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, |
79 | unsigned long iova); | 94 | unsigned long iova); |
80 | extern int iommu_domain_has_cap(struct iommu_domain *domain, | 95 | extern int iommu_domain_has_cap(struct iommu_domain *domain, |
81 | unsigned long cap); | 96 | unsigned long cap); |
82 | extern void iommu_set_fault_handler(struct iommu_domain *domain, | 97 | extern void iommu_set_fault_handler(struct iommu_domain *domain, |
83 | iommu_fault_handler_t handler); | 98 | iommu_fault_handler_t handler); |
99 | extern int iommu_device_group(struct device *dev, unsigned int *groupid); | ||
84 | 100 | ||
85 | /** | 101 | /** |
86 | * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework | 102 | * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework |
@@ -179,6 +195,11 @@ static inline void iommu_set_fault_handler(struct iommu_domain *domain, | |||
179 | { | 195 | { |
180 | } | 196 | } |
181 | 197 | ||
198 | static inline int iommu_device_group(struct device *dev, unsigned int *groupid) | ||
199 | { | ||
200 | return -ENODEV; | ||
201 | } | ||
202 | |||
182 | #endif /* CONFIG_IOMMU_API */ | 203 | #endif /* CONFIG_IOMMU_API */ |
183 | 204 | ||
184 | #endif /* __LINUX_IOMMU_H */ | 205 | #endif /* __LINUX_IOMMU_H */ |
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 2092ea21e469..5557baefed60 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -1151,6 +1151,7 @@ extern int jbd2_journal_set_revoke(journal_t *, unsigned long long, tid_t); | |||
1151 | extern int jbd2_journal_test_revoke(journal_t *, unsigned long long, tid_t); | 1151 | extern int jbd2_journal_test_revoke(journal_t *, unsigned long long, tid_t); |
1152 | extern void jbd2_journal_clear_revoke(journal_t *); | 1152 | extern void jbd2_journal_clear_revoke(journal_t *); |
1153 | extern void jbd2_journal_switch_revoke_table(journal_t *journal); | 1153 | extern void jbd2_journal_switch_revoke_table(journal_t *journal); |
1154 | extern void jbd2_clear_buffer_revoked_flags(journal_t *journal); | ||
1154 | 1155 | ||
1155 | /* | 1156 | /* |
1156 | * The log thread user interface: | 1157 | * The log thread user interface: |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index d52623199978..900c76337e8f 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/signal.h> | 14 | #include <linux/signal.h> |
15 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
17 | #include <linux/mmu_notifier.h> | ||
17 | #include <linux/preempt.h> | 18 | #include <linux/preempt.h> |
18 | #include <linux/msi.h> | 19 | #include <linux/msi.h> |
19 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
@@ -50,6 +51,9 @@ | |||
50 | #define KVM_REQ_APF_HALT 12 | 51 | #define KVM_REQ_APF_HALT 12 |
51 | #define KVM_REQ_STEAL_UPDATE 13 | 52 | #define KVM_REQ_STEAL_UPDATE 13 |
52 | #define KVM_REQ_NMI 14 | 53 | #define KVM_REQ_NMI 14 |
54 | #define KVM_REQ_IMMEDIATE_EXIT 15 | ||
55 | #define KVM_REQ_PMU 16 | ||
56 | #define KVM_REQ_PMI 17 | ||
53 | 57 | ||
54 | #define KVM_USERSPACE_IRQ_SOURCE_ID 0 | 58 | #define KVM_USERSPACE_IRQ_SOURCE_ID 0 |
55 | 59 | ||
@@ -179,6 +183,7 @@ struct kvm_memory_slot { | |||
179 | unsigned long *rmap; | 183 | unsigned long *rmap; |
180 | unsigned long *dirty_bitmap; | 184 | unsigned long *dirty_bitmap; |
181 | unsigned long *dirty_bitmap_head; | 185 | unsigned long *dirty_bitmap_head; |
186 | unsigned long nr_dirty_pages; | ||
182 | struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1]; | 187 | struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1]; |
183 | unsigned long userspace_addr; | 188 | unsigned long userspace_addr; |
184 | int user_alloc; | 189 | int user_alloc; |
@@ -224,11 +229,20 @@ struct kvm_irq_routing_table {}; | |||
224 | 229 | ||
225 | #endif | 230 | #endif |
226 | 231 | ||
232 | #ifndef KVM_MEM_SLOTS_NUM | ||
233 | #define KVM_MEM_SLOTS_NUM (KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS) | ||
234 | #endif | ||
235 | |||
236 | /* | ||
237 | * Note: | ||
238 | * memslots are not sorted by id anymore, please use id_to_memslot() | ||
239 | * to get the memslot by its id. | ||
240 | */ | ||
227 | struct kvm_memslots { | 241 | struct kvm_memslots { |
228 | int nmemslots; | ||
229 | u64 generation; | 242 | u64 generation; |
230 | struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS + | 243 | struct kvm_memory_slot memslots[KVM_MEM_SLOTS_NUM]; |
231 | KVM_PRIVATE_MEM_SLOTS]; | 244 | /* The mapping table from slot id to the index in memslots[]. */ |
245 | int id_to_index[KVM_MEM_SLOTS_NUM]; | ||
232 | }; | 246 | }; |
233 | 247 | ||
234 | struct kvm { | 248 | struct kvm { |
@@ -239,7 +253,6 @@ struct kvm { | |||
239 | struct srcu_struct srcu; | 253 | struct srcu_struct srcu; |
240 | #ifdef CONFIG_KVM_APIC_ARCHITECTURE | 254 | #ifdef CONFIG_KVM_APIC_ARCHITECTURE |
241 | u32 bsp_vcpu_id; | 255 | u32 bsp_vcpu_id; |
242 | struct kvm_vcpu *bsp_vcpu; | ||
243 | #endif | 256 | #endif |
244 | struct kvm_vcpu *vcpus[KVM_MAX_VCPUS]; | 257 | struct kvm_vcpu *vcpus[KVM_MAX_VCPUS]; |
245 | atomic_t online_vcpus; | 258 | atomic_t online_vcpus; |
@@ -302,6 +315,11 @@ static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i) | |||
302 | (vcpup = kvm_get_vcpu(kvm, idx)) != NULL; \ | 315 | (vcpup = kvm_get_vcpu(kvm, idx)) != NULL; \ |
303 | idx++) | 316 | idx++) |
304 | 317 | ||
318 | #define kvm_for_each_memslot(memslot, slots) \ | ||
319 | for (memslot = &slots->memslots[0]; \ | ||
320 | memslot < slots->memslots + KVM_MEM_SLOTS_NUM && memslot->npages;\ | ||
321 | memslot++) | ||
322 | |||
305 | int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id); | 323 | int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id); |
306 | void kvm_vcpu_uninit(struct kvm_vcpu *vcpu); | 324 | void kvm_vcpu_uninit(struct kvm_vcpu *vcpu); |
307 | 325 | ||
@@ -314,6 +332,7 @@ void kvm_exit(void); | |||
314 | 332 | ||
315 | void kvm_get_kvm(struct kvm *kvm); | 333 | void kvm_get_kvm(struct kvm *kvm); |
316 | void kvm_put_kvm(struct kvm *kvm); | 334 | void kvm_put_kvm(struct kvm *kvm); |
335 | void update_memslots(struct kvm_memslots *slots, struct kvm_memory_slot *new); | ||
317 | 336 | ||
318 | static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm) | 337 | static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm) |
319 | { | 338 | { |
@@ -322,6 +341,18 @@ static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm) | |||
322 | || lockdep_is_held(&kvm->slots_lock)); | 341 | || lockdep_is_held(&kvm->slots_lock)); |
323 | } | 342 | } |
324 | 343 | ||
344 | static inline struct kvm_memory_slot * | ||
345 | id_to_memslot(struct kvm_memslots *slots, int id) | ||
346 | { | ||
347 | int index = slots->id_to_index[id]; | ||
348 | struct kvm_memory_slot *slot; | ||
349 | |||
350 | slot = &slots->memslots[index]; | ||
351 | |||
352 | WARN_ON(slot->id != id); | ||
353 | return slot; | ||
354 | } | ||
355 | |||
325 | #define HPA_MSB ((sizeof(hpa_t) * 8) - 1) | 356 | #define HPA_MSB ((sizeof(hpa_t) * 8) - 1) |
326 | #define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB) | 357 | #define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB) |
327 | static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; } | 358 | static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; } |
diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h index 47a070b0520e..ff476ddaf310 100644 --- a/include/linux/kvm_para.h +++ b/include/linux/kvm_para.h | |||
@@ -35,4 +35,3 @@ static inline int kvm_para_has_feature(unsigned int feature) | |||
35 | } | 35 | } |
36 | #endif /* __KERNEL__ */ | 36 | #endif /* __KERNEL__ */ |
37 | #endif /* __LINUX_KVM_PARA_H */ | 37 | #endif /* __LINUX_KVM_PARA_H */ |
38 | |||
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h index 3816c2fac0ad..a98e2a316d1f 100644 --- a/include/linux/mfd/mc13xxx.h +++ b/include/linux/mfd/mc13xxx.h | |||
@@ -69,6 +69,7 @@ struct regulator_init_data; | |||
69 | struct mc13xxx_regulator_init_data { | 69 | struct mc13xxx_regulator_init_data { |
70 | int id; | 70 | int id; |
71 | struct regulator_init_data *init_data; | 71 | struct regulator_init_data *init_data; |
72 | struct device_node *node; | ||
72 | }; | 73 | }; |
73 | 74 | ||
74 | struct mc13xxx_regulator_platform_data { | 75 | struct mc13xxx_regulator_platform_data { |
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h index 8bf2cb9502dd..d0cb12eba402 100644 --- a/include/linux/mfd/tps65910.h +++ b/include/linux/mfd/tps65910.h | |||
@@ -740,6 +740,34 @@ | |||
740 | #define TPS65910_GPIO_STS BIT(1) | 740 | #define TPS65910_GPIO_STS BIT(1) |
741 | #define TPS65910_GPIO_SET BIT(0) | 741 | #define TPS65910_GPIO_SET BIT(0) |
742 | 742 | ||
743 | /* Regulator Index Definitions */ | ||
744 | #define TPS65910_REG_VRTC 0 | ||
745 | #define TPS65910_REG_VIO 1 | ||
746 | #define TPS65910_REG_VDD1 2 | ||
747 | #define TPS65910_REG_VDD2 3 | ||
748 | #define TPS65910_REG_VDD3 4 | ||
749 | #define TPS65910_REG_VDIG1 5 | ||
750 | #define TPS65910_REG_VDIG2 6 | ||
751 | #define TPS65910_REG_VPLL 7 | ||
752 | #define TPS65910_REG_VDAC 8 | ||
753 | #define TPS65910_REG_VAUX1 9 | ||
754 | #define TPS65910_REG_VAUX2 10 | ||
755 | #define TPS65910_REG_VAUX33 11 | ||
756 | #define TPS65910_REG_VMMC 12 | ||
757 | |||
758 | #define TPS65911_REG_VDDCTRL 4 | ||
759 | #define TPS65911_REG_LDO1 5 | ||
760 | #define TPS65911_REG_LDO2 6 | ||
761 | #define TPS65911_REG_LDO3 7 | ||
762 | #define TPS65911_REG_LDO4 8 | ||
763 | #define TPS65911_REG_LDO5 9 | ||
764 | #define TPS65911_REG_LDO6 10 | ||
765 | #define TPS65911_REG_LDO7 11 | ||
766 | #define TPS65911_REG_LDO8 12 | ||
767 | |||
768 | /* Max number of TPS65910/11 regulators */ | ||
769 | #define TPS65910_NUM_REGS 13 | ||
770 | |||
743 | /** | 771 | /** |
744 | * struct tps65910_board | 772 | * struct tps65910_board |
745 | * Board platform data may be used to initialize regulators. | 773 | * Board platform data may be used to initialize regulators. |
@@ -751,7 +779,7 @@ struct tps65910_board { | |||
751 | int irq_base; | 779 | int irq_base; |
752 | int vmbch_threshold; | 780 | int vmbch_threshold; |
753 | int vmbch2_threshold; | 781 | int vmbch2_threshold; |
754 | struct regulator_init_data *tps65910_pmic_init_data; | 782 | struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS]; |
755 | }; | 783 | }; |
756 | 784 | ||
757 | /** | 785 | /** |
diff --git a/include/linux/msi.h b/include/linux/msi.h index 05acced439a3..ce93a341337d 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef LINUX_MSI_H | 1 | #ifndef LINUX_MSI_H |
2 | #define LINUX_MSI_H | 2 | #define LINUX_MSI_H |
3 | 3 | ||
4 | #include <linux/kobject.h> | ||
4 | #include <linux/list.h> | 5 | #include <linux/list.h> |
5 | 6 | ||
6 | struct msi_msg { | 7 | struct msi_msg { |
@@ -44,6 +45,8 @@ struct msi_desc { | |||
44 | 45 | ||
45 | /* Last set MSI message */ | 46 | /* Last set MSI message */ |
46 | struct msi_msg msg; | 47 | struct msi_msg msg; |
48 | |||
49 | struct kobject kobj; | ||
47 | }; | 50 | }; |
48 | 51 | ||
49 | /* | 52 | /* |
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index d24925492972..d5d2ec6494bb 100644 --- a/include/linux/mtd/cfi.h +++ b/include/linux/mtd/cfi.h | |||
@@ -354,10 +354,10 @@ static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cf | |||
354 | onecmd = cmd; | 354 | onecmd = cmd; |
355 | break; | 355 | break; |
356 | case 2: | 356 | case 2: |
357 | onecmd = cpu_to_cfi16(cmd); | 357 | onecmd = cpu_to_cfi16(map, cmd); |
358 | break; | 358 | break; |
359 | case 4: | 359 | case 4: |
360 | onecmd = cpu_to_cfi32(cmd); | 360 | onecmd = cpu_to_cfi32(map, cmd); |
361 | break; | 361 | break; |
362 | } | 362 | } |
363 | 363 | ||
@@ -437,10 +437,10 @@ static inline unsigned long cfi_merge_status(map_word val, struct map_info *map, | |||
437 | case 1: | 437 | case 1: |
438 | break; | 438 | break; |
439 | case 2: | 439 | case 2: |
440 | res = cfi16_to_cpu(res); | 440 | res = cfi16_to_cpu(map, res); |
441 | break; | 441 | break; |
442 | case 4: | 442 | case 4: |
443 | res = cfi32_to_cpu(res); | 443 | res = cfi32_to_cpu(map, res); |
444 | break; | 444 | break; |
445 | default: BUG(); | 445 | default: BUG(); |
446 | } | 446 | } |
@@ -480,12 +480,12 @@ static inline uint8_t cfi_read_query(struct map_info *map, uint32_t addr) | |||
480 | if (map_bankwidth_is_1(map)) { | 480 | if (map_bankwidth_is_1(map)) { |
481 | return val.x[0]; | 481 | return val.x[0]; |
482 | } else if (map_bankwidth_is_2(map)) { | 482 | } else if (map_bankwidth_is_2(map)) { |
483 | return cfi16_to_cpu(val.x[0]); | 483 | return cfi16_to_cpu(map, val.x[0]); |
484 | } else { | 484 | } else { |
485 | /* No point in a 64-bit byteswap since that would just be | 485 | /* No point in a 64-bit byteswap since that would just be |
486 | swapping the responses from different chips, and we are | 486 | swapping the responses from different chips, and we are |
487 | only interested in one chip (a representative sample) */ | 487 | only interested in one chip (a representative sample) */ |
488 | return cfi32_to_cpu(val.x[0]); | 488 | return cfi32_to_cpu(map, val.x[0]); |
489 | } | 489 | } |
490 | } | 490 | } |
491 | 491 | ||
@@ -496,12 +496,12 @@ static inline uint16_t cfi_read_query16(struct map_info *map, uint32_t addr) | |||
496 | if (map_bankwidth_is_1(map)) { | 496 | if (map_bankwidth_is_1(map)) { |
497 | return val.x[0] & 0xff; | 497 | return val.x[0] & 0xff; |
498 | } else if (map_bankwidth_is_2(map)) { | 498 | } else if (map_bankwidth_is_2(map)) { |
499 | return cfi16_to_cpu(val.x[0]); | 499 | return cfi16_to_cpu(map, val.x[0]); |
500 | } else { | 500 | } else { |
501 | /* No point in a 64-bit byteswap since that would just be | 501 | /* No point in a 64-bit byteswap since that would just be |
502 | swapping the responses from different chips, and we are | 502 | swapping the responses from different chips, and we are |
503 | only interested in one chip (a representative sample) */ | 503 | only interested in one chip (a representative sample) */ |
504 | return cfi32_to_cpu(val.x[0]); | 504 | return cfi32_to_cpu(map, val.x[0]); |
505 | } | 505 | } |
506 | } | 506 | } |
507 | 507 | ||
diff --git a/include/linux/mtd/cfi_endian.h b/include/linux/mtd/cfi_endian.h index 51cc3f5917a8..b97a625071f8 100644 --- a/include/linux/mtd/cfi_endian.h +++ b/include/linux/mtd/cfi_endian.h | |||
@@ -19,53 +19,35 @@ | |||
19 | 19 | ||
20 | #include <asm/byteorder.h> | 20 | #include <asm/byteorder.h> |
21 | 21 | ||
22 | #ifndef CONFIG_MTD_CFI_ADV_OPTIONS | 22 | #define CFI_HOST_ENDIAN 1 |
23 | 23 | #define CFI_LITTLE_ENDIAN 2 | |
24 | #define CFI_HOST_ENDIAN | 24 | #define CFI_BIG_ENDIAN 3 |
25 | 25 | ||
26 | #else | 26 | #if !defined(CONFIG_MTD_CFI_ADV_OPTIONS) || defined(CONFIG_MTD_CFI_NOSWAP) |
27 | 27 | #define CFI_DEFAULT_ENDIAN CFI_HOST_ENDIAN | |
28 | #ifdef CONFIG_MTD_CFI_NOSWAP | 28 | #elif defined(CONFIG_MTD_CFI_LE_BYTE_SWAP) |
29 | #define CFI_HOST_ENDIAN | 29 | #define CFI_DEFAULT_ENDIAN CFI_LITTLE_ENDIAN |
30 | #endif | 30 | #elif defined(CONFIG_MTD_CFI_BE_BYTE_SWAP) |
31 | 31 | #define CFI_DEFAULT_ENDIAN CFI_BIG_ENDIAN | |
32 | #ifdef CONFIG_MTD_CFI_LE_BYTE_SWAP | ||
33 | #define CFI_LITTLE_ENDIAN | ||
34 | #endif | ||
35 | |||
36 | #ifdef CONFIG_MTD_CFI_BE_BYTE_SWAP | ||
37 | #define CFI_BIG_ENDIAN | ||
38 | #endif | ||
39 | |||
40 | #endif | ||
41 | |||
42 | #if defined(CFI_LITTLE_ENDIAN) | ||
43 | #define cpu_to_cfi8(x) (x) | ||
44 | #define cfi8_to_cpu(x) (x) | ||
45 | #define cpu_to_cfi16(x) cpu_to_le16(x) | ||
46 | #define cpu_to_cfi32(x) cpu_to_le32(x) | ||
47 | #define cpu_to_cfi64(x) cpu_to_le64(x) | ||
48 | #define cfi16_to_cpu(x) le16_to_cpu(x) | ||
49 | #define cfi32_to_cpu(x) le32_to_cpu(x) | ||
50 | #define cfi64_to_cpu(x) le64_to_cpu(x) | ||
51 | #elif defined (CFI_BIG_ENDIAN) | ||
52 | #define cpu_to_cfi8(x) (x) | ||
53 | #define cfi8_to_cpu(x) (x) | ||
54 | #define cpu_to_cfi16(x) cpu_to_be16(x) | ||
55 | #define cpu_to_cfi32(x) cpu_to_be32(x) | ||
56 | #define cpu_to_cfi64(x) cpu_to_be64(x) | ||
57 | #define cfi16_to_cpu(x) be16_to_cpu(x) | ||
58 | #define cfi32_to_cpu(x) be32_to_cpu(x) | ||
59 | #define cfi64_to_cpu(x) be64_to_cpu(x) | ||
60 | #elif defined (CFI_HOST_ENDIAN) | ||
61 | #define cpu_to_cfi8(x) (x) | ||
62 | #define cfi8_to_cpu(x) (x) | ||
63 | #define cpu_to_cfi16(x) (x) | ||
64 | #define cpu_to_cfi32(x) (x) | ||
65 | #define cpu_to_cfi64(x) (x) | ||
66 | #define cfi16_to_cpu(x) (x) | ||
67 | #define cfi32_to_cpu(x) (x) | ||
68 | #define cfi64_to_cpu(x) (x) | ||
69 | #else | 32 | #else |
70 | #error No CFI endianness defined | 33 | #error No CFI endianness defined |
71 | #endif | 34 | #endif |
35 | |||
36 | #define cfi_default(s) ((s)?:CFI_DEFAULT_ENDIAN) | ||
37 | #define cfi_be(s) (cfi_default(s) == CFI_BIG_ENDIAN) | ||
38 | #define cfi_le(s) (cfi_default(s) == CFI_LITTLE_ENDIAN) | ||
39 | #define cfi_host(s) (cfi_default(s) == CFI_HOST_ENDIAN) | ||
40 | |||
41 | #define cpu_to_cfi8(map, x) (x) | ||
42 | #define cfi8_to_cpu(map, x) (x) | ||
43 | #define cpu_to_cfi16(map, x) _cpu_to_cfi(16, (map)->swap, (x)) | ||
44 | #define cpu_to_cfi32(map, x) _cpu_to_cfi(32, (map)->swap, (x)) | ||
45 | #define cpu_to_cfi64(map, x) _cpu_to_cfi(64, (map)->swap, (x)) | ||
46 | #define cfi16_to_cpu(map, x) _cfi_to_cpu(16, (map)->swap, (x)) | ||
47 | #define cfi32_to_cpu(map, x) _cfi_to_cpu(32, (map)->swap, (x)) | ||
48 | #define cfi64_to_cpu(map, x) _cfi_to_cpu(64, (map)->swap, (x)) | ||
49 | |||
50 | #define _cpu_to_cfi(w, s, x) (cfi_host(s)?(x):_swap_to_cfi(w, s, x)) | ||
51 | #define _cfi_to_cpu(w, s, x) (cfi_host(s)?(x):_swap_to_cpu(w, s, x)) | ||
52 | #define _swap_to_cfi(w, s, x) (cfi_be(s)?cpu_to_be##w(x):cpu_to_le##w(x)) | ||
53 | #define _swap_to_cpu(w, s, x) (cfi_be(s)?be##w##_to_cpu(x):le##w##_to_cpu(x)) | ||
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h index a9e6ba46865e..94e924e2ecd5 100644 --- a/include/linux/mtd/map.h +++ b/include/linux/mtd/map.h | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/list.h> | 26 | #include <linux/list.h> |
27 | #include <linux/string.h> | 27 | #include <linux/string.h> |
28 | #include <linux/bug.h> | 28 | #include <linux/bug.h> |
29 | 29 | #include <linux/kernel.h> | |
30 | 30 | ||
31 | #include <asm/unaligned.h> | 31 | #include <asm/unaligned.h> |
32 | #include <asm/system.h> | 32 | #include <asm/system.h> |
@@ -214,6 +214,7 @@ struct map_info { | |||
214 | void __iomem *virt; | 214 | void __iomem *virt; |
215 | void *cached; | 215 | void *cached; |
216 | 216 | ||
217 | int swap; /* this mapping's byte-swapping requirement */ | ||
217 | int bankwidth; /* in octets. This isn't necessarily the width | 218 | int bankwidth; /* in octets. This isn't necessarily the width |
218 | of actual bus cycles -- it's the repeat interval | 219 | of actual bus cycles -- it's the repeat interval |
219 | in bytes, before you are talking to the first chip again. | 220 | in bytes, before you are talking to the first chip again. |
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 9f5b312af783..1a81fde8f333 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -171,87 +171,60 @@ struct mtd_info { | |||
171 | struct mtd_erase_region_info *eraseregions; | 171 | struct mtd_erase_region_info *eraseregions; |
172 | 172 | ||
173 | /* | 173 | /* |
174 | * Erase is an asynchronous operation. Device drivers are supposed | 174 | * Do not call via these pointers, use corresponding mtd_*() |
175 | * to call instr->callback() whenever the operation completes, even | 175 | * wrappers instead. |
176 | * if it completes with a failure. | ||
177 | * Callers are supposed to pass a callback function and wait for it | ||
178 | * to be called before writing to the block. | ||
179 | */ | 176 | */ |
180 | int (*erase) (struct mtd_info *mtd, struct erase_info *instr); | 177 | int (*erase) (struct mtd_info *mtd, struct erase_info *instr); |
181 | |||
182 | /* This stuff for eXecute-In-Place */ | ||
183 | /* phys is optional and may be set to NULL */ | ||
184 | int (*point) (struct mtd_info *mtd, loff_t from, size_t len, | 178 | int (*point) (struct mtd_info *mtd, loff_t from, size_t len, |
185 | size_t *retlen, void **virt, resource_size_t *phys); | 179 | size_t *retlen, void **virt, resource_size_t *phys); |
186 | |||
187 | /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ | ||
188 | void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); | 180 | void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); |
189 | |||
190 | /* Allow NOMMU mmap() to directly map the device (if not NULL) | ||
191 | * - return the address to which the offset maps | ||
192 | * - return -ENOSYS to indicate refusal to do the mapping | ||
193 | */ | ||
194 | unsigned long (*get_unmapped_area) (struct mtd_info *mtd, | 181 | unsigned long (*get_unmapped_area) (struct mtd_info *mtd, |
195 | unsigned long len, | 182 | unsigned long len, |
196 | unsigned long offset, | 183 | unsigned long offset, |
197 | unsigned long flags); | 184 | unsigned long flags); |
198 | 185 | int (*read) (struct mtd_info *mtd, loff_t from, size_t len, | |
199 | /* Backing device capabilities for this device | 186 | size_t *retlen, u_char *buf); |
200 | * - provides mmap capabilities | 187 | int (*write) (struct mtd_info *mtd, loff_t to, size_t len, |
201 | */ | 188 | size_t *retlen, const u_char *buf); |
202 | struct backing_dev_info *backing_dev_info; | 189 | int (*panic_write) (struct mtd_info *mtd, loff_t to, size_t len, |
203 | 190 | size_t *retlen, const u_char *buf); | |
204 | |||
205 | int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | ||
206 | int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); | ||
207 | |||
208 | /* In blackbox flight recorder like scenarios we want to make successful | ||
209 | writes in interrupt context. panic_write() is only intended to be | ||
210 | called when its known the kernel is about to panic and we need the | ||
211 | write to succeed. Since the kernel is not going to be running for much | ||
212 | longer, this function can break locks and delay to ensure the write | ||
213 | succeeds (but not sleep). */ | ||
214 | |||
215 | int (*panic_write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); | ||
216 | |||
217 | int (*read_oob) (struct mtd_info *mtd, loff_t from, | 191 | int (*read_oob) (struct mtd_info *mtd, loff_t from, |
218 | struct mtd_oob_ops *ops); | 192 | struct mtd_oob_ops *ops); |
219 | int (*write_oob) (struct mtd_info *mtd, loff_t to, | 193 | int (*write_oob) (struct mtd_info *mtd, loff_t to, |
220 | struct mtd_oob_ops *ops); | 194 | struct mtd_oob_ops *ops); |
221 | 195 | int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, | |
222 | /* | 196 | size_t len); |
223 | * Methods to access the protection register area, present in some | 197 | int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, |
224 | * flash devices. The user data is one time programmable but the | 198 | size_t len, size_t *retlen, u_char *buf); |
225 | * factory data is read only. | 199 | int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, |
226 | */ | 200 | size_t len); |
227 | int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); | 201 | int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, |
228 | int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | 202 | size_t len, size_t *retlen, u_char *buf); |
229 | int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); | 203 | int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t to, size_t len, |
230 | int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | 204 | size_t *retlen, u_char *buf); |
231 | int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | 205 | int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, |
232 | int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len); | 206 | size_t len); |
233 | 207 | int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, | |
234 | /* kvec-based read/write methods. | 208 | unsigned long count, loff_t to, size_t *retlen); |
235 | NB: The 'count' parameter is the number of _vectors_, each of | ||
236 | which contains an (ofs, len) tuple. | ||
237 | */ | ||
238 | int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen); | ||
239 | |||
240 | /* Sync */ | ||
241 | void (*sync) (struct mtd_info *mtd); | 209 | void (*sync) (struct mtd_info *mtd); |
242 | |||
243 | /* Chip-supported device locking */ | ||
244 | int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); | 210 | int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); |
245 | int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); | 211 | int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); |
246 | int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len); | 212 | int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len); |
247 | 213 | int (*block_isbad) (struct mtd_info *mtd, loff_t ofs); | |
248 | /* Power Management functions */ | 214 | int (*block_markbad) (struct mtd_info *mtd, loff_t ofs); |
249 | int (*suspend) (struct mtd_info *mtd); | 215 | int (*suspend) (struct mtd_info *mtd); |
250 | void (*resume) (struct mtd_info *mtd); | 216 | void (*resume) (struct mtd_info *mtd); |
217 | /* | ||
218 | * If the driver is something smart, like UBI, it may need to maintain | ||
219 | * its own reference counting. The below functions are only for driver. | ||
220 | */ | ||
221 | int (*get_device) (struct mtd_info *mtd); | ||
222 | void (*put_device) (struct mtd_info *mtd); | ||
251 | 223 | ||
252 | /* Bad block management functions */ | 224 | /* Backing device capabilities for this device |
253 | int (*block_isbad) (struct mtd_info *mtd, loff_t ofs); | 225 | * - provides mmap capabilities |
254 | int (*block_markbad) (struct mtd_info *mtd, loff_t ofs); | 226 | */ |
227 | struct backing_dev_info *backing_dev_info; | ||
255 | 228 | ||
256 | struct notifier_block reboot_notifier; /* default mode before reboot */ | 229 | struct notifier_block reboot_notifier; /* default mode before reboot */ |
257 | 230 | ||
@@ -265,18 +238,218 @@ struct mtd_info { | |||
265 | struct module *owner; | 238 | struct module *owner; |
266 | struct device dev; | 239 | struct device dev; |
267 | int usecount; | 240 | int usecount; |
268 | |||
269 | /* If the driver is something smart, like UBI, it may need to maintain | ||
270 | * its own reference counting. The below functions are only for driver. | ||
271 | * The driver may register its callbacks. These callbacks are not | ||
272 | * supposed to be called by MTD users */ | ||
273 | int (*get_device) (struct mtd_info *mtd); | ||
274 | void (*put_device) (struct mtd_info *mtd); | ||
275 | }; | 241 | }; |
276 | 242 | ||
277 | static inline struct mtd_info *dev_to_mtd(struct device *dev) | 243 | /* |
244 | * Erase is an asynchronous operation. Device drivers are supposed | ||
245 | * to call instr->callback() whenever the operation completes, even | ||
246 | * if it completes with a failure. | ||
247 | * Callers are supposed to pass a callback function and wait for it | ||
248 | * to be called before writing to the block. | ||
249 | */ | ||
250 | static inline int mtd_erase(struct mtd_info *mtd, struct erase_info *instr) | ||
251 | { | ||
252 | return mtd->erase(mtd, instr); | ||
253 | } | ||
254 | |||
255 | /* | ||
256 | * This stuff for eXecute-In-Place. phys is optional and may be set to NULL. | ||
257 | */ | ||
258 | static inline int mtd_point(struct mtd_info *mtd, loff_t from, size_t len, | ||
259 | size_t *retlen, void **virt, resource_size_t *phys) | ||
260 | { | ||
261 | *retlen = 0; | ||
262 | if (!mtd->point) | ||
263 | return -EOPNOTSUPP; | ||
264 | return mtd->point(mtd, from, len, retlen, virt, phys); | ||
265 | } | ||
266 | |||
267 | /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ | ||
268 | static inline void mtd_unpoint(struct mtd_info *mtd, loff_t from, size_t len) | ||
278 | { | 269 | { |
279 | return dev ? dev_get_drvdata(dev) : NULL; | 270 | return mtd->unpoint(mtd, from, len); |
271 | } | ||
272 | |||
273 | /* | ||
274 | * Allow NOMMU mmap() to directly map the device (if not NULL) | ||
275 | * - return the address to which the offset maps | ||
276 | * - return -ENOSYS to indicate refusal to do the mapping | ||
277 | */ | ||
278 | static inline unsigned long mtd_get_unmapped_area(struct mtd_info *mtd, | ||
279 | unsigned long len, | ||
280 | unsigned long offset, | ||
281 | unsigned long flags) | ||
282 | { | ||
283 | if (!mtd->get_unmapped_area) | ||
284 | return -EOPNOTSUPP; | ||
285 | return mtd->get_unmapped_area(mtd, len, offset, flags); | ||
286 | } | ||
287 | |||
288 | static inline int mtd_read(struct mtd_info *mtd, loff_t from, size_t len, | ||
289 | size_t *retlen, u_char *buf) | ||
290 | { | ||
291 | return mtd->read(mtd, from, len, retlen, buf); | ||
292 | } | ||
293 | |||
294 | static inline int mtd_write(struct mtd_info *mtd, loff_t to, size_t len, | ||
295 | size_t *retlen, const u_char *buf) | ||
296 | { | ||
297 | *retlen = 0; | ||
298 | if (!mtd->write) | ||
299 | return -EROFS; | ||
300 | return mtd->write(mtd, to, len, retlen, buf); | ||
301 | } | ||
302 | |||
303 | /* | ||
304 | * In blackbox flight recorder like scenarios we want to make successful writes | ||
305 | * in interrupt context. panic_write() is only intended to be called when its | ||
306 | * known the kernel is about to panic and we need the write to succeed. Since | ||
307 | * the kernel is not going to be running for much longer, this function can | ||
308 | * break locks and delay to ensure the write succeeds (but not sleep). | ||
309 | */ | ||
310 | static inline int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, | ||
311 | size_t *retlen, const u_char *buf) | ||
312 | { | ||
313 | *retlen = 0; | ||
314 | if (!mtd->panic_write) | ||
315 | return -EOPNOTSUPP; | ||
316 | return mtd->panic_write(mtd, to, len, retlen, buf); | ||
317 | } | ||
318 | |||
319 | static inline int mtd_read_oob(struct mtd_info *mtd, loff_t from, | ||
320 | struct mtd_oob_ops *ops) | ||
321 | { | ||
322 | ops->retlen = ops->oobretlen = 0; | ||
323 | if (!mtd->read_oob) | ||
324 | return -EOPNOTSUPP; | ||
325 | return mtd->read_oob(mtd, from, ops); | ||
326 | } | ||
327 | |||
328 | static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to, | ||
329 | struct mtd_oob_ops *ops) | ||
330 | { | ||
331 | ops->retlen = ops->oobretlen = 0; | ||
332 | if (!mtd->write_oob) | ||
333 | return -EOPNOTSUPP; | ||
334 | return mtd->write_oob(mtd, to, ops); | ||
335 | } | ||
336 | |||
337 | /* | ||
338 | * Method to access the protection register area, present in some flash | ||
339 | * devices. The user data is one time programmable but the factory data is read | ||
340 | * only. | ||
341 | */ | ||
342 | static inline int mtd_get_fact_prot_info(struct mtd_info *mtd, | ||
343 | struct otp_info *buf, size_t len) | ||
344 | { | ||
345 | if (!mtd->get_fact_prot_info) | ||
346 | return -EOPNOTSUPP; | ||
347 | return mtd->get_fact_prot_info(mtd, buf, len); | ||
348 | } | ||
349 | |||
350 | static inline int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, | ||
351 | size_t len, size_t *retlen, | ||
352 | u_char *buf) | ||
353 | { | ||
354 | *retlen = 0; | ||
355 | if (!mtd->read_fact_prot_reg) | ||
356 | return -EOPNOTSUPP; | ||
357 | return mtd->read_fact_prot_reg(mtd, from, len, retlen, buf); | ||
358 | } | ||
359 | |||
360 | static inline int mtd_get_user_prot_info(struct mtd_info *mtd, | ||
361 | struct otp_info *buf, | ||
362 | size_t len) | ||
363 | { | ||
364 | if (!mtd->get_user_prot_info) | ||
365 | return -EOPNOTSUPP; | ||
366 | return mtd->get_user_prot_info(mtd, buf, len); | ||
367 | } | ||
368 | |||
369 | static inline int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from, | ||
370 | size_t len, size_t *retlen, | ||
371 | u_char *buf) | ||
372 | { | ||
373 | *retlen = 0; | ||
374 | if (!mtd->read_user_prot_reg) | ||
375 | return -EOPNOTSUPP; | ||
376 | return mtd->read_user_prot_reg(mtd, from, len, retlen, buf); | ||
377 | } | ||
378 | |||
379 | static inline int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to, | ||
380 | size_t len, size_t *retlen, | ||
381 | u_char *buf) | ||
382 | { | ||
383 | *retlen = 0; | ||
384 | if (!mtd->write_user_prot_reg) | ||
385 | return -EOPNOTSUPP; | ||
386 | return mtd->write_user_prot_reg(mtd, to, len, retlen, buf); | ||
387 | } | ||
388 | |||
389 | static inline int mtd_lock_user_prot_reg(struct mtd_info *mtd, loff_t from, | ||
390 | size_t len) | ||
391 | { | ||
392 | if (!mtd->lock_user_prot_reg) | ||
393 | return -EOPNOTSUPP; | ||
394 | return mtd->lock_user_prot_reg(mtd, from, len); | ||
395 | } | ||
396 | |||
397 | int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, | ||
398 | unsigned long count, loff_t to, size_t *retlen); | ||
399 | |||
400 | static inline void mtd_sync(struct mtd_info *mtd) | ||
401 | { | ||
402 | if (mtd->sync) | ||
403 | mtd->sync(mtd); | ||
404 | } | ||
405 | |||
406 | /* Chip-supported device locking */ | ||
407 | static inline int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | ||
408 | { | ||
409 | if (!mtd->lock) | ||
410 | return -EOPNOTSUPP; | ||
411 | return mtd->lock(mtd, ofs, len); | ||
412 | } | ||
413 | |||
414 | static inline int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | ||
415 | { | ||
416 | if (!mtd->unlock) | ||
417 | return -EOPNOTSUPP; | ||
418 | return mtd->unlock(mtd, ofs, len); | ||
419 | } | ||
420 | |||
421 | static inline int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) | ||
422 | { | ||
423 | if (!mtd->is_locked) | ||
424 | return -EOPNOTSUPP; | ||
425 | return mtd->is_locked(mtd, ofs, len); | ||
426 | } | ||
427 | |||
428 | static inline int mtd_suspend(struct mtd_info *mtd) | ||
429 | { | ||
430 | if (!mtd->suspend) | ||
431 | return -EOPNOTSUPP; | ||
432 | return mtd->suspend(mtd); | ||
433 | } | ||
434 | |||
435 | static inline void mtd_resume(struct mtd_info *mtd) | ||
436 | { | ||
437 | if (mtd->resume) | ||
438 | mtd->resume(mtd); | ||
439 | } | ||
440 | |||
441 | static inline int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs) | ||
442 | { | ||
443 | if (!mtd->block_isbad) | ||
444 | return -EOPNOTSUPP; | ||
445 | return mtd->block_isbad(mtd, ofs); | ||
446 | } | ||
447 | |||
448 | static inline int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs) | ||
449 | { | ||
450 | if (!mtd->block_markbad) | ||
451 | return -EOPNOTSUPP; | ||
452 | return mtd->block_markbad(mtd, ofs); | ||
280 | } | 453 | } |
281 | 454 | ||
282 | static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) | 455 | static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) |
@@ -309,6 +482,16 @@ static inline uint32_t mtd_mod_by_ws(uint64_t sz, struct mtd_info *mtd) | |||
309 | return do_div(sz, mtd->writesize); | 482 | return do_div(sz, mtd->writesize); |
310 | } | 483 | } |
311 | 484 | ||
485 | static inline int mtd_has_oob(const struct mtd_info *mtd) | ||
486 | { | ||
487 | return mtd->read_oob && mtd->write_oob; | ||
488 | } | ||
489 | |||
490 | static inline int mtd_can_have_bb(const struct mtd_info *mtd) | ||
491 | { | ||
492 | return !!mtd->block_isbad; | ||
493 | } | ||
494 | |||
312 | /* Kernel-side ioctl definitions */ | 495 | /* Kernel-side ioctl definitions */ |
313 | 496 | ||
314 | struct mtd_partition; | 497 | struct mtd_partition; |
@@ -338,13 +521,6 @@ struct mtd_notifier { | |||
338 | 521 | ||
339 | extern void register_mtd_user (struct mtd_notifier *new); | 522 | extern void register_mtd_user (struct mtd_notifier *new); |
340 | extern int unregister_mtd_user (struct mtd_notifier *old); | 523 | extern int unregister_mtd_user (struct mtd_notifier *old); |
341 | |||
342 | int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, | ||
343 | unsigned long count, loff_t to, size_t *retlen); | ||
344 | |||
345 | int default_mtd_readv(struct mtd_info *mtd, struct kvec *vecs, | ||
346 | unsigned long count, loff_t from, size_t *retlen); | ||
347 | |||
348 | void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size); | 524 | void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size); |
349 | 525 | ||
350 | void mtd_erase_callback(struct erase_info *instr); | 526 | void mtd_erase_callback(struct erase_info *instr); |
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 904131bab501..63b5a8b6dfbd 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -555,6 +555,7 @@ struct nand_chip { | |||
555 | #define NAND_MFR_HYNIX 0xad | 555 | #define NAND_MFR_HYNIX 0xad |
556 | #define NAND_MFR_MICRON 0x2c | 556 | #define NAND_MFR_MICRON 0x2c |
557 | #define NAND_MFR_AMD 0x01 | 557 | #define NAND_MFR_AMD 0x01 |
558 | #define NAND_MFR_MACRONIX 0xc2 | ||
558 | 559 | ||
559 | /** | 560 | /** |
560 | * struct nand_flash_dev - NAND Flash Device ID Structure | 561 | * struct nand_flash_dev - NAND Flash Device ID Structure |
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h index 04e018160e2b..d2887e76b7f6 100644 --- a/include/linux/mtd/physmap.h +++ b/include/linux/mtd/physmap.h | |||
@@ -30,6 +30,7 @@ struct physmap_flash_data { | |||
30 | unsigned int pfow_base; | 30 | unsigned int pfow_base; |
31 | char *probe_type; | 31 | char *probe_type; |
32 | struct mtd_partition *parts; | 32 | struct mtd_partition *parts; |
33 | const char **part_probe_types; | ||
33 | }; | 34 | }; |
34 | 35 | ||
35 | #endif /* __LINUX_MTD_PHYSMAP__ */ | 36 | #endif /* __LINUX_MTD_PHYSMAP__ */ |
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index b5479df8378d..ba4d7656ecfd 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h | |||
@@ -153,6 +153,7 @@ struct nfs_server { | |||
153 | struct rb_root openowner_id; | 153 | struct rb_root openowner_id; |
154 | struct rb_root lockowner_id; | 154 | struct rb_root lockowner_id; |
155 | #endif | 155 | #endif |
156 | struct list_head state_owners_lru; | ||
156 | struct list_head layouts; | 157 | struct list_head layouts; |
157 | struct list_head delegations; | 158 | struct list_head delegations; |
158 | void (*destroy)(struct nfs_server *); | 159 | void (*destroy)(struct nfs_server *); |
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h index ae7d6a380dae..308c18877018 100644 --- a/include/linux/nfs_idmap.h +++ b/include/linux/nfs_idmap.h | |||
@@ -66,6 +66,8 @@ struct idmap_msg { | |||
66 | /* Forward declaration to make this header independent of others */ | 66 | /* Forward declaration to make this header independent of others */ |
67 | struct nfs_client; | 67 | struct nfs_client; |
68 | struct nfs_server; | 68 | struct nfs_server; |
69 | struct nfs_fattr; | ||
70 | struct nfs4_string; | ||
69 | 71 | ||
70 | #ifdef CONFIG_NFS_USE_NEW_IDMAPPER | 72 | #ifdef CONFIG_NFS_USE_NEW_IDMAPPER |
71 | 73 | ||
@@ -97,6 +99,12 @@ void nfs_idmap_delete(struct nfs_client *); | |||
97 | 99 | ||
98 | #endif /* CONFIG_NFS_USE_NEW_IDMAPPER */ | 100 | #endif /* CONFIG_NFS_USE_NEW_IDMAPPER */ |
99 | 101 | ||
102 | void nfs_fattr_init_names(struct nfs_fattr *fattr, | ||
103 | struct nfs4_string *owner_name, | ||
104 | struct nfs4_string *group_name); | ||
105 | void nfs_fattr_free_names(struct nfs_fattr *); | ||
106 | void nfs_fattr_map_and_free_names(struct nfs_server *, struct nfs_fattr *); | ||
107 | |||
100 | int nfs_map_name_to_uid(const struct nfs_server *, const char *, size_t, __u32 *); | 108 | int nfs_map_name_to_uid(const struct nfs_server *, const char *, size_t, __u32 *); |
101 | int nfs_map_group_to_gid(const struct nfs_server *, const char *, size_t, __u32 *); | 109 | int nfs_map_group_to_gid(const struct nfs_server *, const char *, size_t, __u32 *); |
102 | int nfs_map_uid_to_name(const struct nfs_server *, __u32, char *, size_t); | 110 | int nfs_map_uid_to_name(const struct nfs_server *, __u32, char *, size_t); |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 2a7c533be5dd..a764cef06b73 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -18,6 +18,11 @@ | |||
18 | /* Forward declaration for NFS v3 */ | 18 | /* Forward declaration for NFS v3 */ |
19 | struct nfs4_secinfo_flavors; | 19 | struct nfs4_secinfo_flavors; |
20 | 20 | ||
21 | struct nfs4_string { | ||
22 | unsigned int len; | ||
23 | char *data; | ||
24 | }; | ||
25 | |||
21 | struct nfs_fsid { | 26 | struct nfs_fsid { |
22 | uint64_t major; | 27 | uint64_t major; |
23 | uint64_t minor; | 28 | uint64_t minor; |
@@ -61,6 +66,8 @@ struct nfs_fattr { | |||
61 | struct timespec pre_ctime; /* pre_op_attr.ctime */ | 66 | struct timespec pre_ctime; /* pre_op_attr.ctime */ |
62 | unsigned long time_start; | 67 | unsigned long time_start; |
63 | unsigned long gencount; | 68 | unsigned long gencount; |
69 | struct nfs4_string *owner_name; | ||
70 | struct nfs4_string *group_name; | ||
64 | }; | 71 | }; |
65 | 72 | ||
66 | #define NFS_ATTR_FATTR_TYPE (1U << 0) | 73 | #define NFS_ATTR_FATTR_TYPE (1U << 0) |
@@ -85,6 +92,8 @@ struct nfs_fattr { | |||
85 | #define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */ | 92 | #define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */ |
86 | #define NFS_ATTR_FATTR_MOUNTPOINT (1U << 20) /* Treat as mountpoint */ | 93 | #define NFS_ATTR_FATTR_MOUNTPOINT (1U << 20) /* Treat as mountpoint */ |
87 | #define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 21) | 94 | #define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 21) |
95 | #define NFS_ATTR_FATTR_OWNER_NAME (1U << 22) | ||
96 | #define NFS_ATTR_FATTR_GROUP_NAME (1U << 23) | ||
88 | 97 | ||
89 | #define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ | 98 | #define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ |
90 | | NFS_ATTR_FATTR_MODE \ | 99 | | NFS_ATTR_FATTR_MODE \ |
@@ -324,6 +333,7 @@ struct nfs_openargs { | |||
324 | const struct qstr * name; | 333 | const struct qstr * name; |
325 | const struct nfs_server *server; /* Needed for ID mapping */ | 334 | const struct nfs_server *server; /* Needed for ID mapping */ |
326 | const u32 * bitmask; | 335 | const u32 * bitmask; |
336 | const u32 * dir_bitmask; | ||
327 | __u32 claim; | 337 | __u32 claim; |
328 | struct nfs4_sequence_args seq_args; | 338 | struct nfs4_sequence_args seq_args; |
329 | }; | 339 | }; |
@@ -342,6 +352,8 @@ struct nfs_openres { | |||
342 | __u32 do_recall; | 352 | __u32 do_recall; |
343 | __u64 maxsize; | 353 | __u64 maxsize; |
344 | __u32 attrset[NFS4_BITMAP_SIZE]; | 354 | __u32 attrset[NFS4_BITMAP_SIZE]; |
355 | struct nfs4_string *owner; | ||
356 | struct nfs4_string *group_owner; | ||
345 | struct nfs4_sequence_res seq_res; | 357 | struct nfs4_sequence_res seq_res; |
346 | }; | 358 | }; |
347 | 359 | ||
@@ -602,11 +614,16 @@ struct nfs_getaclargs { | |||
602 | size_t acl_len; | 614 | size_t acl_len; |
603 | unsigned int acl_pgbase; | 615 | unsigned int acl_pgbase; |
604 | struct page ** acl_pages; | 616 | struct page ** acl_pages; |
617 | struct page * acl_scratch; | ||
605 | struct nfs4_sequence_args seq_args; | 618 | struct nfs4_sequence_args seq_args; |
606 | }; | 619 | }; |
607 | 620 | ||
621 | /* getxattr ACL interface flags */ | ||
622 | #define NFS4_ACL_LEN_REQUEST 0x0001 /* zero length getxattr buffer */ | ||
608 | struct nfs_getaclres { | 623 | struct nfs_getaclres { |
609 | size_t acl_len; | 624 | size_t acl_len; |
625 | size_t acl_data_offset; | ||
626 | int acl_flags; | ||
610 | struct nfs4_sequence_res seq_res; | 627 | struct nfs4_sequence_res seq_res; |
611 | }; | 628 | }; |
612 | 629 | ||
@@ -773,11 +790,6 @@ struct nfs3_getaclres { | |||
773 | struct posix_acl * acl_default; | 790 | struct posix_acl * acl_default; |
774 | }; | 791 | }; |
775 | 792 | ||
776 | struct nfs4_string { | ||
777 | unsigned int len; | ||
778 | char *data; | ||
779 | }; | ||
780 | |||
781 | #ifdef CONFIG_NFS_V4 | 793 | #ifdef CONFIG_NFS_V4 |
782 | 794 | ||
783 | typedef u64 clientid4; | 795 | typedef u64 clientid4; |
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h index 7cea7b6c1413..c8320144fe79 100644 --- a/include/linux/pci-aspm.h +++ b/include/linux/pci-aspm.h | |||
@@ -29,7 +29,7 @@ extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); | |||
29 | extern void pcie_aspm_powersave_config_link(struct pci_dev *pdev); | 29 | extern void pcie_aspm_powersave_config_link(struct pci_dev *pdev); |
30 | extern void pci_disable_link_state(struct pci_dev *pdev, int state); | 30 | extern void pci_disable_link_state(struct pci_dev *pdev, int state); |
31 | extern void pci_disable_link_state_locked(struct pci_dev *pdev, int state); | 31 | extern void pci_disable_link_state_locked(struct pci_dev *pdev, int state); |
32 | extern void pcie_clear_aspm(void); | 32 | extern void pcie_clear_aspm(struct pci_bus *bus); |
33 | extern void pcie_no_aspm(void); | 33 | extern void pcie_no_aspm(void); |
34 | #else | 34 | #else |
35 | static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) | 35 | static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) |
@@ -47,7 +47,7 @@ static inline void pcie_aspm_powersave_config_link(struct pci_dev *pdev) | |||
47 | static inline void pci_disable_link_state(struct pci_dev *pdev, int state) | 47 | static inline void pci_disable_link_state(struct pci_dev *pdev, int state) |
48 | { | 48 | { |
49 | } | 49 | } |
50 | static inline void pcie_clear_aspm(void) | 50 | static inline void pcie_clear_aspm(struct pci_bus *bus) |
51 | { | 51 | { |
52 | } | 52 | } |
53 | static inline void pcie_no_aspm(void) | 53 | static inline void pcie_no_aspm(void) |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 7cda65b5f798..84225c756bd1 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -336,6 +336,7 @@ struct pci_dev { | |||
336 | struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; /* sysfs file for WC mapping of resources */ | 336 | struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; /* sysfs file for WC mapping of resources */ |
337 | #ifdef CONFIG_PCI_MSI | 337 | #ifdef CONFIG_PCI_MSI |
338 | struct list_head msi_list; | 338 | struct list_head msi_list; |
339 | struct kset *msi_kset; | ||
339 | #endif | 340 | #endif |
340 | struct pci_vpd *vpd; | 341 | struct pci_vpd *vpd; |
341 | #ifdef CONFIG_PCI_ATS | 342 | #ifdef CONFIG_PCI_ATS |
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h index b5d9657f3100..28fe380cb19d 100644 --- a/include/linux/pci_regs.h +++ b/include/linux/pci_regs.h | |||
@@ -537,7 +537,9 @@ | |||
537 | #define PCI_EXT_CAP_ID_ARI 14 | 537 | #define PCI_EXT_CAP_ID_ARI 14 |
538 | #define PCI_EXT_CAP_ID_ATS 15 | 538 | #define PCI_EXT_CAP_ID_ATS 15 |
539 | #define PCI_EXT_CAP_ID_SRIOV 16 | 539 | #define PCI_EXT_CAP_ID_SRIOV 16 |
540 | #define PCI_EXT_CAP_ID_PRI 19 | ||
540 | #define PCI_EXT_CAP_ID_LTR 24 | 541 | #define PCI_EXT_CAP_ID_LTR 24 |
542 | #define PCI_EXT_CAP_ID_PASID 27 | ||
541 | 543 | ||
542 | /* Advanced Error Reporting */ | 544 | /* Advanced Error Reporting */ |
543 | #define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ | 545 | #define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ |
@@ -664,24 +666,24 @@ | |||
664 | #define PCI_ATS_MIN_STU 12 /* shift of minimum STU block */ | 666 | #define PCI_ATS_MIN_STU 12 /* shift of minimum STU block */ |
665 | 667 | ||
666 | /* Page Request Interface */ | 668 | /* Page Request Interface */ |
667 | #define PCI_PRI_CAP 0x13 /* PRI capability ID */ | 669 | #define PCI_PRI_CTRL 0x04 /* PRI control register */ |
668 | #define PCI_PRI_CONTROL_OFF 0x04 /* Offset of control register */ | 670 | #define PCI_PRI_CTRL_ENABLE 0x01 /* Enable */ |
669 | #define PCI_PRI_STATUS_OFF 0x06 /* Offset of status register */ | 671 | #define PCI_PRI_CTRL_RESET 0x02 /* Reset */ |
670 | #define PCI_PRI_ENABLE 0x0001 /* Enable mask */ | 672 | #define PCI_PRI_STATUS 0x06 /* PRI status register */ |
671 | #define PCI_PRI_RESET 0x0002 /* Reset bit mask */ | 673 | #define PCI_PRI_STATUS_RF 0x001 /* Response Failure */ |
672 | #define PCI_PRI_STATUS_RF 0x0001 /* Request Failure */ | 674 | #define PCI_PRI_STATUS_UPRGI 0x002 /* Unexpected PRG index */ |
673 | #define PCI_PRI_STATUS_UPRGI 0x0002 /* Unexpected PRG index */ | 675 | #define PCI_PRI_STATUS_STOPPED 0x100 /* PRI Stopped */ |
674 | #define PCI_PRI_STATUS_STOPPED 0x0100 /* PRI Stopped */ | 676 | #define PCI_PRI_MAX_REQ 0x08 /* PRI max reqs supported */ |
675 | #define PCI_PRI_MAX_REQ_OFF 0x08 /* Cap offset for max reqs supported */ | 677 | #define PCI_PRI_ALLOC_REQ 0x0c /* PRI max reqs allowed */ |
676 | #define PCI_PRI_ALLOC_REQ_OFF 0x0c /* Cap offset for max reqs allowed */ | ||
677 | 678 | ||
678 | /* PASID capability */ | 679 | /* PASID capability */ |
679 | #define PCI_PASID_CAP 0x1b /* PASID capability ID */ | 680 | #define PCI_PASID_CAP 0x04 /* PASID feature register */ |
680 | #define PCI_PASID_CAP_OFF 0x04 /* PASID feature register */ | 681 | #define PCI_PASID_CAP_EXEC 0x02 /* Exec permissions Supported */ |
681 | #define PCI_PASID_CONTROL_OFF 0x06 /* PASID control register */ | 682 | #define PCI_PASID_CAP_PRIV 0x04 /* Priviledge Mode Supported */ |
682 | #define PCI_PASID_ENABLE 0x01 /* Enable/Supported bit */ | 683 | #define PCI_PASID_CTRL 0x06 /* PASID control register */ |
683 | #define PCI_PASID_EXEC 0x02 /* Exec permissions Enable/Supported */ | 684 | #define PCI_PASID_CTRL_ENABLE 0x01 /* Enable bit */ |
684 | #define PCI_PASID_PRIV 0x04 /* Priviledge Mode Enable/Support */ | 685 | #define PCI_PASID_CTRL_EXEC 0x02 /* Exec permissions Enable */ |
686 | #define PCI_PASID_CTRL_PRIV 0x04 /* Priviledge Mode Enable */ | ||
685 | 687 | ||
686 | /* Single Root I/O Virtualization */ | 688 | /* Single Root I/O Virtualization */ |
687 | #define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */ | 689 | #define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */ |
diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h index 88863531d862..d0aecb7f6fb9 100644 --- a/include/linux/pinctrl/machine.h +++ b/include/linux/pinctrl/machine.h | |||
@@ -48,7 +48,7 @@ struct pinmux_map { | |||
48 | const char *group; | 48 | const char *group; |
49 | struct device *dev; | 49 | struct device *dev; |
50 | const char *dev_name; | 50 | const char *dev_name; |
51 | const bool hog_on_boot; | 51 | bool hog_on_boot; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | /* | 54 | /* |
@@ -66,30 +66,22 @@ struct pinmux_map { | |||
66 | { .name = a, .ctrl_dev_name = b, .function = c } | 66 | { .name = a, .ctrl_dev_name = b, .function = c } |
67 | 67 | ||
68 | /* | 68 | /* |
69 | * Convenience macro to map a function onto the primary device pinctrl device | 69 | * Convenience macro to map a system function onto a certain pinctrl device, |
70 | * this is especially helpful on systems that have only one pin controller | 70 | * to be hogged by the pinmux core until the system shuts down. |
71 | * or need to set up a lot of mappings on the primary controller. | ||
72 | */ | ||
73 | #define PINMUX_MAP_PRIMARY(a, b, c) \ | ||
74 | { .name = a, .ctrl_dev_name = "pinctrl.0", .function = b, \ | ||
75 | .dev_name = c } | ||
76 | |||
77 | /* | ||
78 | * Convenience macro to map a system function onto the primary pinctrl device. | ||
79 | * System functions are not assigned to a particular device. | ||
80 | */ | 71 | */ |
81 | #define PINMUX_MAP_PRIMARY_SYS(a, b) \ | 72 | #define PINMUX_MAP_SYS_HOG(a, b, c) \ |
82 | { .name = a, .ctrl_dev_name = "pinctrl.0", .function = b } | 73 | { .name = a, .ctrl_dev_name = b, .function = c, \ |
74 | .hog_on_boot = true } | ||
83 | 75 | ||
84 | /* | 76 | /* |
85 | * Convenience macro to map a system function onto the primary pinctrl device, | 77 | * Convenience macro to map a system function onto a certain pinctrl device |
86 | * to be hogged by the pinmux core until the system shuts down. | 78 | * using a specified group, to be hogged by the pinmux core until the system |
79 | * shuts down. | ||
87 | */ | 80 | */ |
88 | #define PINMUX_MAP_PRIMARY_SYS_HOG(a, b) \ | 81 | #define PINMUX_MAP_SYS_HOG_GROUP(a, b, c, d) \ |
89 | { .name = a, .ctrl_dev_name = "pinctrl.0", .function = b, \ | 82 | { .name = a, .ctrl_dev_name = b, .function = c, .group = d, \ |
90 | .hog_on_boot = true } | 83 | .hog_on_boot = true } |
91 | 84 | ||
92 | |||
93 | #ifdef CONFIG_PINMUX | 85 | #ifdef CONFIG_PINMUX |
94 | 86 | ||
95 | extern int pinmux_register_mappings(struct pinmux_map const *map, | 87 | extern int pinmux_register_mappings(struct pinmux_map const *map, |
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h new file mode 100644 index 000000000000..477922cf043a --- /dev/null +++ b/include/linux/pinctrl/pinconf.h | |||
@@ -0,0 +1,97 @@ | |||
1 | /* | ||
2 | * Interface the pinconfig portions of the pinctrl subsystem | ||
3 | * | ||
4 | * Copyright (C) 2011 ST-Ericsson SA | ||
5 | * Written on behalf of Linaro for ST-Ericsson | ||
6 | * This interface is used in the core to keep track of pins. | ||
7 | * | ||
8 | * Author: Linus Walleij <linus.walleij@linaro.org> | ||
9 | * | ||
10 | * License terms: GNU General Public License (GPL) version 2 | ||
11 | */ | ||
12 | #ifndef __LINUX_PINCTRL_PINCONF_H | ||
13 | #define __LINUX_PINCTRL_PINCONF_H | ||
14 | |||
15 | #ifdef CONFIG_PINCONF | ||
16 | |||
17 | struct pinctrl_dev; | ||
18 | struct seq_file; | ||
19 | |||
20 | /** | ||
21 | * struct pinconf_ops - pin config operations, to be implemented by | ||
22 | * pin configuration capable drivers. | ||
23 | * @pin_config_get: get the config of a certain pin, if the requested config | ||
24 | * is not available on this controller this should return -ENOTSUPP | ||
25 | * and if it is available but disabled it should return -EINVAL | ||
26 | * @pin_config_get: get the config of a certain pin | ||
27 | * @pin_config_set: configure an individual pin | ||
28 | * @pin_config_group_get: get configurations for an entire pin group | ||
29 | * @pin_config_group_set: configure all pins in a group | ||
30 | * @pin_config_dbg_show: optional debugfs display hook that will provide | ||
31 | * per-device info for a certain pin in debugfs | ||
32 | * @pin_config_group_dbg_show: optional debugfs display hook that will provide | ||
33 | * per-device info for a certain group in debugfs | ||
34 | */ | ||
35 | struct pinconf_ops { | ||
36 | int (*pin_config_get) (struct pinctrl_dev *pctldev, | ||
37 | unsigned pin, | ||
38 | unsigned long *config); | ||
39 | int (*pin_config_set) (struct pinctrl_dev *pctldev, | ||
40 | unsigned pin, | ||
41 | unsigned long config); | ||
42 | int (*pin_config_group_get) (struct pinctrl_dev *pctldev, | ||
43 | unsigned selector, | ||
44 | unsigned long *config); | ||
45 | int (*pin_config_group_set) (struct pinctrl_dev *pctldev, | ||
46 | unsigned selector, | ||
47 | unsigned long config); | ||
48 | void (*pin_config_dbg_show) (struct pinctrl_dev *pctldev, | ||
49 | struct seq_file *s, | ||
50 | unsigned offset); | ||
51 | void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev, | ||
52 | struct seq_file *s, | ||
53 | unsigned selector); | ||
54 | }; | ||
55 | |||
56 | extern int pin_config_get(const char *dev_name, const char *name, | ||
57 | unsigned long *config); | ||
58 | extern int pin_config_set(const char *dev_name, const char *name, | ||
59 | unsigned long config); | ||
60 | extern int pin_config_group_get(const char *dev_name, | ||
61 | const char *pin_group, | ||
62 | unsigned long *config); | ||
63 | extern int pin_config_group_set(const char *dev_name, | ||
64 | const char *pin_group, | ||
65 | unsigned long config); | ||
66 | |||
67 | #else | ||
68 | |||
69 | static inline int pin_config_get(const char *dev_name, const char *name, | ||
70 | unsigned long *config) | ||
71 | { | ||
72 | return 0; | ||
73 | } | ||
74 | |||
75 | static inline int pin_config_set(const char *dev_name, const char *name, | ||
76 | unsigned long config) | ||
77 | { | ||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | static inline int pin_config_group_get(const char *dev_name, | ||
82 | const char *pin_group, | ||
83 | unsigned long *config) | ||
84 | { | ||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | static inline int pin_config_group_set(const char *dev_name, | ||
89 | const char *pin_group, | ||
90 | unsigned long config) | ||
91 | { | ||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | #endif | ||
96 | |||
97 | #endif /* __LINUX_PINCTRL_PINCONF_H */ | ||
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h index 04c011038f32..8bd22ee7aa09 100644 --- a/include/linux/pinctrl/pinctrl.h +++ b/include/linux/pinctrl/pinctrl.h | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | struct pinctrl_dev; | 22 | struct pinctrl_dev; |
23 | struct pinmux_ops; | 23 | struct pinmux_ops; |
24 | struct pinconf_ops; | ||
24 | struct gpio_chip; | 25 | struct gpio_chip; |
25 | 26 | ||
26 | /** | 27 | /** |
@@ -45,6 +46,7 @@ struct pinctrl_pin_desc { | |||
45 | * @name: a name for the chip in this range | 46 | * @name: a name for the chip in this range |
46 | * @id: an ID number for the chip in this range | 47 | * @id: an ID number for the chip in this range |
47 | * @base: base offset of the GPIO range | 48 | * @base: base offset of the GPIO range |
49 | * @pin_base: base pin number of the GPIO range | ||
48 | * @npins: number of pins in the GPIO range, including the base number | 50 | * @npins: number of pins in the GPIO range, including the base number |
49 | * @gc: an optional pointer to a gpio_chip | 51 | * @gc: an optional pointer to a gpio_chip |
50 | */ | 52 | */ |
@@ -53,6 +55,7 @@ struct pinctrl_gpio_range { | |||
53 | const char *name; | 55 | const char *name; |
54 | unsigned int id; | 56 | unsigned int id; |
55 | unsigned int base; | 57 | unsigned int base; |
58 | unsigned int pin_base; | ||
56 | unsigned int npins; | 59 | unsigned int npins; |
57 | struct gpio_chip *gc; | 60 | struct gpio_chip *gc; |
58 | }; | 61 | }; |
@@ -89,22 +92,20 @@ struct pinctrl_ops { | |||
89 | * this pin controller | 92 | * this pin controller |
90 | * @npins: number of descriptors in the array, usually just ARRAY_SIZE() | 93 | * @npins: number of descriptors in the array, usually just ARRAY_SIZE() |
91 | * of the pins field above | 94 | * of the pins field above |
92 | * @maxpin: since pin spaces may be sparse, there can he "holes" in the | ||
93 | * pin range, this attribute gives the maximum pin number in the | ||
94 | * total range. This should not be lower than npins for example, | ||
95 | * but may be equal to npins if you have no holes in the pin range. | ||
96 | * @pctlops: pin control operation vtable, to support global concepts like | 95 | * @pctlops: pin control operation vtable, to support global concepts like |
97 | * grouping of pins, this is optional. | 96 | * grouping of pins, this is optional. |
98 | * @pmxops: pinmux operation vtable, if you support pinmuxing in your driver | 97 | * @pmxops: pinmux operations vtable, if you support pinmuxing in your driver |
98 | * @confops: pin config operations vtable, if you support pin configuration in | ||
99 | * your driver | ||
99 | * @owner: module providing the pin controller, used for refcounting | 100 | * @owner: module providing the pin controller, used for refcounting |
100 | */ | 101 | */ |
101 | struct pinctrl_desc { | 102 | struct pinctrl_desc { |
102 | const char *name; | 103 | const char *name; |
103 | struct pinctrl_pin_desc const *pins; | 104 | struct pinctrl_pin_desc const *pins; |
104 | unsigned int npins; | 105 | unsigned int npins; |
105 | unsigned int maxpin; | ||
106 | struct pinctrl_ops *pctlops; | 106 | struct pinctrl_ops *pctlops; |
107 | struct pinmux_ops *pmxops; | 107 | struct pinmux_ops *pmxops; |
108 | struct pinconf_ops *confops; | ||
108 | struct module *owner; | 109 | struct module *owner; |
109 | }; | 110 | }; |
110 | 111 | ||
@@ -123,7 +124,7 @@ extern void *pinctrl_dev_get_drvdata(struct pinctrl_dev *pctldev); | |||
123 | 124 | ||
124 | struct pinctrl_dev; | 125 | struct pinctrl_dev; |
125 | 126 | ||
126 | /* Sufficiently stupid default function when pinctrl is not in use */ | 127 | /* Sufficiently stupid default functions when pinctrl is not in use */ |
127 | static inline bool pin_is_valid(struct pinctrl_dev *pctldev, int pin) | 128 | static inline bool pin_is_valid(struct pinctrl_dev *pctldev, int pin) |
128 | { | 129 | { |
129 | return pin >= 0; | 130 | return pin >= 0; |
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h index 3c430e797efc..937b3e2fa36f 100644 --- a/include/linux/pinctrl/pinmux.h +++ b/include/linux/pinctrl/pinmux.h | |||
@@ -52,9 +52,15 @@ struct pinctrl_dev; | |||
52 | * @disable: disable a certain muxing selector with a certain pin group | 52 | * @disable: disable a certain muxing selector with a certain pin group |
53 | * @gpio_request_enable: requests and enables GPIO on a certain pin. | 53 | * @gpio_request_enable: requests and enables GPIO on a certain pin. |
54 | * Implement this only if you can mux every pin individually as GPIO. The | 54 | * Implement this only if you can mux every pin individually as GPIO. The |
55 | * affected GPIO range is passed along with an offset into that | 55 | * affected GPIO range is passed along with an offset(pin number) into that |
56 | * specific GPIO range - function selectors and pin groups are orthogonal | 56 | * specific GPIO range - function selectors and pin groups are orthogonal |
57 | * to this, the core will however make sure the pins do not collide | 57 | * to this, the core will however make sure the pins do not collide. |
58 | * @gpio_disable_free: free up GPIO muxing on a certain pin, the reverse of | ||
59 | * @gpio_request_enable | ||
60 | * @gpio_set_direction: Since controllers may need different configurations | ||
61 | * depending on whether the GPIO is configured as input or output, | ||
62 | * a direction selector function may be implemented as a backing | ||
63 | * to the GPIO controllers that need pin muxing. | ||
58 | */ | 64 | */ |
59 | struct pinmux_ops { | 65 | struct pinmux_ops { |
60 | int (*request) (struct pinctrl_dev *pctldev, unsigned offset); | 66 | int (*request) (struct pinctrl_dev *pctldev, unsigned offset); |
@@ -73,11 +79,20 @@ struct pinmux_ops { | |||
73 | int (*gpio_request_enable) (struct pinctrl_dev *pctldev, | 79 | int (*gpio_request_enable) (struct pinctrl_dev *pctldev, |
74 | struct pinctrl_gpio_range *range, | 80 | struct pinctrl_gpio_range *range, |
75 | unsigned offset); | 81 | unsigned offset); |
82 | void (*gpio_disable_free) (struct pinctrl_dev *pctldev, | ||
83 | struct pinctrl_gpio_range *range, | ||
84 | unsigned offset); | ||
85 | int (*gpio_set_direction) (struct pinctrl_dev *pctldev, | ||
86 | struct pinctrl_gpio_range *range, | ||
87 | unsigned offset, | ||
88 | bool input); | ||
76 | }; | 89 | }; |
77 | 90 | ||
78 | /* External interface to pinmux */ | 91 | /* External interface to pinmux */ |
79 | extern int pinmux_request_gpio(unsigned gpio); | 92 | extern int pinmux_request_gpio(unsigned gpio); |
80 | extern void pinmux_free_gpio(unsigned gpio); | 93 | extern void pinmux_free_gpio(unsigned gpio); |
94 | extern int pinmux_gpio_direction_input(unsigned gpio); | ||
95 | extern int pinmux_gpio_direction_output(unsigned gpio); | ||
81 | extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name); | 96 | extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name); |
82 | extern void pinmux_put(struct pinmux *pmx); | 97 | extern void pinmux_put(struct pinmux *pmx); |
83 | extern int pinmux_enable(struct pinmux *pmx); | 98 | extern int pinmux_enable(struct pinmux *pmx); |
@@ -94,6 +109,16 @@ static inline void pinmux_free_gpio(unsigned gpio) | |||
94 | { | 109 | { |
95 | } | 110 | } |
96 | 111 | ||
112 | static inline int pinmux_gpio_direction_input(unsigned gpio) | ||
113 | { | ||
114 | return 0; | ||
115 | } | ||
116 | |||
117 | static inline int pinmux_gpio_direction_output(unsigned gpio) | ||
118 | { | ||
119 | return 0; | ||
120 | } | ||
121 | |||
97 | static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name) | 122 | static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name) |
98 | { | 123 | { |
99 | return NULL; | 124 | return NULL; |
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index f7756d146c61..f2698a0edfc4 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h | |||
@@ -149,6 +149,8 @@ int regulator_bulk_enable(int num_consumers, | |||
149 | struct regulator_bulk_data *consumers); | 149 | struct regulator_bulk_data *consumers); |
150 | int regulator_bulk_disable(int num_consumers, | 150 | int regulator_bulk_disable(int num_consumers, |
151 | struct regulator_bulk_data *consumers); | 151 | struct regulator_bulk_data *consumers); |
152 | int regulator_bulk_force_disable(int num_consumers, | ||
153 | struct regulator_bulk_data *consumers); | ||
152 | void regulator_bulk_free(int num_consumers, | 154 | void regulator_bulk_free(int num_consumers, |
153 | struct regulator_bulk_data *consumers); | 155 | struct regulator_bulk_data *consumers); |
154 | 156 | ||
@@ -212,6 +214,11 @@ static inline int regulator_disable(struct regulator *regulator) | |||
212 | return 0; | 214 | return 0; |
213 | } | 215 | } |
214 | 216 | ||
217 | static inline int regulator_force_disable(struct regulator *regulator) | ||
218 | { | ||
219 | return 0; | ||
220 | } | ||
221 | |||
215 | static inline int regulator_disable_deferred(struct regulator *regulator, | 222 | static inline int regulator_disable_deferred(struct regulator *regulator, |
216 | int ms) | 223 | int ms) |
217 | { | 224 | { |
@@ -242,6 +249,12 @@ static inline int regulator_bulk_disable(int num_consumers, | |||
242 | return 0; | 249 | return 0; |
243 | } | 250 | } |
244 | 251 | ||
252 | static inline int regulator_bulk_force_disable(int num_consumers, | ||
253 | struct regulator_bulk_data *consumers) | ||
254 | { | ||
255 | return 0; | ||
256 | } | ||
257 | |||
245 | static inline void regulator_bulk_free(int num_consumers, | 258 | static inline void regulator_bulk_free(int num_consumers, |
246 | struct regulator_bulk_data *consumers) | 259 | struct regulator_bulk_data *consumers) |
247 | { | 260 | { |
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 52c89ae32f64..4214b9a9d1c9 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h | |||
@@ -154,6 +154,7 @@ enum regulator_type { | |||
154 | * this type. | 154 | * this type. |
155 | * | 155 | * |
156 | * @name: Identifying name for the regulator. | 156 | * @name: Identifying name for the regulator. |
157 | * @supply_name: Identifying the regulator supply | ||
157 | * @id: Numerical identifier for the regulator. | 158 | * @id: Numerical identifier for the regulator. |
158 | * @n_voltages: Number of selectors available for ops.list_voltage(). | 159 | * @n_voltages: Number of selectors available for ops.list_voltage(). |
159 | * @ops: Regulator operations table. | 160 | * @ops: Regulator operations table. |
@@ -163,6 +164,7 @@ enum regulator_type { | |||
163 | */ | 164 | */ |
164 | struct regulator_desc { | 165 | struct regulator_desc { |
165 | const char *name; | 166 | const char *name; |
167 | const char *supply_name; | ||
166 | int id; | 168 | int id; |
167 | unsigned n_voltages; | 169 | unsigned n_voltages; |
168 | struct regulator_ops *ops; | 170 | struct regulator_ops *ops; |
@@ -212,7 +214,7 @@ struct regulator_dev { | |||
212 | 214 | ||
213 | struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, | 215 | struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, |
214 | struct device *dev, const struct regulator_init_data *init_data, | 216 | struct device *dev, const struct regulator_init_data *init_data, |
215 | void *driver_data); | 217 | void *driver_data, struct device_node *of_node); |
216 | void regulator_unregister(struct regulator_dev *rdev); | 218 | void regulator_unregister(struct regulator_dev *rdev); |
217 | 219 | ||
218 | int regulator_notifier_call_chain(struct regulator_dev *rdev, | 220 | int regulator_notifier_call_chain(struct regulator_dev *rdev, |
diff --git a/include/linux/regulator/of_regulator.h b/include/linux/regulator/of_regulator.h new file mode 100644 index 000000000000..769704f296e5 --- /dev/null +++ b/include/linux/regulator/of_regulator.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * OpenFirmware regulator support routines | ||
3 | * | ||
4 | */ | ||
5 | |||
6 | #ifndef __LINUX_OF_REG_H | ||
7 | #define __LINUX_OF_REG_H | ||
8 | |||
9 | #if defined(CONFIG_OF) | ||
10 | extern struct regulator_init_data | ||
11 | *of_get_regulator_init_data(struct device *dev, | ||
12 | struct device_node *node); | ||
13 | #else | ||
14 | static inline struct regulator_init_data | ||
15 | *of_get_regulator_init_data(struct device *dev, | ||
16 | struct device_node *node) | ||
17 | { | ||
18 | return NULL; | ||
19 | } | ||
20 | #endif /* CONFIG_OF */ | ||
21 | |||
22 | #endif /* __LINUX_OF_REG_H */ | ||
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h index febc4dbec2ca..7874a8a56638 100644 --- a/include/linux/sunrpc/auth.h +++ b/include/linux/sunrpc/auth.h | |||
@@ -26,6 +26,7 @@ struct auth_cred { | |||
26 | uid_t uid; | 26 | uid_t uid; |
27 | gid_t gid; | 27 | gid_t gid; |
28 | struct group_info *group_info; | 28 | struct group_info *group_info; |
29 | const char *principal; | ||
29 | unsigned char machine_cred : 1; | 30 | unsigned char machine_cred : 1; |
30 | }; | 31 | }; |
31 | 32 | ||
@@ -127,7 +128,7 @@ void rpc_destroy_generic_auth(void); | |||
127 | void rpc_destroy_authunix(void); | 128 | void rpc_destroy_authunix(void); |
128 | 129 | ||
129 | struct rpc_cred * rpc_lookup_cred(void); | 130 | struct rpc_cred * rpc_lookup_cred(void); |
130 | struct rpc_cred * rpc_lookup_machine_cred(void); | 131 | struct rpc_cred * rpc_lookup_machine_cred(const char *service_name); |
131 | int rpcauth_register(const struct rpc_authops *); | 132 | int rpcauth_register(const struct rpc_authops *); |
132 | int rpcauth_unregister(const struct rpc_authops *); | 133 | int rpcauth_unregister(const struct rpc_authops *); |
133 | struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *); | 134 | struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *); |
diff --git a/include/linux/sunrpc/auth_gss.h b/include/linux/sunrpc/auth_gss.h index 8eee9dbbfe7a..f1cfd4c85cd0 100644 --- a/include/linux/sunrpc/auth_gss.h +++ b/include/linux/sunrpc/auth_gss.h | |||
@@ -82,8 +82,8 @@ struct gss_cred { | |||
82 | enum rpc_gss_svc gc_service; | 82 | enum rpc_gss_svc gc_service; |
83 | struct gss_cl_ctx __rcu *gc_ctx; | 83 | struct gss_cl_ctx __rcu *gc_ctx; |
84 | struct gss_upcall_msg *gc_upcall; | 84 | struct gss_upcall_msg *gc_upcall; |
85 | const char *gc_principal; | ||
85 | unsigned long gc_upcall_timestamp; | 86 | unsigned long gc_upcall_timestamp; |
86 | unsigned char gc_machine_cred : 1; | ||
87 | }; | 87 | }; |
88 | 88 | ||
89 | #endif /* __KERNEL__ */ | 89 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index a20970ef9e4e..af70af333546 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h | |||
@@ -191,6 +191,8 @@ extern int xdr_decode_array2(struct xdr_buf *buf, unsigned int base, | |||
191 | struct xdr_array2_desc *desc); | 191 | struct xdr_array2_desc *desc); |
192 | extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base, | 192 | extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base, |
193 | struct xdr_array2_desc *desc); | 193 | struct xdr_array2_desc *desc); |
194 | extern void _copy_from_pages(char *p, struct page **pages, size_t pgbase, | ||
195 | size_t len); | ||
194 | 196 | ||
195 | /* | 197 | /* |
196 | * Provide some simple tools for XDR buffer overflow-checking etc. | 198 | * Provide some simple tools for XDR buffer overflow-checking etc. |
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h index 445702c60d04..e872526fdc5f 100644 --- a/include/linux/swiotlb.h +++ b/include/linux/swiotlb.h | |||
@@ -24,7 +24,7 @@ extern int swiotlb_force; | |||
24 | 24 | ||
25 | extern void swiotlb_init(int verbose); | 25 | extern void swiotlb_init(int verbose); |
26 | extern void swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose); | 26 | extern void swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose); |
27 | extern unsigned long swioltb_nr_tbl(void); | 27 | extern unsigned long swiotlb_nr_tbl(void); |
28 | 28 | ||
29 | /* | 29 | /* |
30 | * Enumeration for sync targets | 30 | * Enumeration for sync targets |
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h index 5c75153f9441..d21b33c4c6ca 100644 --- a/include/linux/ucb1400.h +++ b/include/linux/ucb1400.h | |||
@@ -96,13 +96,11 @@ struct ucb1400_gpio { | |||
96 | 96 | ||
97 | struct ucb1400_ts { | 97 | struct ucb1400_ts { |
98 | struct input_dev *ts_idev; | 98 | struct input_dev *ts_idev; |
99 | struct task_struct *ts_task; | ||
100 | int id; | 99 | int id; |
101 | wait_queue_head_t ts_wait; | ||
102 | unsigned int ts_restart:1; | ||
103 | int irq; | 100 | int irq; |
104 | unsigned int irq_pending; /* not bit field shared */ | ||
105 | struct snd_ac97 *ac97; | 101 | struct snd_ac97 *ac97; |
102 | wait_queue_head_t ts_wait; | ||
103 | bool stopped; | ||
106 | }; | 104 | }; |
107 | 105 | ||
108 | struct ucb1400 { | 106 | struct ucb1400 { |
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h index 111843f88b2a..43ba5b3ce2a3 100644 --- a/include/linux/watchdog.h +++ b/include/linux/watchdog.h | |||
@@ -53,11 +53,7 @@ struct watchdog_info { | |||
53 | 53 | ||
54 | #ifdef __KERNEL__ | 54 | #ifdef __KERNEL__ |
55 | 55 | ||
56 | #ifdef CONFIG_WATCHDOG_NOWAYOUT | 56 | #include <linux/bitops.h> |
57 | #define WATCHDOG_NOWAYOUT 1 | ||
58 | #else | ||
59 | #define WATCHDOG_NOWAYOUT 0 | ||
60 | #endif | ||
61 | 57 | ||
62 | struct watchdog_ops; | 58 | struct watchdog_ops; |
63 | struct watchdog_device; | 59 | struct watchdog_device; |
@@ -122,6 +118,21 @@ struct watchdog_device { | |||
122 | #define WDOG_NO_WAY_OUT 3 /* Is 'nowayout' feature set ? */ | 118 | #define WDOG_NO_WAY_OUT 3 /* Is 'nowayout' feature set ? */ |
123 | }; | 119 | }; |
124 | 120 | ||
121 | #ifdef CONFIG_WATCHDOG_NOWAYOUT | ||
122 | #define WATCHDOG_NOWAYOUT 1 | ||
123 | #define WATCHDOG_NOWAYOUT_INIT_STATUS (1 << WDOG_NO_WAY_OUT) | ||
124 | #else | ||
125 | #define WATCHDOG_NOWAYOUT 0 | ||
126 | #define WATCHDOG_NOWAYOUT_INIT_STATUS 0 | ||
127 | #endif | ||
128 | |||
129 | /* Use the following function to set the nowayout feature */ | ||
130 | static inline void watchdog_set_nowayout(struct watchdog_device *wdd, int nowayout) | ||
131 | { | ||
132 | if (nowayout) | ||
133 | set_bit(WDOG_NO_WAY_OUT, &wdd->status); | ||
134 | } | ||
135 | |||
125 | /* Use the following functions to manipulate watchdog driver specific data */ | 136 | /* Use the following functions to manipulate watchdog driver specific data */ |
126 | static inline void watchdog_set_drvdata(struct watchdog_device *wdd, void *data) | 137 | static inline void watchdog_set_drvdata(struct watchdog_device *wdd, void *data) |
127 | { | 138 | { |
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h index 1a7e1d20adf9..36eace03b2ac 100644 --- a/include/mtd/mtd-abi.h +++ b/include/mtd/mtd-abi.h | |||
@@ -198,7 +198,8 @@ struct otp_info { | |||
198 | #define MEMISLOCKED _IOR('M', 23, struct erase_info_user) | 198 | #define MEMISLOCKED _IOR('M', 23, struct erase_info_user) |
199 | /* | 199 | /* |
200 | * Most generic write interface; can write in-band and/or out-of-band in various | 200 | * Most generic write interface; can write in-band and/or out-of-band in various |
201 | * modes (see "struct mtd_write_req") | 201 | * modes (see "struct mtd_write_req"). This ioctl is not supported for flashes |
202 | * without OOB, e.g., NOR flash. | ||
202 | */ | 203 | */ |
203 | #define MEMWRITE _IOWR('M', 24, struct mtd_write_req) | 204 | #define MEMWRITE _IOWR('M', 24, struct mtd_write_req) |
204 | 205 | ||
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h index 2d70b95b3b55..7184853ca360 100644 --- a/include/net/9p/9p.h +++ b/include/net/9p/9p.h | |||
@@ -63,30 +63,16 @@ enum p9_debug_flags { | |||
63 | 63 | ||
64 | #ifdef CONFIG_NET_9P_DEBUG | 64 | #ifdef CONFIG_NET_9P_DEBUG |
65 | extern unsigned int p9_debug_level; | 65 | extern unsigned int p9_debug_level; |
66 | 66 | __printf(3, 4) | |
67 | #define P9_DPRINTK(level, format, arg...) \ | 67 | void _p9_debug(enum p9_debug_flags level, const char *func, |
68 | do { \ | 68 | const char *fmt, ...); |
69 | if ((p9_debug_level & level) == level) {\ | 69 | #define p9_debug(level, fmt, ...) \ |
70 | if (level == P9_DEBUG_9P) \ | 70 | _p9_debug(level, __func__, fmt, ##__VA_ARGS__) |
71 | printk(KERN_NOTICE "(%8.8d) " \ | ||
72 | format , task_pid_nr(current) , ## arg); \ | ||
73 | else \ | ||
74 | printk(KERN_NOTICE "-- %s (%d): " \ | ||
75 | format , __func__, task_pid_nr(current) , ## arg); \ | ||
76 | } \ | ||
77 | } while (0) | ||
78 | |||
79 | #else | 71 | #else |
80 | #define P9_DPRINTK(level, format, arg...) do { } while (0) | 72 | #define p9_debug(level, fmt, ...) \ |
73 | no_printk(fmt, ##__VA_ARGS__) | ||
81 | #endif | 74 | #endif |
82 | 75 | ||
83 | |||
84 | #define P9_EPRINTK(level, format, arg...) \ | ||
85 | do { \ | ||
86 | printk(level "9p: %s (%d): " \ | ||
87 | format , __func__, task_pid_nr(current), ## arg); \ | ||
88 | } while (0) | ||
89 | |||
90 | /** | 76 | /** |
91 | * enum p9_msg_t - 9P message types | 77 | * enum p9_msg_t - 9P message types |
92 | * @P9_TLERROR: not used | 78 | * @P9_TLERROR: not used |
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 5591ed54dc93..77273f2fdd80 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h | |||
@@ -185,7 +185,6 @@ typedef void (*activate_complete)(void *, int); | |||
185 | struct scsi_device_handler { | 185 | struct scsi_device_handler { |
186 | /* Used by the infrastructure */ | 186 | /* Used by the infrastructure */ |
187 | struct list_head list; /* list of scsi_device_handlers */ | 187 | struct list_head list; /* list of scsi_device_handlers */ |
188 | int idx; | ||
189 | 188 | ||
190 | /* Filled by the hardware handler */ | 189 | /* Filled by the hardware handler */ |
191 | struct module *module; | 190 | struct module *module; |
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 50266c9405fc..5f7d5b3b1c6e 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
@@ -669,6 +669,9 @@ struct Scsi_Host { | |||
669 | /* Asynchronous scan in progress */ | 669 | /* Asynchronous scan in progress */ |
670 | unsigned async_scan:1; | 670 | unsigned async_scan:1; |
671 | 671 | ||
672 | /* Don't resume host in EH */ | ||
673 | unsigned eh_noresume:1; | ||
674 | |||
672 | /* | 675 | /* |
673 | * Optional work queue to be utilized by the transport | 676 | * Optional work queue to be utilized by the transport |
674 | */ | 677 | */ |
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index 87f34c3d447d..2c3a46d102fd 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h | |||
@@ -211,6 +211,11 @@ struct iscsi_cls_session { | |||
211 | unsigned int target_id; | 211 | unsigned int target_id; |
212 | bool ida_used; | 212 | bool ida_used; |
213 | 213 | ||
214 | /* | ||
215 | * pid of userspace process that created session or -1 if | ||
216 | * created by the kernel. | ||
217 | */ | ||
218 | pid_t creator; | ||
214 | int state; | 219 | int state; |
215 | int sid; /* session id */ | 220 | int sid; /* session id */ |
216 | void *dd_data; /* LLD private data */ | 221 | void *dd_data; /* LLD private data */ |
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h index 748ff7cbe555..319538bf17d2 100644 --- a/include/trace/events/ext4.h +++ b/include/trace/events/ext4.h | |||
@@ -573,9 +573,9 @@ TRACE_EVENT(ext4_mb_release_inode_pa, | |||
573 | ); | 573 | ); |
574 | 574 | ||
575 | TRACE_EVENT(ext4_mb_release_group_pa, | 575 | TRACE_EVENT(ext4_mb_release_group_pa, |
576 | TP_PROTO(struct ext4_prealloc_space *pa), | 576 | TP_PROTO(struct super_block *sb, struct ext4_prealloc_space *pa), |
577 | 577 | ||
578 | TP_ARGS(pa), | 578 | TP_ARGS(sb, pa), |
579 | 579 | ||
580 | TP_STRUCT__entry( | 580 | TP_STRUCT__entry( |
581 | __field( dev_t, dev ) | 581 | __field( dev_t, dev ) |
@@ -585,7 +585,7 @@ TRACE_EVENT(ext4_mb_release_group_pa, | |||
585 | ), | 585 | ), |
586 | 586 | ||
587 | TP_fast_assign( | 587 | TP_fast_assign( |
588 | __entry->dev = pa->pa_inode->i_sb->s_dev; | 588 | __entry->dev = sb->s_dev; |
589 | __entry->pa_pstart = pa->pa_pstart; | 589 | __entry->pa_pstart = pa->pa_pstart; |
590 | __entry->pa_len = pa->pa_len; | 590 | __entry->pa_len = pa->pa_len; |
591 | ), | 591 | ), |
diff --git a/include/xen/events.h b/include/xen/events.h index d287997d3eab..0f773708e02c 100644 --- a/include/xen/events.h +++ b/include/xen/events.h | |||
@@ -37,6 +37,13 @@ int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain, | |||
37 | */ | 37 | */ |
38 | void unbind_from_irqhandler(unsigned int irq, void *dev_id); | 38 | void unbind_from_irqhandler(unsigned int irq, void *dev_id); |
39 | 39 | ||
40 | /* | ||
41 | * Allow extra references to event channels exposed to userspace by evtchn | ||
42 | */ | ||
43 | int evtchn_make_refcounted(unsigned int evtchn); | ||
44 | int evtchn_get(unsigned int evtchn); | ||
45 | void evtchn_put(unsigned int evtchn); | ||
46 | |||
40 | void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector); | 47 | void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector); |
41 | int resend_irq_on_evtchn(unsigned int irq); | 48 | int resend_irq_on_evtchn(unsigned int irq); |
42 | void rebind_evtchn_irq(int evtchn, int irq); | 49 | void rebind_evtchn_irq(int evtchn, int irq); |
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h index 11e2dfce42f8..15f8a00ff003 100644 --- a/include/xen/grant_table.h +++ b/include/xen/grant_table.h | |||
@@ -62,6 +62,24 @@ int gnttab_resume(void); | |||
62 | 62 | ||
63 | int gnttab_grant_foreign_access(domid_t domid, unsigned long frame, | 63 | int gnttab_grant_foreign_access(domid_t domid, unsigned long frame, |
64 | int readonly); | 64 | int readonly); |
65 | int gnttab_grant_foreign_access_subpage(domid_t domid, unsigned long frame, | ||
66 | int flags, unsigned page_off, | ||
67 | unsigned length); | ||
68 | int gnttab_grant_foreign_access_trans(domid_t domid, int flags, | ||
69 | domid_t trans_domid, | ||
70 | grant_ref_t trans_gref); | ||
71 | |||
72 | /* | ||
73 | * Are sub-page grants available on this version of Xen? Returns true if they | ||
74 | * are, and false if they're not. | ||
75 | */ | ||
76 | bool gnttab_subpage_grants_available(void); | ||
77 | |||
78 | /* | ||
79 | * Are transitive grants available on this version of Xen? Returns true if they | ||
80 | * are, and false if they're not. | ||
81 | */ | ||
82 | bool gnttab_trans_grants_available(void); | ||
65 | 83 | ||
66 | /* | 84 | /* |
67 | * End access through the given grant reference, iff the grant entry is no | 85 | * End access through the given grant reference, iff the grant entry is no |
@@ -108,6 +126,13 @@ void gnttab_cancel_free_callback(struct gnttab_free_callback *callback); | |||
108 | 126 | ||
109 | void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid, | 127 | void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid, |
110 | unsigned long frame, int readonly); | 128 | unsigned long frame, int readonly); |
129 | int gnttab_grant_foreign_access_subpage_ref(grant_ref_t ref, domid_t domid, | ||
130 | unsigned long frame, int flags, | ||
131 | unsigned page_off, | ||
132 | unsigned length); | ||
133 | int gnttab_grant_foreign_access_trans_ref(grant_ref_t ref, domid_t domid, | ||
134 | int flags, domid_t trans_domid, | ||
135 | grant_ref_t trans_gref); | ||
111 | 136 | ||
112 | void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid, | 137 | void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid, |
113 | unsigned long pfn); | 138 | unsigned long pfn); |
@@ -145,9 +170,11 @@ gnttab_set_unmap_op(struct gnttab_unmap_grant_ref *unmap, phys_addr_t addr, | |||
145 | 170 | ||
146 | int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes, | 171 | int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes, |
147 | unsigned long max_nr_gframes, | 172 | unsigned long max_nr_gframes, |
148 | struct grant_entry **__shared); | 173 | void **__shared); |
149 | void arch_gnttab_unmap_shared(struct grant_entry *shared, | 174 | int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes, |
150 | unsigned long nr_gframes); | 175 | unsigned long max_nr_gframes, |
176 | grant_status_t **__shared); | ||
177 | void arch_gnttab_unmap(void *shared, unsigned long nr_gframes); | ||
151 | 178 | ||
152 | extern unsigned long xen_hvm_resume_frames; | 179 | extern unsigned long xen_hvm_resume_frames; |
153 | unsigned int gnttab_max_grant_frames(void); | 180 | unsigned int gnttab_max_grant_frames(void); |
@@ -155,9 +182,9 @@ unsigned int gnttab_max_grant_frames(void); | |||
155 | #define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr)) | 182 | #define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr)) |
156 | 183 | ||
157 | int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, | 184 | int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, |
158 | struct gnttab_map_grant_ref *kmap_ops, | 185 | struct gnttab_map_grant_ref *kmap_ops, |
159 | struct page **pages, unsigned int count); | 186 | struct page **pages, unsigned int count); |
160 | int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, | 187 | int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, |
161 | struct page **pages, unsigned int count); | 188 | struct page **pages, unsigned int count, bool clear_pte); |
162 | 189 | ||
163 | #endif /* __ASM_GNTTAB_H__ */ | 190 | #endif /* __ASM_GNTTAB_H__ */ |
diff --git a/include/xen/interface/grant_table.h b/include/xen/interface/grant_table.h index 39e571796e32..a17d84433e6a 100644 --- a/include/xen/interface/grant_table.h +++ b/include/xen/interface/grant_table.h | |||
@@ -85,12 +85,22 @@ | |||
85 | */ | 85 | */ |
86 | 86 | ||
87 | /* | 87 | /* |
88 | * Reference to a grant entry in a specified domain's grant table. | ||
89 | */ | ||
90 | typedef uint32_t grant_ref_t; | ||
91 | |||
92 | /* | ||
88 | * A grant table comprises a packed array of grant entries in one or more | 93 | * A grant table comprises a packed array of grant entries in one or more |
89 | * page frames shared between Xen and a guest. | 94 | * page frames shared between Xen and a guest. |
90 | * [XEN]: This field is written by Xen and read by the sharing guest. | 95 | * [XEN]: This field is written by Xen and read by the sharing guest. |
91 | * [GST]: This field is written by the guest and read by Xen. | 96 | * [GST]: This field is written by the guest and read by Xen. |
92 | */ | 97 | */ |
93 | struct grant_entry { | 98 | |
99 | /* | ||
100 | * Version 1 of the grant table entry structure is maintained purely | ||
101 | * for backwards compatibility. New guests should use version 2. | ||
102 | */ | ||
103 | struct grant_entry_v1 { | ||
94 | /* GTF_xxx: various type and flag information. [XEN,GST] */ | 104 | /* GTF_xxx: various type and flag information. [XEN,GST] */ |
95 | uint16_t flags; | 105 | uint16_t flags; |
96 | /* The domain being granted foreign privileges. [GST] */ | 106 | /* The domain being granted foreign privileges. [GST] */ |
@@ -108,10 +118,13 @@ struct grant_entry { | |||
108 | * GTF_permit_access: Allow @domid to map/access @frame. | 118 | * GTF_permit_access: Allow @domid to map/access @frame. |
109 | * GTF_accept_transfer: Allow @domid to transfer ownership of one page frame | 119 | * GTF_accept_transfer: Allow @domid to transfer ownership of one page frame |
110 | * to this guest. Xen writes the page number to @frame. | 120 | * to this guest. Xen writes the page number to @frame. |
121 | * GTF_transitive: Allow @domid to transitively access a subrange of | ||
122 | * @trans_grant in @trans_domid. No mappings are allowed. | ||
111 | */ | 123 | */ |
112 | #define GTF_invalid (0U<<0) | 124 | #define GTF_invalid (0U<<0) |
113 | #define GTF_permit_access (1U<<0) | 125 | #define GTF_permit_access (1U<<0) |
114 | #define GTF_accept_transfer (2U<<0) | 126 | #define GTF_accept_transfer (2U<<0) |
127 | #define GTF_transitive (3U<<0) | ||
115 | #define GTF_type_mask (3U<<0) | 128 | #define GTF_type_mask (3U<<0) |
116 | 129 | ||
117 | /* | 130 | /* |
@@ -119,6 +132,9 @@ struct grant_entry { | |||
119 | * GTF_readonly: Restrict @domid to read-only mappings and accesses. [GST] | 132 | * GTF_readonly: Restrict @domid to read-only mappings and accesses. [GST] |
120 | * GTF_reading: Grant entry is currently mapped for reading by @domid. [XEN] | 133 | * GTF_reading: Grant entry is currently mapped for reading by @domid. [XEN] |
121 | * GTF_writing: Grant entry is currently mapped for writing by @domid. [XEN] | 134 | * GTF_writing: Grant entry is currently mapped for writing by @domid. [XEN] |
135 | * GTF_sub_page: Grant access to only a subrange of the page. @domid | ||
136 | * will only be allowed to copy from the grant, and not | ||
137 | * map it. [GST] | ||
122 | */ | 138 | */ |
123 | #define _GTF_readonly (2) | 139 | #define _GTF_readonly (2) |
124 | #define GTF_readonly (1U<<_GTF_readonly) | 140 | #define GTF_readonly (1U<<_GTF_readonly) |
@@ -126,6 +142,8 @@ struct grant_entry { | |||
126 | #define GTF_reading (1U<<_GTF_reading) | 142 | #define GTF_reading (1U<<_GTF_reading) |
127 | #define _GTF_writing (4) | 143 | #define _GTF_writing (4) |
128 | #define GTF_writing (1U<<_GTF_writing) | 144 | #define GTF_writing (1U<<_GTF_writing) |
145 | #define _GTF_sub_page (8) | ||
146 | #define GTF_sub_page (1U<<_GTF_sub_page) | ||
129 | 147 | ||
130 | /* | 148 | /* |
131 | * Subflags for GTF_accept_transfer: | 149 | * Subflags for GTF_accept_transfer: |
@@ -142,15 +160,81 @@ struct grant_entry { | |||
142 | #define _GTF_transfer_completed (3) | 160 | #define _GTF_transfer_completed (3) |
143 | #define GTF_transfer_completed (1U<<_GTF_transfer_completed) | 161 | #define GTF_transfer_completed (1U<<_GTF_transfer_completed) |
144 | 162 | ||
163 | /* | ||
164 | * Version 2 grant table entries. These fulfil the same role as | ||
165 | * version 1 entries, but can represent more complicated operations. | ||
166 | * Any given domain will have either a version 1 or a version 2 table, | ||
167 | * and every entry in the table will be the same version. | ||
168 | * | ||
169 | * The interface by which domains use grant references does not depend | ||
170 | * on the grant table version in use by the other domain. | ||
171 | */ | ||
145 | 172 | ||
146 | /*********************************** | 173 | /* |
147 | * GRANT TABLE QUERIES AND USES | 174 | * Version 1 and version 2 grant entries share a common prefix. The |
175 | * fields of the prefix are documented as part of struct | ||
176 | * grant_entry_v1. | ||
148 | */ | 177 | */ |
178 | struct grant_entry_header { | ||
179 | uint16_t flags; | ||
180 | domid_t domid; | ||
181 | }; | ||
149 | 182 | ||
150 | /* | 183 | /* |
151 | * Reference to a grant entry in a specified domain's grant table. | 184 | * Version 2 of the grant entry structure, here is an union because three |
185 | * different types are suppotted: full_page, sub_page and transitive. | ||
186 | */ | ||
187 | union grant_entry_v2 { | ||
188 | struct grant_entry_header hdr; | ||
189 | |||
190 | /* | ||
191 | * This member is used for V1-style full page grants, where either: | ||
192 | * | ||
193 | * -- hdr.type is GTF_accept_transfer, or | ||
194 | * -- hdr.type is GTF_permit_access and GTF_sub_page is not set. | ||
195 | * | ||
196 | * In that case, the frame field has the same semantics as the | ||
197 | * field of the same name in the V1 entry structure. | ||
198 | */ | ||
199 | struct { | ||
200 | struct grant_entry_header hdr; | ||
201 | uint32_t pad0; | ||
202 | uint64_t frame; | ||
203 | } full_page; | ||
204 | |||
205 | /* | ||
206 | * If the grant type is GTF_grant_access and GTF_sub_page is set, | ||
207 | * @domid is allowed to access bytes [@page_off,@page_off+@length) | ||
208 | * in frame @frame. | ||
209 | */ | ||
210 | struct { | ||
211 | struct grant_entry_header hdr; | ||
212 | uint16_t page_off; | ||
213 | uint16_t length; | ||
214 | uint64_t frame; | ||
215 | } sub_page; | ||
216 | |||
217 | /* | ||
218 | * If the grant is GTF_transitive, @domid is allowed to use the | ||
219 | * grant @gref in domain @trans_domid, as if it was the local | ||
220 | * domain. Obviously, the transitive access must be compatible | ||
221 | * with the original grant. | ||
222 | */ | ||
223 | struct { | ||
224 | struct grant_entry_header hdr; | ||
225 | domid_t trans_domid; | ||
226 | uint16_t pad0; | ||
227 | grant_ref_t gref; | ||
228 | } transitive; | ||
229 | |||
230 | uint32_t __spacer[4]; /* Pad to a power of two */ | ||
231 | }; | ||
232 | |||
233 | typedef uint16_t grant_status_t; | ||
234 | |||
235 | /*********************************** | ||
236 | * GRANT TABLE QUERIES AND USES | ||
152 | */ | 237 | */ |
153 | typedef uint32_t grant_ref_t; | ||
154 | 238 | ||
155 | /* | 239 | /* |
156 | * Handle to track a mapping created via a grant reference. | 240 | * Handle to track a mapping created via a grant reference. |
@@ -322,6 +406,79 @@ struct gnttab_query_size { | |||
322 | DEFINE_GUEST_HANDLE_STRUCT(gnttab_query_size); | 406 | DEFINE_GUEST_HANDLE_STRUCT(gnttab_query_size); |
323 | 407 | ||
324 | /* | 408 | /* |
409 | * GNTTABOP_unmap_and_replace: Destroy one or more grant-reference mappings | ||
410 | * tracked by <handle> but atomically replace the page table entry with one | ||
411 | * pointing to the machine address under <new_addr>. <new_addr> will be | ||
412 | * redirected to the null entry. | ||
413 | * NOTES: | ||
414 | * 1. The call may fail in an undefined manner if either mapping is not | ||
415 | * tracked by <handle>. | ||
416 | * 2. After executing a batch of unmaps, it is guaranteed that no stale | ||
417 | * mappings will remain in the device or host TLBs. | ||
418 | */ | ||
419 | #define GNTTABOP_unmap_and_replace 7 | ||
420 | struct gnttab_unmap_and_replace { | ||
421 | /* IN parameters. */ | ||
422 | uint64_t host_addr; | ||
423 | uint64_t new_addr; | ||
424 | grant_handle_t handle; | ||
425 | /* OUT parameters. */ | ||
426 | int16_t status; /* GNTST_* */ | ||
427 | }; | ||
428 | DEFINE_GUEST_HANDLE_STRUCT(gnttab_unmap_and_replace); | ||
429 | |||
430 | /* | ||
431 | * GNTTABOP_set_version: Request a particular version of the grant | ||
432 | * table shared table structure. This operation can only be performed | ||
433 | * once in any given domain. It must be performed before any grants | ||
434 | * are activated; otherwise, the domain will be stuck with version 1. | ||
435 | * The only defined versions are 1 and 2. | ||
436 | */ | ||
437 | #define GNTTABOP_set_version 8 | ||
438 | struct gnttab_set_version { | ||
439 | /* IN parameters */ | ||
440 | uint32_t version; | ||
441 | }; | ||
442 | DEFINE_GUEST_HANDLE_STRUCT(gnttab_set_version); | ||
443 | |||
444 | /* | ||
445 | * GNTTABOP_get_status_frames: Get the list of frames used to store grant | ||
446 | * status for <dom>. In grant format version 2, the status is separated | ||
447 | * from the other shared grant fields to allow more efficient synchronization | ||
448 | * using barriers instead of atomic cmpexch operations. | ||
449 | * <nr_frames> specify the size of vector <frame_list>. | ||
450 | * The frame addresses are returned in the <frame_list>. | ||
451 | * Only <nr_frames> addresses are returned, even if the table is larger. | ||
452 | * NOTES: | ||
453 | * 1. <dom> may be specified as DOMID_SELF. | ||
454 | * 2. Only a sufficiently-privileged domain may specify <dom> != DOMID_SELF. | ||
455 | */ | ||
456 | #define GNTTABOP_get_status_frames 9 | ||
457 | struct gnttab_get_status_frames { | ||
458 | /* IN parameters. */ | ||
459 | uint32_t nr_frames; | ||
460 | domid_t dom; | ||
461 | /* OUT parameters. */ | ||
462 | int16_t status; /* GNTST_* */ | ||
463 | GUEST_HANDLE(uint64_t) frame_list; | ||
464 | }; | ||
465 | DEFINE_GUEST_HANDLE_STRUCT(gnttab_get_status_frames); | ||
466 | |||
467 | /* | ||
468 | * GNTTABOP_get_version: Get the grant table version which is in | ||
469 | * effect for domain <dom>. | ||
470 | */ | ||
471 | #define GNTTABOP_get_version 10 | ||
472 | struct gnttab_get_version { | ||
473 | /* IN parameters */ | ||
474 | domid_t dom; | ||
475 | uint16_t pad; | ||
476 | /* OUT parameters */ | ||
477 | uint32_t version; | ||
478 | }; | ||
479 | DEFINE_GUEST_HANDLE_STRUCT(gnttab_get_version); | ||
480 | |||
481 | /* | ||
325 | * Bitfield values for update_pin_status.flags. | 482 | * Bitfield values for update_pin_status.flags. |
326 | */ | 483 | */ |
327 | /* Map the grant entry for access by I/O devices. */ | 484 | /* Map the grant entry for access by I/O devices. */ |
diff --git a/include/xen/interface/io/xs_wire.h b/include/xen/interface/io/xs_wire.h index f6f07aa35af5..7cdfca24eafb 100644 --- a/include/xen/interface/io/xs_wire.h +++ b/include/xen/interface/io/xs_wire.h | |||
@@ -87,4 +87,7 @@ struct xenstore_domain_interface { | |||
87 | XENSTORE_RING_IDX rsp_cons, rsp_prod; | 87 | XENSTORE_RING_IDX rsp_cons, rsp_prod; |
88 | }; | 88 | }; |
89 | 89 | ||
90 | /* Violating this is very bad. See docs/misc/xenstore.txt. */ | ||
91 | #define XENSTORE_PAYLOAD_MAX 4096 | ||
92 | |||
90 | #endif /* _XS_WIRE_H */ | 93 | #endif /* _XS_WIRE_H */ |
diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h index 6a6e91449347..a890804945e3 100644 --- a/include/xen/interface/xen.h +++ b/include/xen/interface/xen.h | |||
@@ -523,6 +523,8 @@ struct tmem_op { | |||
523 | } u; | 523 | } u; |
524 | }; | 524 | }; |
525 | 525 | ||
526 | DEFINE_GUEST_HANDLE(u64); | ||
527 | |||
526 | #else /* __ASSEMBLY__ */ | 528 | #else /* __ASSEMBLY__ */ |
527 | 529 | ||
528 | /* In assembly code we cannot use C numeric constant suffixes. */ | 530 | /* In assembly code we cannot use C numeric constant suffixes. */ |
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h index b1b6676c1c43..e8c599b237c2 100644 --- a/include/xen/xenbus.h +++ b/include/xen/xenbus.h | |||
@@ -85,8 +85,6 @@ struct xenbus_device_id | |||
85 | 85 | ||
86 | /* A xenbus driver. */ | 86 | /* A xenbus driver. */ |
87 | struct xenbus_driver { | 87 | struct xenbus_driver { |
88 | char *name; | ||
89 | struct module *owner; | ||
90 | const struct xenbus_device_id *ids; | 88 | const struct xenbus_device_id *ids; |
91 | int (*probe)(struct xenbus_device *dev, | 89 | int (*probe)(struct xenbus_device *dev, |
92 | const struct xenbus_device_id *id); | 90 | const struct xenbus_device_id *id); |
@@ -101,31 +99,20 @@ struct xenbus_driver { | |||
101 | int (*is_ready)(struct xenbus_device *dev); | 99 | int (*is_ready)(struct xenbus_device *dev); |
102 | }; | 100 | }; |
103 | 101 | ||
104 | static inline struct xenbus_driver *to_xenbus_driver(struct device_driver *drv) | 102 | #define DEFINE_XENBUS_DRIVER(var, drvname, methods...) \ |
105 | { | 103 | struct xenbus_driver var ## _driver = { \ |
106 | return container_of(drv, struct xenbus_driver, driver); | 104 | .driver.name = drvname + 0 ?: var ## _ids->devicetype, \ |
105 | .driver.owner = THIS_MODULE, \ | ||
106 | .ids = var ## _ids, ## methods \ | ||
107 | } | 107 | } |
108 | 108 | ||
109 | int __must_check __xenbus_register_frontend(struct xenbus_driver *drv, | 109 | static inline struct xenbus_driver *to_xenbus_driver(struct device_driver *drv) |
110 | struct module *owner, | ||
111 | const char *mod_name); | ||
112 | |||
113 | static inline int __must_check | ||
114 | xenbus_register_frontend(struct xenbus_driver *drv) | ||
115 | { | 110 | { |
116 | WARN_ON(drv->owner != THIS_MODULE); | 111 | return container_of(drv, struct xenbus_driver, driver); |
117 | return __xenbus_register_frontend(drv, THIS_MODULE, KBUILD_MODNAME); | ||
118 | } | 112 | } |
119 | 113 | ||
120 | int __must_check __xenbus_register_backend(struct xenbus_driver *drv, | 114 | int __must_check xenbus_register_frontend(struct xenbus_driver *); |
121 | struct module *owner, | 115 | int __must_check xenbus_register_backend(struct xenbus_driver *); |
122 | const char *mod_name); | ||
123 | static inline int __must_check | ||
124 | xenbus_register_backend(struct xenbus_driver *drv) | ||
125 | { | ||
126 | WARN_ON(drv->owner != THIS_MODULE); | ||
127 | return __xenbus_register_backend(drv, THIS_MODULE, KBUILD_MODNAME); | ||
128 | } | ||
129 | 116 | ||
130 | void xenbus_unregister_driver(struct xenbus_driver *drv); | 117 | void xenbus_unregister_driver(struct xenbus_driver *drv); |
131 | 118 | ||
diff --git a/include/xen/xenbus_dev.h b/include/xen/xenbus_dev.h new file mode 100644 index 000000000000..ac5f0fe47ed9 --- /dev/null +++ b/include/xen/xenbus_dev.h | |||
@@ -0,0 +1,41 @@ | |||
1 | /****************************************************************************** | ||
2 | * evtchn.h | ||
3 | * | ||
4 | * Interface to /dev/xen/xenbus_backend. | ||
5 | * | ||
6 | * Copyright (c) 2011 Bastian Blank <waldi@debian.org> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License version 2 | ||
10 | * as published by the Free Software Foundation; or, when distributed | ||
11 | * separately from the Linux kernel or incorporated into other | ||
12 | * software packages, subject to the following license: | ||
13 | * | ||
14 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
15 | * of this source file (the "Software"), to deal in the Software without | ||
16 | * restriction, including without limitation the rights to use, copy, modify, | ||
17 | * merge, publish, distribute, sublicense, and/or sell copies of the Software, | ||
18 | * and to permit persons to whom the Software is furnished to do so, subject to | ||
19 | * the following conditions: | ||
20 | * | ||
21 | * The above copyright notice and this permission notice shall be included in | ||
22 | * all copies or substantial portions of the Software. | ||
23 | * | ||
24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
25 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
26 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
27 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
28 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
29 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
30 | * IN THE SOFTWARE. | ||
31 | */ | ||
32 | |||
33 | #ifndef __LINUX_XEN_XENBUS_DEV_H__ | ||
34 | #define __LINUX_XEN_XENBUS_DEV_H__ | ||
35 | |||
36 | #include <linux/ioctl.h> | ||
37 | |||
38 | #define IOCTL_XENBUS_BACKEND_EVTCHN \ | ||
39 | _IOC(_IOC_NONE, 'B', 0, 0) | ||
40 | |||
41 | #endif /* __LINUX_XEN_XENBUS_DEV_H__ */ | ||