[Skiboot] [PATCH 4/5] hw/bt: Clear the fifo when an unknown response is received

Cyril Bur cyril.bur at au1.ibm.com
Fri Oct 30 13:44:12 AEDT 2015


On Thu, 29 Oct 2015 12:21:45 +1100
Alistair Popple <alistair at popple.id.au> wrote:

> On Thu, 29 Oct 2015 11:24:08 Cyril Bur wrote:
> > Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
> > ---
> >  hw/bt.c | 20 ++++++++++++++++++++
> >  1 file changed, 20 insertions(+)
> > 
> > diff --git a/hw/bt.c b/hw/bt.c
> > index a4da87e..1185412 100644
> > --- a/hw/bt.c
> > +++ b/hw/bt.c
> > @@ -39,6 +39,9 @@
> >  #define   BT_INTMASK_B2H_IRQ		0x02
> >  #define   BT_INTMASK_BMC_HWRST		0x80
> >  
> > +/* Maximum size of the HW FIFO */
> > +#define BT_FIFO_LEN 64
> > +
> >  /* Default poll interval before interrupts are working */
> >  #define BT_DEFAULT_POLL_MS	200
> >  
> > @@ -136,6 +139,13 @@ static inline void bt_set_h_busy(bool value)
> >  		bt_outb(BT_CTRL_H_BUSY, BT_CTRL);
> >  }
> >  
> > +static inline void bt_assert_h_busy(void)
> > +{
> > +	uint8_t rval;
> > +	rval = bt_inb(BT_CTRL);
> > +	assert(rval & BT_CTRL_H_BUSY);
> > +}
> > +
> >  static inline bool bt_idle(void)
> >  {
> >  	uint8_t bt_ctrl = bt_inb(BT_CTRL);
> > @@ -206,9 +216,19 @@ static void bt_send_msg(struct bt_msg *bt_msg)
> >  	return;
> >  }
> >  
> > +static void bt_clear_fifo(void)
> > +{
> > +	int i;
> > +
> > +	for (i = 0; i < BT_FIFO_LEN; i++)
> > +		bt_outb(0xff, BT_HOST2BMC);
> > +}
> > +
> >  static void bt_flush_msg(void)
> >  {
> > +	bt_assert_h_busy();
> >  	bt_outb(BT_CTRL_B2H_ATN | BT_CTRL_CLR_RD_PTR, BT_CTRL);
> > +	bt_clear_fifo();  
> 
> I might be better to clear the write pointer as well in case BT_FIFO_LEN 
> doesn't wrap the pointers properly, although we should test that.
> 

probs in bt_clear_fifo() right? But yes agreed.

> >  	bt_set_h_busy(false);
> >  }
> >  
> >   
> 



More information about the Skiboot mailing list