Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b40db99 authored by Matias Bjørling's avatar Matias Bjørling Committed by Jens Axboe
Browse files

null_blk: use device addressing mode



The linear addressing mode was removed in 7386af27. Make null_blk instead
expose the ppa format geometry and support the generic addressing mode.

Signed-off-by: default avatarMatias Bjørling <m@bjorling.me>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 6bb9535b
Loading
Loading
Loading
Loading
+23 −5
Original line number Original line Diff line number Diff line
@@ -486,6 +486,7 @@ static int null_lnvm_submit_io(struct request_queue *q, struct nvm_rq *rqd)
static int null_lnvm_id(struct request_queue *q, struct nvm_id *id)
static int null_lnvm_id(struct request_queue *q, struct nvm_id *id)
{
{
	sector_t size = gb * 1024 * 1024 * 1024ULL;
	sector_t size = gb * 1024 * 1024 * 1024ULL;
	sector_t blksize;
	struct nvm_id_group *grp;
	struct nvm_id_group *grp;


	id->ver_id = 0x1;
	id->ver_id = 0x1;
@@ -493,17 +494,34 @@ static int null_lnvm_id(struct request_queue *q, struct nvm_id *id)
	id->cgrps = 1;
	id->cgrps = 1;
	id->cap = 0x3;
	id->cap = 0x3;
	id->dom = 0x1;
	id->dom = 0x1;
	id->ppat = NVM_ADDRMODE_LINEAR;

	id->ppaf.blk_offset = 0;
	id->ppaf.blk_len = 16;
	id->ppaf.pg_offset = 16;
	id->ppaf.pg_len = 16;
	id->ppaf.sect_offset = 32;
	id->ppaf.sect_len = 8;
	id->ppaf.pln_offset = 40;
	id->ppaf.pln_len = 8;
	id->ppaf.lun_offset = 48;
	id->ppaf.lun_len = 8;
	id->ppaf.ch_offset = 56;
	id->ppaf.ch_len = 8;


	do_div(size, bs); /* convert size to pages */
	do_div(size, bs); /* convert size to pages */
	do_div(size, 256); /* concert size to pgs pr blk */
	grp = &id->groups[0];
	grp = &id->groups[0];
	grp->mtype = 0;
	grp->mtype = 0;
	grp->fmtype = 1;
	grp->fmtype = 0;
	grp->num_ch = 1;
	grp->num_ch = 1;
	grp->num_lun = 1;
	grp->num_pln = 1;
	grp->num_blk = size / 256;
	grp->num_pg = 256;
	grp->num_pg = 256;
	blksize = size;
	do_div(size, (1 << 16));
	grp->num_lun = size + 1;
	do_div(blksize, grp->num_lun);
	grp->num_blk = blksize;
	grp->num_pln = 1;

	grp->fpg_sz = bs;
	grp->fpg_sz = bs;
	grp->csecs = bs;
	grp->csecs = bs;
	grp->trdt = 25000;
	grp->trdt = 25000;