15eb24fbdSCédric Le Goater /* 25eb24fbdSCédric Le Goater * M25P80 Serial Flash Discoverable Parameter (SFDP) 35eb24fbdSCédric Le Goater * 45eb24fbdSCédric Le Goater * Copyright (c) 2020, IBM Corporation. 55eb24fbdSCédric Le Goater * 65eb24fbdSCédric Le Goater * This code is licensed under the GPL version 2 or later. See the 75eb24fbdSCédric Le Goater * COPYING file in the top-level directory. 85eb24fbdSCédric Le Goater */ 95eb24fbdSCédric Le Goater 105eb24fbdSCédric Le Goater #include "qemu/osdep.h" 115eb24fbdSCédric Le Goater #include "qemu/host-utils.h" 125eb24fbdSCédric Le Goater #include "m25p80_sfdp.h" 135eb24fbdSCédric Le Goater 145eb24fbdSCédric Le Goater #define define_sfdp_read(model) \ 155eb24fbdSCédric Le Goater uint8_t m25p80_sfdp_##model(uint32_t addr) \ 165eb24fbdSCédric Le Goater { \ 175eb24fbdSCédric Le Goater assert(is_power_of_2(sizeof(sfdp_##model))); \ 185eb24fbdSCédric Le Goater return sfdp_##model[addr & (sizeof(sfdp_##model) - 1)]; \ 195eb24fbdSCédric Le Goater } 205eb24fbdSCédric Le Goater 215eb24fbdSCédric Le Goater /* 225eb24fbdSCédric Le Goater * Micron 235eb24fbdSCédric Le Goater */ 245eb24fbdSCédric Le Goater static const uint8_t sfdp_n25q256a[] = { 255eb24fbdSCédric Le Goater 0x53, 0x46, 0x44, 0x50, 0x00, 0x01, 0x00, 0xff, 265eb24fbdSCédric Le Goater 0x00, 0x00, 0x01, 0x09, 0x30, 0x00, 0x00, 0xff, 275eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 285eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 295eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 305eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 315eb24fbdSCédric Le Goater 0xe5, 0x20, 0xfb, 0xff, 0xff, 0xff, 0xff, 0x0f, 325eb24fbdSCédric Le Goater 0x29, 0xeb, 0x27, 0x6b, 0x08, 0x3b, 0x27, 0xbb, 335eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x27, 0xbb, 345eb24fbdSCédric Le Goater 0xff, 0xff, 0x29, 0xeb, 0x0c, 0x20, 0x10, 0xd8, 355eb24fbdSCédric Le Goater 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 365eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 375eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 385eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 395eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 405eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 415eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 425eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 435eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 445eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 455eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 465eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 475eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 485eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 495eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 505eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 515eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 525eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 535eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 545eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 555eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 565eb24fbdSCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 575eb24fbdSCédric Le Goater }; 585eb24fbdSCédric Le Goater define_sfdp_read(n25q256a); 59*dc907a66SCédric Le Goater 60*dc907a66SCédric Le Goater 61*dc907a66SCédric Le Goater /* 62*dc907a66SCédric Le Goater * Matronix 63*dc907a66SCédric Le Goater */ 64*dc907a66SCédric Le Goater 65*dc907a66SCédric Le Goater /* mx25l25635e. No 4B opcodes */ 66*dc907a66SCédric Le Goater static const uint8_t sfdp_mx25l25635e[] = { 67*dc907a66SCédric Le Goater 0x53, 0x46, 0x44, 0x50, 0x00, 0x01, 0x01, 0xff, 68*dc907a66SCédric Le Goater 0x00, 0x00, 0x01, 0x09, 0x30, 0x00, 0x00, 0xff, 69*dc907a66SCédric Le Goater 0xc2, 0x00, 0x01, 0x04, 0x60, 0x00, 0x00, 0xff, 70*dc907a66SCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 71*dc907a66SCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 72*dc907a66SCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 73*dc907a66SCédric Le Goater 0xe5, 0x20, 0xf3, 0xff, 0xff, 0xff, 0xff, 0x0f, 74*dc907a66SCédric Le Goater 0x44, 0xeb, 0x08, 0x6b, 0x08, 0x3b, 0x04, 0xbb, 75*dc907a66SCédric Le Goater 0xee, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 76*dc907a66SCédric Le Goater 0xff, 0xff, 0x00, 0xff, 0x0c, 0x20, 0x0f, 0x52, 77*dc907a66SCédric Le Goater 0x10, 0xd8, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 78*dc907a66SCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 79*dc907a66SCédric Le Goater 0x00, 0x36, 0x00, 0x27, 0xf7, 0x4f, 0xff, 0xff, 80*dc907a66SCédric Le Goater 0xd9, 0xc8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 81*dc907a66SCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 82*dc907a66SCédric Le Goater 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 83*dc907a66SCédric Le Goater }; 84*dc907a66SCédric Le Goater define_sfdp_read(mx25l25635e) 85