2 * Copyright 2014 Cisco Systems, Inc. All rights reserved.
4 * This program is free software; you may redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
11 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
12 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
13 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
14 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18 #include <linux/kernel.h>
19 #include <linux/errno.h>
20 #include <linux/types.h>
21 #include <linux/pci.h>
22 #include <linux/delay.h>
24 #include "vnic_intr.h"
26 void svnic_intr_free(struct vnic_intr
*intr
)
31 int svnic_intr_alloc(struct vnic_dev
*vdev
, struct vnic_intr
*intr
,
37 intr
->ctrl
= svnic_dev_get_res(vdev
, RES_TYPE_INTR_CTRL
, index
);
39 pr_err("Failed to hook INTR[%d].ctrl resource\n",
47 void svnic_intr_init(struct vnic_intr
*intr
, unsigned int coalescing_timer
,
48 unsigned int coalescing_type
, unsigned int mask_on_assertion
)
50 iowrite32(coalescing_timer
, &intr
->ctrl
->coalescing_timer
);
51 iowrite32(coalescing_type
, &intr
->ctrl
->coalescing_type
);
52 iowrite32(mask_on_assertion
, &intr
->ctrl
->mask_on_assertion
);
53 iowrite32(0, &intr
->ctrl
->int_credits
);
56 void svnic_intr_clean(struct vnic_intr
*intr
)
58 iowrite32(0, &intr
->ctrl
->int_credits
);