| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * PS3 system bus driver. |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2006 Sony Computer Entertainment Inc. |
|---|
| 5 | 6 | * Copyright 2006 Sony Corp. |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 9 | | - * the Free Software Foundation; version 2 of the License. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | | - * GNU General Public License for more details. |
|---|
| 15 | | - * |
|---|
| 16 | | - * You should have received a copy of the GNU General Public License |
|---|
| 17 | | - * along with this program; if not, write to the Free Software |
|---|
| 18 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 19 | 7 | */ |
|---|
| 20 | 8 | |
|---|
| 21 | 9 | #include <linux/kernel.h> |
|---|
| 22 | 10 | #include <linux/init.h> |
|---|
| 23 | 11 | #include <linux/export.h> |
|---|
| 24 | | -#include <linux/dma-mapping.h> |
|---|
| 12 | +#include <linux/dma-map-ops.h> |
|---|
| 25 | 13 | #include <linux/err.h> |
|---|
| 26 | 14 | #include <linux/slab.h> |
|---|
| 27 | 15 | |
|---|
| .. | .. |
|---|
| 37 | 25 | }; |
|---|
| 38 | 26 | |
|---|
| 39 | 27 | /* FIXME: need device usage counters! */ |
|---|
| 40 | | -struct { |
|---|
| 28 | +static struct { |
|---|
| 41 | 29 | struct mutex mutex; |
|---|
| 42 | 30 | int sb_11; /* usb 0 */ |
|---|
| 43 | 31 | int sb_12; /* usb 0 */ |
|---|
| 44 | 32 | int gpu; |
|---|
| 45 | | -} static usage_hack; |
|---|
| 33 | +} usage_hack; |
|---|
| 46 | 34 | |
|---|
| 47 | 35 | static int ps3_is_device(struct ps3_system_bus_device *dev, u64 bus_id, |
|---|
| 48 | 36 | u64 dev_id) |
|---|
| .. | .. |
|---|
| 698 | 686 | return mask >= DMA_BIT_MASK(32); |
|---|
| 699 | 687 | } |
|---|
| 700 | 688 | |
|---|
| 701 | | -static u64 ps3_dma_get_required_mask(struct device *_dev) |
|---|
| 702 | | -{ |
|---|
| 703 | | - return DMA_BIT_MASK(32); |
|---|
| 704 | | -} |
|---|
| 705 | | - |
|---|
| 706 | 689 | static const struct dma_map_ops ps3_sb_dma_ops = { |
|---|
| 707 | 690 | .alloc = ps3_alloc_coherent, |
|---|
| 708 | 691 | .free = ps3_free_coherent, |
|---|
| 709 | 692 | .map_sg = ps3_sb_map_sg, |
|---|
| 710 | 693 | .unmap_sg = ps3_sb_unmap_sg, |
|---|
| 711 | 694 | .dma_supported = ps3_dma_supported, |
|---|
| 712 | | - .get_required_mask = ps3_dma_get_required_mask, |
|---|
| 713 | 695 | .map_page = ps3_sb_map_page, |
|---|
| 714 | 696 | .unmap_page = ps3_unmap_page, |
|---|
| 697 | + .mmap = dma_common_mmap, |
|---|
| 698 | + .get_sgtable = dma_common_get_sgtable, |
|---|
| 699 | + .alloc_pages = dma_common_alloc_pages, |
|---|
| 700 | + .free_pages = dma_common_free_pages, |
|---|
| 715 | 701 | }; |
|---|
| 716 | 702 | |
|---|
| 717 | 703 | static const struct dma_map_ops ps3_ioc0_dma_ops = { |
|---|
| .. | .. |
|---|
| 720 | 706 | .map_sg = ps3_ioc0_map_sg, |
|---|
| 721 | 707 | .unmap_sg = ps3_ioc0_unmap_sg, |
|---|
| 722 | 708 | .dma_supported = ps3_dma_supported, |
|---|
| 723 | | - .get_required_mask = ps3_dma_get_required_mask, |
|---|
| 724 | 709 | .map_page = ps3_ioc0_map_page, |
|---|
| 725 | 710 | .unmap_page = ps3_unmap_page, |
|---|
| 711 | + .mmap = dma_common_mmap, |
|---|
| 712 | + .get_sgtable = dma_common_get_sgtable, |
|---|
| 713 | + .alloc_pages = dma_common_alloc_pages, |
|---|
| 714 | + .free_pages = dma_common_free_pages, |
|---|
| 726 | 715 | }; |
|---|
| 727 | 716 | |
|---|
| 728 | 717 | /** |
|---|