From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=L9OKj0GO; spf=pass (domain: linaro.org, ip: 209.85.166.67, mailfrom: ard.biesheuvel@linaro.org) Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) by groups.io with SMTP; Wed, 19 Jun 2019 03:12:21 -0700 Received: by mail-io1-f67.google.com with SMTP id e5so36935807iok.4 for ; Wed, 19 Jun 2019 03:12:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=K7BHYJnZqIM5z5r2f37ig7FkEWVKo/Ibt2nqE7LCoCQ=; b=L9OKj0GOqUWJ78KQVxKbKkXphUtbZDFVxyuaK2l8qjElBHfCyXmrXqWyEmjZLrmFkM Cd3NhxD52GdOnNlH0g3w5oQ0SMvYhd792zqcQY+s1Z8l2c32vHhmn98gYfQm4yzXAMPS jdx2I8ofGHc3RV49N1SuWBQzqhHKD9PgCw85vOEFGyLUPeQhhaitdNbMEAklK4Fg9s+X f6T2dbU2nkQAJwojCML6++ilqI/Txykz5yMjlpb0RmpdgayfxrCHjYBMIX9FNvDubUug JcXNhw0KqHNSgxzkcX+6Wb1MDip0V9Rwj52CWe4ldpRjyQK29RiDmvD7gOzYwPIi/ZB2 akxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=K7BHYJnZqIM5z5r2f37ig7FkEWVKo/Ibt2nqE7LCoCQ=; b=e331GxUfD/aH4g4pkEdULQyQ7iP9v4lDu5yRhhzUvQrXce2oGfc0m40aqJ7jhlR8Bv Lnv1gexwbdwBi0ktiIHrpQPfuL3Cs6SavqB+2HIpdn27e1CzyvwyjqfSR5FXWT0i1ZWk kFfzhiaw2EF99XzH4Eo6h7zAqZTaRMC916ZBolNzoBLe1jNAa6bdd5d87Hws+yOlGZCN KsxFLIHkJydJn7WcsPEuelxqCSMxB2sT333BvCINfgdnIxg0dkd9yDx4SRbR57hZHkL4 gUTDm624uRHqCEtDKoxBUuDuQu9iKbHr2PtJ8F3/dW4CBVDtB7wc+RdkQwRviTCP13sG v+Yg== X-Gm-Message-State: APjAAAVPon1sRcc7fE2qemmekSbwPUxUwirANzpt0vJK6jPtUirzuqDO Vx6U7CPpQe7S3a8WvxdGchSk1IMsfafsgV1o6jHVag== X-Google-Smtp-Source: APXvYqyevdzZ7OcD6+empHJYJnPHcwfqQbMHXObMAWUu7AXhYcOSbE95hAwMt8Q9KOxH3pWEk4uHJxyuy9GmBq4SBu4= X-Received: by 2002:a02:9143:: with SMTP id b3mr8358515jag.12.1560939140984; Wed, 19 Jun 2019 03:12:20 -0700 (PDT) MIME-Version: 1.0 References: <20190508095255.2897-1-tzy.way.ooi@intel.com> <5F1105621EDF844291AF8B109E27C06D34D05FCC@PGSMSX109.gar.corp.intel.com> <5F1105621EDF844291AF8B109E27C06D34D1FB27@PGSMSX109.gar.corp.intel.com> In-Reply-To: <5F1105621EDF844291AF8B109E27C06D34D1FB27@PGSMSX109.gar.corp.intel.com> From: "Ard Biesheuvel" Date: Wed, 19 Jun 2019 12:12:10 +0200 Message-ID: Subject: Re: [edk2-devel] [PATCH v4 edk2-platforms 1/1] Silicon/DesignWare/Driver: DwEmacSnpDxe: Add DesignWare EMAC driver To: "Ooi, Tzy Way" Cc: edk2-devel-groups-io , "Kinney, Michael D" , "Loh, Tien Hock" , "leif.lindholm@linaro.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 19 Jun 2019 at 12:09, Ooi, Tzy Way wrote: > > Hi Bieshuevel, > > In the DmaMap function, there is one line where my code look like this: > > "Status =3D DmaMap (MapOperationBusMasterCommonBuffer, Snp->MacDriver.Txd= escRing[0], &BufferSize, &Snp->MacDriver.TxdescRingMap[0], &Snp->MappingTxd= esc);" > > You asked me why the [0] and how many descriptor I am mapping. In my code= , there is total 10 descriptors. The way I did in current code was I use Dm= aAllocateBuffer to allocate a memory size which is big enough for 10 descri= ptors. After that, I just map the first descriptor and I access the rest of= the descriptor by using the first descriptor address plus the size for eac= h descriptor to get the next descriptor address. Wonder if this method is o= k? Or do I need to use DmaAllocateBuffer and DmaMap for 10 times for total = 10 descriptors? > No, this is not ok. You have to allocate and map the size of the memory that you will use. As long as you don't use more than a page, it will not matter in practice, but it is wrong nonetheless