diff options
author | Bob Moore <robert.moore@intel.com> | 2012-02-14 05:29:55 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2012-03-22 01:44:54 -0400 |
commit | 653f4b538f66d37db560e0f56af08117136d29b7 (patch) | |
tree | 1728249946368a4befa5ade048bafeba9d9fddce /drivers/acpi/osl.c | |
parent | 33620c5419e8a11814dd11e02a80e6ef77a43407 (diff) |
ACPICA: Expand OSL memory read/write interfaces to 64 bits
This change expands acpi_os_read_memory and acpi_os_write_memory to a
full 64 bits. This allows 64 bit transfers via the acpi_read and
acpi_write interfaces. Note: The internal acpi_hw_read and acpi_hw_write
interfaces remain at 32 bits, because 64 bits is not needed to
access the standard ACPI registers.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/osl.c')
-rw-r--r-- | drivers/acpi/osl.c | 86 |
1 files changed, 2 insertions, 84 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 412a1e04a922..1dea025e4e98 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -699,49 +699,6 @@ acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width) | |||
699 | 699 | ||
700 | EXPORT_SYMBOL(acpi_os_write_port); | 700 | EXPORT_SYMBOL(acpi_os_write_port); |
701 | 701 | ||
702 | acpi_status | ||
703 | acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width) | ||
704 | { | ||
705 | void __iomem *virt_addr; | ||
706 | unsigned int size = width / 8; | ||
707 | bool unmap = false; | ||
708 | u32 dummy; | ||
709 | |||
710 | rcu_read_lock(); | ||
711 | virt_addr = acpi_map_vaddr_lookup(phys_addr, size); | ||
712 | if (!virt_addr) { | ||
713 | rcu_read_unlock(); | ||
714 | virt_addr = acpi_os_ioremap(phys_addr, size); | ||
715 | if (!virt_addr) | ||
716 | return AE_BAD_ADDRESS; | ||
717 | unmap = true; | ||
718 | } | ||
719 | |||
720 | if (!value) | ||
721 | value = &dummy; | ||
722 | |||
723 | switch (width) { | ||
724 | case 8: | ||
725 | *(u8 *) value = readb(virt_addr); | ||
726 | break; | ||
727 | case 16: | ||
728 | *(u16 *) value = readw(virt_addr); | ||
729 | break; | ||
730 | case 32: | ||
731 | *(u32 *) value = readl(virt_addr); | ||
732 | break; | ||
733 | default: | ||
734 | BUG(); | ||
735 | } | ||
736 | |||
737 | if (unmap) | ||
738 | iounmap(virt_addr); | ||
739 | else | ||
740 | rcu_read_unlock(); | ||
741 | |||
742 | return AE_OK; | ||
743 | } | ||
744 | |||
745 | #ifdef readq | 702 | #ifdef readq |
746 | static inline u64 read64(const volatile void __iomem *addr) | 703 | static inline u64 read64(const volatile void __iomem *addr) |
747 | { | 704 | { |
@@ -758,7 +715,7 @@ static inline u64 read64(const volatile void __iomem *addr) | |||
758 | #endif | 715 | #endif |
759 | 716 | ||
760 | acpi_status | 717 | acpi_status |
761 | acpi_os_read_memory64(acpi_physical_address phys_addr, u64 *value, u32 width) | 718 | acpi_os_read_memory(acpi_physical_address phys_addr, u64 *value, u32 width) |
762 | { | 719 | { |
763 | void __iomem *virt_addr; | 720 | void __iomem *virt_addr; |
764 | unsigned int size = width / 8; | 721 | unsigned int size = width / 8; |
@@ -803,45 +760,6 @@ acpi_os_read_memory64(acpi_physical_address phys_addr, u64 *value, u32 width) | |||
803 | return AE_OK; | 760 | return AE_OK; |
804 | } | 761 | } |
805 | 762 | ||
806 | acpi_status | ||
807 | acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) | ||
808 | { | ||
809 | void __iomem *virt_addr; | ||
810 | unsigned int size = width / 8; | ||
811 | bool unmap = false; | ||
812 | |||
813 | rcu_read_lock(); | ||
814 | virt_addr = acpi_map_vaddr_lookup(phys_addr, size); | ||
815 | if (!virt_addr) { | ||
816 | rcu_read_unlock(); | ||
817 | virt_addr = acpi_os_ioremap(phys_addr, size); | ||
818 | if (!virt_addr) | ||
819 | return AE_BAD_ADDRESS; | ||
820 | unmap = true; | ||
821 | } | ||
822 | |||
823 | switch (width) { | ||
824 | case 8: | ||
825 | writeb(value, virt_addr); | ||
826 | break; | ||
827 | case 16: | ||
828 | writew(value, virt_addr); | ||
829 | break; | ||
830 | case 32: | ||
831 | writel(value, virt_addr); | ||
832 | break; | ||
833 | default: | ||
834 | BUG(); | ||
835 | } | ||
836 | |||
837 | if (unmap) | ||
838 | iounmap(virt_addr); | ||
839 | else | ||
840 | rcu_read_unlock(); | ||
841 | |||
842 | return AE_OK; | ||
843 | } | ||
844 | |||
845 | #ifdef writeq | 763 | #ifdef writeq |
846 | static inline void write64(u64 val, volatile void __iomem *addr) | 764 | static inline void write64(u64 val, volatile void __iomem *addr) |
847 | { | 765 | { |
@@ -856,7 +774,7 @@ static inline void write64(u64 val, volatile void __iomem *addr) | |||
856 | #endif | 774 | #endif |
857 | 775 | ||
858 | acpi_status | 776 | acpi_status |
859 | acpi_os_write_memory64(acpi_physical_address phys_addr, u64 value, u32 width) | 777 | acpi_os_write_memory(acpi_physical_address phys_addr, u64 value, u32 width) |
860 | { | 778 | { |
861 | void __iomem *virt_addr; | 779 | void __iomem *virt_addr; |
862 | unsigned int size = width / 8; | 780 | unsigned int size = width / 8; |