mirror of
https://github.com/gnif/vendor-reset.git
synced 2025-12-27 06:19:29 +01:00
restructure and added stubs for vega10, vega20 and navi10
This commit is contained in:
parent
99d99cba4e
commit
5a32e3e3c2
12
Makefile
12
Makefile
@ -1,4 +1,14 @@
|
|||||||
obj-m += vendor-reset.o
|
obj-m := vendor-reset.o
|
||||||
|
vendor-reset-y := src/vendor-reset.o
|
||||||
|
|
||||||
|
vendor-reset-y += src/amd/vega10.o
|
||||||
|
vendor-reset-y += src/amd/vega20.o
|
||||||
|
vendor-reset-y += src/amd/navi10.o
|
||||||
|
|
||||||
|
|
||||||
|
ccflags-y := -I$(src)/src
|
||||||
|
ccflags-y += -I$(src)/include
|
||||||
|
|
||||||
USER := $(shell whoami)
|
USER := $(shell whoami)
|
||||||
KVER ?= $(shell uname -r)
|
KVER ?= $(shell uname -r)
|
||||||
KDIR ?= /lib/modules/$(KVER)/build
|
KDIR ?= /lib/modules/$(KVER)/build
|
||||||
|
|||||||
@ -16,9 +16,6 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|||||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static struct vendor_reset_device vendor_reset_devices[] =
|
extern struct vendor_reset_ops amd_vega10_ops;
|
||||||
{
|
extern struct vendor_reset_ops amd_vega20_ops;
|
||||||
{
|
extern struct vendor_reset_ops amd_navi10_ops;
|
||||||
.type = VENDOR_RESET_TYPE_INVALID
|
|
||||||
}
|
|
||||||
};
|
|
||||||
29
src/amd/navi10.c
Normal file
29
src/amd/navi10.c
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
Vendor Reset - Vendor Specific Reset
|
||||||
|
Copyright (C) 2020 Geoffrey McRae <geoff@hostfission.com>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
|
Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with
|
||||||
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||||
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "vendor-reset-dev.h"
|
||||||
|
|
||||||
|
static int amd_navi10_reset(struct pci_dev * dev)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const struct vendor_reset_ops amd_navi10_ops =
|
||||||
|
{
|
||||||
|
.reset = amd_navi10_reset
|
||||||
|
};
|
||||||
29
src/amd/vega10.c
Normal file
29
src/amd/vega10.c
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
Vendor Reset - Vendor Specific Reset
|
||||||
|
Copyright (C) 2020 Geoffrey McRae <geoff@hostfission.com>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
|
Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with
|
||||||
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||||
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "vendor-reset-dev.h"
|
||||||
|
|
||||||
|
static int amd_vega10_reset(struct pci_dev * dev)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const struct vendor_reset_ops amd_vega10_ops =
|
||||||
|
{
|
||||||
|
.reset = amd_vega10_reset
|
||||||
|
};
|
||||||
29
src/amd/vega20.c
Normal file
29
src/amd/vega20.c
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
Vendor Reset - Vendor Specific Reset
|
||||||
|
Copyright (C) 2020 Geoffrey McRae <geoff@hostfission.com>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
|
Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with
|
||||||
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||||
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "vendor-reset-dev.h"
|
||||||
|
|
||||||
|
static int amd_vega20_reset(struct pci_dev * dev)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const struct vendor_reset_ops amd_vega20_ops =
|
||||||
|
{
|
||||||
|
.reset = amd_vega20_reset
|
||||||
|
};
|
||||||
59
src/device-db.h
Normal file
59
src/device-db.h
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
Vendor Reset - Vendor Specific Reset
|
||||||
|
Copyright (C) 2020 Geoffrey McRae <geoff@hostfission.com>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
|
Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with
|
||||||
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||||
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "amd/amd.h"
|
||||||
|
|
||||||
|
static struct vendor_reset_device vendor_reset_devices[] =
|
||||||
|
{
|
||||||
|
/* AMD Vega 10 */
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x6860, &amd_vega10_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x6861, &amd_vega10_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x6862, &amd_vega10_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x6863, &amd_vega10_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x6864, &amd_vega10_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x6867, &amd_vega10_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x6868, &amd_vega10_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x6869, &amd_vega10_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x686a, &amd_vega10_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x686b, &amd_vega10_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x686c, &amd_vega10_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x686d, &amd_vega10_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x686e, &amd_vega10_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x686f, &amd_vega10_ops },
|
||||||
|
|
||||||
|
/* AMD Vega 20 */
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x66a0, &amd_vega20_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x66a1, &amd_vega20_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x66a2, &amd_vega20_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x66a3, &amd_vega20_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x66a4, &amd_vega20_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x66a7, &amd_vega20_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x66af, &amd_vega20_ops },
|
||||||
|
|
||||||
|
/* AMD Navi 10 */
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x7310, &amd_navi10_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x7312, &amd_navi10_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x7318, &amd_navi10_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x7319, &amd_navi10_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x731a, &amd_navi10_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x731b, &amd_navi10_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x731e, &amd_navi10_ops },
|
||||||
|
{ PCI_VENDOR_ID_ATI, 0x731f, &amd_navi10_ops },
|
||||||
|
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
@ -16,11 +16,8 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|||||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _H_VENDOR_RESET
|
#ifndef _H_VENDOR_RESET_DEV
|
||||||
#define _H_VENDOR_RESET
|
#define _H_VENDOR_RESET_DEV
|
||||||
|
|
||||||
#define VENDOR_RESET_TYPE_INVALID 0x0
|
|
||||||
#define VENDOR_RESET_TYPE_PCI 0x1
|
|
||||||
|
|
||||||
#define VENDOR_RESET_DEVICE_ALL ((unsigned int)-1)
|
#define VENDOR_RESET_DEVICE_ALL ((unsigned int)-1)
|
||||||
|
|
||||||
@ -34,9 +31,6 @@ struct vendor_reset_ops
|
|||||||
|
|
||||||
struct vendor_reset_device
|
struct vendor_reset_device
|
||||||
{
|
{
|
||||||
/* one of VENDOR_RESET_TYPE_* */
|
|
||||||
unsigned int type;
|
|
||||||
|
|
||||||
/* the vendor ID */
|
/* the vendor ID */
|
||||||
unsigned int vendor;
|
unsigned int vendor;
|
||||||
|
|
||||||
@ -45,7 +39,7 @@ struct vendor_reset_device
|
|||||||
unsigned int device;
|
unsigned int device;
|
||||||
|
|
||||||
/* the reset operations */
|
/* the reset operations */
|
||||||
struct vendor_reset_ops ops;
|
const struct vendor_reset_ops * ops;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -22,8 +22,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#include <linux/highmem.h>
|
#include <linux/highmem.h>
|
||||||
#include <linux/pci.h>
|
#include <linux/pci.h>
|
||||||
|
|
||||||
|
#include "vendor-reset-dev.h"
|
||||||
#include "vendor-reset.h"
|
#include "vendor-reset.h"
|
||||||
#include "include/vendor-reset.h"
|
|
||||||
|
|
||||||
#include "device-db.h"
|
#include "device-db.h"
|
||||||
|
|
||||||
@ -43,25 +43,23 @@ static long vendor_reset_ioctl_reset(struct file * filp, unsigned long arg)
|
|||||||
if (!pcidev)
|
if (!pcidev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
while(entry->type != VENDOR_RESET_TYPE_INVALID)
|
for(entry = vendor_reset_devices; entry->vendor; ++entry)
|
||||||
{
|
{
|
||||||
if (entry->type != VENDOR_RESET_TYPE_PCI || entry->vendor != pcidev->vendor)
|
if (entry->vendor != pcidev->vendor)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (entry->device == VENDOR_RESET_DEVICE_ALL ||
|
if (entry->device == VENDOR_RESET_DEVICE_ALL ||
|
||||||
entry->device == pcidev->device)
|
entry->device == pcidev->device)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
++entry;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry->type == VENDOR_RESET_TYPE_INVALID)
|
if (!entry->vendor)
|
||||||
{
|
{
|
||||||
ret = -EOPNOTSUPP;
|
ret = -EOPNOTSUPP;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = entry->ops.reset(pcidev);
|
ret = entry->ops->reset(pcidev);
|
||||||
|
|
||||||
err:
|
err:
|
||||||
pci_dev_put(pcidev);
|
pci_dev_put(pcidev);
|
||||||
Loading…
x
Reference in New Issue
Block a user