Commit b5bd7cf7 authored by Ben Skeggs's avatar Ben Skeggs Committed by Danilo Krummrich

drm/nouveau/nvkm: remove detect/mmio/subdev_mask from device args

All callers now pass "detect=true, mmio=true, subdev_mask=~0ULL",
so remove the function arguments, and associated code.
Signed-off-by: default avatarBen Skeggs <bskeggs@nvidia.com>
Signed-off-by: default avatarDanilo Krummrich <dakr@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240726043828.58966-12-bskeggs@nvidia.com
parent 8bc1ab4f
...@@ -10,6 +10,5 @@ struct nvkm_device_pci { ...@@ -10,6 +10,5 @@ struct nvkm_device_pci {
}; };
int nvkm_device_pci_new(struct pci_dev *, const char *cfg, const char *dbg, int nvkm_device_pci_new(struct pci_dev *, const char *cfg, const char *dbg,
bool detect, bool mmio, u64 subdev_mask,
struct nvkm_device **); struct nvkm_device **);
#endif #endif
...@@ -51,6 +51,5 @@ struct nvkm_device_tegra_func { ...@@ -51,6 +51,5 @@ struct nvkm_device_tegra_func {
int nvkm_device_tegra_new(const struct nvkm_device_tegra_func *, int nvkm_device_tegra_new(const struct nvkm_device_tegra_func *,
struct platform_device *, struct platform_device *,
const char *cfg, const char *dbg, const char *cfg, const char *dbg,
bool detect, bool mmio, u64 subdev_mask,
struct nvkm_device **); struct nvkm_device **);
#endif #endif
...@@ -840,8 +840,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev, ...@@ -840,8 +840,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
/* We need to check that the chipset is supported before booting /* We need to check that the chipset is supported before booting
* fbdev off the hardware, as there's no way to put it back. * fbdev off the hardware, as there's no way to put it back.
*/ */
ret = nvkm_device_pci_new(pdev, nouveau_config, nouveau_debug, ret = nvkm_device_pci_new(pdev, nouveau_config, nouveau_debug, &device);
true, true, ~0ULL, &device);
if (ret) if (ret)
return ret; return ret;
...@@ -1387,8 +1386,7 @@ nouveau_platform_device_create(const struct nvkm_device_tegra_func *func, ...@@ -1387,8 +1386,7 @@ nouveau_platform_device_create(const struct nvkm_device_tegra_func *func,
struct nouveau_drm *drm; struct nouveau_drm *drm;
int err; int err;
err = nvkm_device_tegra_new(func, pdev, nouveau_config, nouveau_debug, err = nvkm_device_tegra_new(func, pdev, nouveau_config, nouveau_debug, pdevice);
true, true, ~0ULL, pdevice);
if (err) if (err)
goto err_free; goto err_free;
......
...@@ -67,12 +67,6 @@ nvkm_device_list(u64 *name, int size) ...@@ -67,12 +67,6 @@ nvkm_device_list(u64 *name, int size)
return nr; return nr;
} }
static const struct nvkm_device_chip
null_chipset = {
.name = "NULL",
.bios = { 0x00000001, nvkm_bios_new },
};
static const struct nvkm_device_chip static const struct nvkm_device_chip
nv4_chipset = { nv4_chipset = {
.name = "NV04", .name = "NV04",
...@@ -3104,7 +3098,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func, ...@@ -3104,7 +3098,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
const struct nvkm_device_quirk *quirk, const struct nvkm_device_quirk *quirk,
struct device *dev, enum nvkm_device_type type, u64 handle, struct device *dev, enum nvkm_device_type type, u64 handle,
const char *name, const char *cfg, const char *dbg, const char *name, const char *cfg, const char *dbg,
bool detect, bool mmio, u64 subdev_mask,
struct nvkm_device *device) struct nvkm_device *device)
{ {
struct nvkm_subdev *subdev; struct nvkm_subdev *subdev;
...@@ -3132,17 +3125,15 @@ nvkm_device_ctor(const struct nvkm_device_func *func, ...@@ -3132,17 +3125,15 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
mmio_base = device->func->resource_addr(device, 0); mmio_base = device->func->resource_addr(device, 0);
mmio_size = device->func->resource_size(device, 0); mmio_size = device->func->resource_size(device, 0);
if (detect || mmio) {
device->pri = ioremap(mmio_base, mmio_size); device->pri = ioremap(mmio_base, mmio_size);
if (device->pri == NULL) { if (device->pri == NULL) {
nvdev_error(device, "unable to map PRI\n"); nvdev_error(device, "unable to map PRI\n");
ret = -ENOMEM; ret = -ENOMEM;
goto done; goto done;
} }
}
/* identify the chipset, and determine classes of subdev/engines */ /* identify the chipset, and determine classes of subdev/engines */
if (detect) {
/* switch mmio to cpu's native endianness */ /* switch mmio to cpu's native endianness */
if (!nvkm_device_endianness(device)) { if (!nvkm_device_endianness(device)) {
nvdev_error(device, nvdev_error(device,
...@@ -3357,9 +3348,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func, ...@@ -3357,9 +3348,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
case 0x00400000: device->crystal = 27000; break; case 0x00400000: device->crystal = 27000; break;
case 0x00400040: device->crystal = 25000; break; case 0x00400040: device->crystal = 25000; break;
} }
} else {
device->chip = &null_chipset;
}
if (!device->name) if (!device->name)
device->name = device->chip->name; device->name = device->chip->name;
...@@ -3368,7 +3356,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func, ...@@ -3368,7 +3356,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
nvkm_intr_ctor(device); nvkm_intr_ctor(device);
#define NVKM_LAYOUT_ONCE(type,data,ptr) \ #define NVKM_LAYOUT_ONCE(type,data,ptr) \
if (device->chip->ptr.inst && (subdev_mask & (BIT_ULL(type)))) { \ if (device->chip->ptr.inst) { \
WARN_ON(device->chip->ptr.inst != 0x00000001); \ WARN_ON(device->chip->ptr.inst != 0x00000001); \
ret = device->chip->ptr.ctor(device, (type), -1, &device->ptr); \ ret = device->chip->ptr.ctor(device, (type), -1, &device->ptr); \
subdev = nvkm_device_subdev(device, (type), 0); \ subdev = nvkm_device_subdev(device, (type), 0); \
...@@ -3387,7 +3375,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func, ...@@ -3387,7 +3375,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
#define NVKM_LAYOUT_INST(type,data,ptr,cnt) \ #define NVKM_LAYOUT_INST(type,data,ptr,cnt) \
WARN_ON(device->chip->ptr.inst & ~((1 << ARRAY_SIZE(device->ptr)) - 1)); \ WARN_ON(device->chip->ptr.inst & ~((1 << ARRAY_SIZE(device->ptr)) - 1)); \
for (j = 0; device->chip->ptr.inst && j < ARRAY_SIZE(device->ptr); j++) { \ for (j = 0; device->chip->ptr.inst && j < ARRAY_SIZE(device->ptr); j++) { \
if ((device->chip->ptr.inst & BIT(j)) && (subdev_mask & BIT_ULL(type))) { \ if (device->chip->ptr.inst & BIT(j)) { \
ret = device->chip->ptr.ctor(device, (type), (j), &device->ptr[j]); \ ret = device->chip->ptr.ctor(device, (type), (j), &device->ptr[j]); \
subdev = nvkm_device_subdev(device, (type), (j)); \ subdev = nvkm_device_subdev(device, (type), (j)); \
if (ret) { \ if (ret) { \
...@@ -3409,7 +3397,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func, ...@@ -3409,7 +3397,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
ret = nvkm_intr_install(device); ret = nvkm_intr_install(device);
done: done:
if (device->pri && (!mmio || ret)) { if (ret && device->pri) {
iounmap(device->pri); iounmap(device->pri);
device->pri = NULL; device->pri = NULL;
} }
......
...@@ -1626,7 +1626,6 @@ nvkm_device_pci_func = { ...@@ -1626,7 +1626,6 @@ nvkm_device_pci_func = {
int int
nvkm_device_pci_new(struct pci_dev *pci_dev, const char *cfg, const char *dbg, nvkm_device_pci_new(struct pci_dev *pci_dev, const char *cfg, const char *dbg,
bool detect, bool mmio, u64 subdev_mask,
struct nvkm_device **pdevice) struct nvkm_device **pdevice)
{ {
const struct nvkm_device_quirk *quirk = NULL; const struct nvkm_device_quirk *quirk = NULL;
...@@ -1680,8 +1679,7 @@ nvkm_device_pci_new(struct pci_dev *pci_dev, const char *cfg, const char *dbg, ...@@ -1680,8 +1679,7 @@ nvkm_device_pci_new(struct pci_dev *pci_dev, const char *cfg, const char *dbg,
pci_dev->bus->number << 16 | pci_dev->bus->number << 16 |
PCI_SLOT(pci_dev->devfn) << 8 | PCI_SLOT(pci_dev->devfn) << 8 |
PCI_FUNC(pci_dev->devfn), name, PCI_FUNC(pci_dev->devfn), name,
cfg, dbg, detect, mmio, subdev_mask, cfg, dbg, &pdev->device);
&pdev->device);
if (ret) if (ret)
return ret; return ret;
......
...@@ -56,7 +56,6 @@ int nvkm_device_ctor(const struct nvkm_device_func *, ...@@ -56,7 +56,6 @@ int nvkm_device_ctor(const struct nvkm_device_func *,
const struct nvkm_device_quirk *, const struct nvkm_device_quirk *,
struct device *, enum nvkm_device_type, u64 handle, struct device *, enum nvkm_device_type, u64 handle,
const char *name, const char *cfg, const char *dbg, const char *name, const char *cfg, const char *dbg,
bool detect, bool mmio, u64 subdev_mask,
struct nvkm_device *); struct nvkm_device *);
int nvkm_device_init(struct nvkm_device *); int nvkm_device_init(struct nvkm_device *);
int nvkm_device_fini(struct nvkm_device *, bool suspend); int nvkm_device_fini(struct nvkm_device *, bool suspend);
......
...@@ -237,7 +237,6 @@ int ...@@ -237,7 +237,6 @@ int
nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func, nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func,
struct platform_device *pdev, struct platform_device *pdev,
const char *cfg, const char *dbg, const char *cfg, const char *dbg,
bool detect, bool mmio, u64 subdev_mask,
struct nvkm_device **pdevice) struct nvkm_device **pdevice)
{ {
struct nvkm_device_tegra *tdev; struct nvkm_device_tegra *tdev;
...@@ -311,8 +310,7 @@ nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func, ...@@ -311,8 +310,7 @@ nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func,
tdev->gpu_speedo_id = tegra_sku_info.gpu_speedo_id; tdev->gpu_speedo_id = tegra_sku_info.gpu_speedo_id;
ret = nvkm_device_ctor(&nvkm_device_tegra_func, NULL, &pdev->dev, ret = nvkm_device_ctor(&nvkm_device_tegra_func, NULL, &pdev->dev,
NVKM_DEVICE_TEGRA, pdev->id, NULL, NVKM_DEVICE_TEGRA, pdev->id, NULL,
cfg, dbg, detect, mmio, subdev_mask, cfg, dbg, &tdev->device);
&tdev->device);
if (ret) if (ret)
goto powerdown; goto powerdown;
...@@ -333,7 +331,6 @@ int ...@@ -333,7 +331,6 @@ int
nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func, nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func,
struct platform_device *pdev, struct platform_device *pdev,
const char *cfg, const char *dbg, const char *cfg, const char *dbg,
bool detect, bool mmio, u64 subdev_mask,
struct nvkm_device **pdevice) struct nvkm_device **pdevice)
{ {
return -ENOSYS; return -ENOSYS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment