From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35214) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yn7qX-0004mg-30 for qemu-devel@nongnu.org; Tue, 28 Apr 2015 11:54:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yn7qV-0007oP-Le for qemu-devel@nongnu.org; Tue, 28 Apr 2015 11:54:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39329) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yn7qV-0007o6-EG for qemu-devel@nongnu.org; Tue, 28 Apr 2015 11:54:51 -0400 Date: Tue, 28 Apr 2015 17:54:45 +0200 From: "Michael S. Tsirkin" Message-ID: <20150428174836-mutt-send-email-mst@redhat.com> References: <1429104309-3844-1-git-send-email-zhaoshenglong@huawei.com> <1429104309-3844-20-git-send-email-zhaoshenglong@huawei.com> <20150428104225.4d5ebab0@nial.brq.redhat.com> <20150428104449-mutt-send-email-mst@redhat.com> <553F4D78.5070507@huawei.com> <20150428115407.66991856@nial.brq.redhat.com> <553F83B5.5020002@huawei.com> <20150428171310.76d6cd77@nial.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150428171310.76d6cd77@nial.brq.redhat.com> Subject: Re: [Qemu-devel] [PATCH v5 19/20] hw/arm/virt-acpi-build: Add PCIe controller in ACPI DSDT table List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: peter.maydell@linaro.org, hangaohuai@huawei.com, a.spyridakis@virtualopensystems.com, claudio.fontana@huawei.com, qemu-devel@nongnu.org, peter.huangpeng@huawei.com, alex.bennee@linaro.org, hanjun.guo@linaro.org, Shannon Zhao , pbonzini@redhat.com, lersek@redhat.com, christoffer.dall@linaro.org, shannon.zhao@linaro.org On Tue, Apr 28, 2015 at 05:13:10PM +0200, Igor Mammedov wrote: > > Here I need to set the value of buffer to 1 or 0, we could > > createbitfield, but if we want to set the value to non one or zero and > > the BufferSize is large, how could we do? CreateByteField? It's a little > > complex for user. > that's what one would have to do writing it in ASL if bits > are flipped on/off dynamically. > > In ASL you also can declare buffer with static initializer > > Buffer (0x01) { 0x03 } > > and compiler is smart enough to set appropriate bits but it doesn't > allow you to do so with large values. For example: > > Buffer (0x01) { 0xAABBCCDD } > > gives error: > Error 6139 - Constant out of range ^ (0xAABBCCDD, allowable: 0x0-0xFF) > > If one wants to manipulate specific fields in Buffer, ASL has > a bunch of CreateFOOField operators, so lets follow spec and use > API consistently to avoid confusion. > > BTW: > packaging value as int (even without prefix) is wrong since > its LE encoding will shuffle bytes and you won't get bits in > positions that you expect if value is more than 1 byte. I don't care about ASL, we are writing in C But AML is same: DefBuffer := BufferOp PkgLength BufferSize ByteList BufferOp := 0x11 BufferSize := TermArg => Integer So really just a bytelist. We don't have any users for aml_buffer, maybe just add const uint8_t *bytes, unsigned len as parameters. Would that be enough? > > > > > ifctx1 = aml_if(aml_equal(aml_arg(2), aml_int(0))); > > > aml_append(ifctx1, aml_store(aml_name("FNEN", aml_int(1))); > > > ... > > > /* create bit field for every supported function if supported */ > > > ... > > > aml_append(method, aml_return(aml_name("RET"))); > > > > > > > > >> > > >>>> > > >>>>> + aml_append(ifctx1, aml_return(buf)); > > >>>>> + aml_append(ifctx, ifctx1); > > >>>>> + aml_append(method, ifctx); > > >>>>> + > > >>>>> + buf = aml_buffer(); > > >>>>> + build_append_int_noprefix(buf->buf, 0x00, 1); > > >>>>> + aml_append(method, aml_return(buf)); > > >>>>> + aml_append(dev, method); > > >>>>> + > > >>>>> + Aml *dev_rp0 = aml_device("%s", "RP0"); > > >>>>> + aml_append(dev_rp0, aml_name_decl("_ADR", aml_int(0))); > > >>>>> + aml_append(dev, dev_rp0); > > >>>>> + aml_append(scope, dev); > > >>>>> +} > > >>>>> + > > >>>>> /* RSDP */ > > >>>>> static GArray * > > >>>>> build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt) > > >>>>> @@ -318,6 +468,8 @@ build_dsdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) > > >>>>> acpi_dsdt_add_flash(scope, info->flash_memmap); > > >>>>> acpi_dsdt_add_virtio(scope, info->virtio_mmio_memmap, > > >>>>> info->virtio_mmio_irq, info->virtio_mmio_num); > > >>>>> + acpi_dsdt_add_pci(scope, guest_info->pcie_info); > > >>>>> + > > >>>>> aml_append(dsdt, scope); > > >>>>> > > >>>>> /* copy AML table into ACPI tables blob and patch header there */ > > >>> > > >>> . > > >>> > > >> > > >> > > > > > > > > > . > > > > > > >