Commit 73adbe28 authored by Wesley W. Terpstra's avatar Wesley W. Terpstra

wishbone: get serious about sleeping in interrupt context

parent 6d608660
......@@ -216,6 +216,8 @@ static wb_data_t wb_read_cfg(struct wishbone *wb, wb_addr_t addr)
static int wb_request(struct wishbone *wb, struct wishbone_request *req)
{
/* All forms of sleep are forbidden in this method (no printk/mutex/etc) */
struct pcie_wb_dev* dev;
unsigned char* control;
uint32_t ctl;
......@@ -230,7 +232,6 @@ static int wb_request(struct wishbone *wb, struct wishbone_request *req)
req->mask = ctl & 0xf;
req->write = (ctl & 0x40000000) != 0;
if (unlikely(debug)) printk(KERN_ALERT "request %x\n", ctl);
out = (ctl & 0x80000000) != 0;
if (out) iowrite32(1, control + MASTER_CTL_HIGH); /* dequeue operation */
......@@ -242,13 +243,14 @@ static int wb_request(struct wishbone *wb, struct wishbone_request *req)
static void wb_reply(struct wishbone *wb, int err, wb_data_t data)
{
/* All forms of sleep are forbidden in this method (no printk/mutex/etc) */
struct pcie_wb_dev* dev;
unsigned char* control;
dev = container_of(wb, struct pcie_wb_dev, wb);
control = dev->pci_res[0].addr;
if (unlikely(debug)) printk(KERN_ALERT "pushing reply\n");
iowrite32(data, control + MASTER_DAT_LOW);
iowrite32(err+2, control + MASTER_CTL_HIGH);
}
......@@ -266,9 +268,9 @@ static const struct wishbone_operations wb_ops = {
static irqreturn_t irq_handler(int irq, void *dev_id)
{
struct pcie_wb_dev *dev = dev_id;
/* All forms of sleep are forbidden in this method (no printk/mutex/etc) */
if (unlikely(debug)) printk(KERN_ALERT "posting MSI\n");
struct pcie_wb_dev *dev = dev_id;
pcie_int_enable(dev, 0);
wishbone_slave_ready(&dev->wb);
......
......@@ -46,7 +46,7 @@ struct wishbone_operations
wb_data_t (*read)(struct wishbone *wb, wb_addr_t addr);
wb_data_t (*read_cfg)(struct wishbone *wb, wb_addr_t addr);
/* slave operations */
/* slave operations, run from interrupt context => MUST NOT SLEEP (no printk/mutex/etc) */
int (*request)(struct wishbone *wb, struct wishbone_request*); /* 1=record filled, 0=none pending. re-enable non-MSI interrupts. */
void (*reply)(struct wishbone *wb, int err, wb_data_t dat);
};
......
......@@ -154,6 +154,8 @@ static wb_data_t wb_read(struct wishbone *wb, wb_addr_t addr)
static int wb_request(struct wishbone *wb, struct wishbone_request *req)
{
/* All forms of sleep are forbidden in this method (no printk/mutex/etc) */
struct vme_wb_dev *dev;
unsigned char *ctrl_win;
uint32_t ctrl;
......@@ -171,17 +173,13 @@ static int wb_request(struct wishbone *wb, struct wishbone_request *req)
out = (ctrl & 0x80000000) != 0;
if (out) iowrite32(cpu_to_be32(1), ctrl_win + MASTER_CTRL); /* dequeue operation */
if (unlikely(debug))
printk(KERN_ALERT
"WB REQUEST:Request ctrl %x addr %x data %x mask %x return %x \n",
ctrl, req->addr, req->data, req->mask,
(ctrl & 0x80000000) != 0);
return out;
}
static void wb_reply(struct wishbone *wb, int err, wb_data_t data)
{
/* All forms of sleep are forbidden in this method (no printk/mutex/etc) */
struct vme_wb_dev *dev;
unsigned char *ctrl_win;
......@@ -190,10 +188,6 @@ static void wb_reply(struct wishbone *wb, int err, wb_data_t data)
iowrite32(cpu_to_be32(data), ctrl_win + MASTER_DATA);
iowrite32(cpu_to_be32(err + 2), ctrl_win + MASTER_CTRL);
if (unlikely(debug))
printk(KERN_ALERT "WB REPLY: pushing data %x reply %x\n", data,
err + 2);
}
static void wb_byteenable(struct wishbone *wb, unsigned char be)
......@@ -235,11 +229,10 @@ static void init_ctrl_reg(struct vme_wb_dev *dev)
int irq_handler(void *dev_id)
{
/* All forms of sleep are forbidden in this method (no printk/mutex/etc) */
struct vme_wb_dev *dev = dev_id;
if (unlikely(debug))
printk(KERN_ALERT VME_WB ": IRQ!!\n");
wishbone_slave_ready(&dev->wb);
return IRQ_HANDLED;
......
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