2 * Copyright 2014-2016 IBM Corp.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
10 #include <linux/pci.h>
13 bool _cxl_pci_associate_default_context(struct pci_dev
*dev
, struct cxl_afu
*afu
)
15 struct cxl_context
*ctx
;
18 * Allocate a context to do cxl things to. This is used for interrupts
19 * in the peer model using a real phb, and if we eventually do DMA ops
20 * in the virtual phb, we'll need a default context to attach them to.
22 ctx
= cxl_dev_context_init(dev
);
25 dev
->dev
.archdata
.cxl_ctx
= ctx
;
27 return (cxl_ops
->afu_check_and_enable(afu
) == 0);
29 /* exported via cxl_base */
31 void _cxl_pci_disable_device(struct pci_dev
*dev
)
33 struct cxl_context
*ctx
= cxl_get_context(dev
);
36 if (ctx
->status
== STARTED
) {
37 dev_err(&dev
->dev
, "Default context started\n");
40 dev
->dev
.archdata
.cxl_ctx
= NULL
;
41 cxl_release_context(ctx
);
44 /* exported via cxl_base */