On 26 November 2017 at 01:45, Philippe Mathieu-Daudé <f4...@amsat.org>
wrote:

> Hi Francisco,
>
> On 11/24/2017 06:29 PM, Francisco Iglesias wrote:
> > Add support for SST READ ID 0x90/0xAB commands for reading out the flash
> > manufacuter ID and device ID.
> >
> > Signed-off-by: Francisco Iglesias <frasse.igles...@gmail.com>
> > Acked-by: Alistair Francis <alistair.fran...@xilinx.com>
> > Acked-by: Marcin Krzemiński <mar.krzemin...@gmail.com>
> > ---
> >  hw/block/m25p80.c | 23 +++++++++++++++++++++++
> >  1 file changed, 23 insertions(+)
> >
> > diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
> > index d50acc1..9d20120 100644
> > --- a/hw/block/m25p80.c
> > +++ b/hw/block/m25p80.c
> > @@ -355,6 +355,8 @@ typedef enum {
> >      DPP = 0xa2,
> >      QPP = 0x32,
> >      QPP_4 = 0x34,
> > +    RDID_90 = 0x90,
> > +    RDID_AB = 0xab,
> >
> >      ERASE_4K = 0x20,
> >      ERASE4_4K = 0x21,
> > @@ -405,6 +407,7 @@ typedef enum {
> >      MAN_MACRONIX,
> >      MAN_NUMONYX,
> >      MAN_WINBOND,
> > +    MAN_SST,
> >      MAN_GENERIC,
> >  } Manufacturer;
> >
> > @@ -476,6 +479,8 @@ static inline Manufacturer get_man(Flash *s)
> >          return MAN_SPANSION;
> >      case 0xC2:
> >          return MAN_MACRONIX;
> > +    case 0xBF:
> > +        return MAN_SST;
> >      default:
> >          return MAN_GENERIC;
> >      }
> > @@ -711,6 +716,22 @@ static void complete_collecting_data(Flash *s)
> >      case WEVCR:
> >          s->enh_volatile_cfg = s->data[0];
> >          break;
> > +    case RDID_90:
> > +    case RDID_AB:
> > +        if (get_man(s) == MAN_SST && s->cur_addr <= 1) {
>
> What about reporting if guest access this address when not an SST flash?
>
>            if (get_man(s) == MAN_SST) {
>                if (s->cur_addr <= 1) {
>
> > +            if (s->cur_addr) {
> > +                s->data[0] = s->pi->id[2];
> > +                s->data[1] = s->pi->id[0];
> > +            } else {
> > +                s->data[0] = s->pi->id[0];
> > +                s->data[1] = s->pi->id[2];
> > +            }
> > +            s->pos = 0;
> > +            s->len = 2;
> > +            s->data_read_loop = true;
> > +            s->state = STATE_READING_DATA;
>
>                } else {
>                     // LOG_UNIMP?
>                }
>            } else {
>                qemu_log_mask(LOG_GUEST_ERROR, ...);
>

Dear Philippe,

Thank you very much for reviewing! I will add the logs in the next version
of the patch series (v9).

Best regards,
Francisco Iglesias




>
> > +        }
> > +        break;
> >      default:
> >          break;
> >      }
> > @@ -926,6 +947,8 @@ static void decode_new_cmd(Flash *s, uint32_t value)
> >      case PP4:
> >      case PP4_4:
> >      case DIE_ERASE:
> > +    case RDID_90:
> > +    case RDID_AB:
> >          s->needed_bytes = get_addr_length(s);
> >          s->pos = 0;
> >          s->len = 0;
>
> Regards,
>
> Phil.
>

Reply via email to