From patchwork Thu Oct 26 13:53:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 158551 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp693003vqb; Thu, 26 Oct 2023 06:56:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEDUi4YkR2AzF2Y6jljvqi7c25Pn7IvXSlX09WBML7xnIJ/Q2G1AMBY/mK9fBJ20BJJQVjy X-Received: by 2002:a05:6870:1254:b0:1e9:dd69:2fc1 with SMTP id 20-20020a056870125400b001e9dd692fc1mr19159575oao.7.1698328592233; Thu, 26 Oct 2023 06:56:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698328592; cv=none; d=google.com; s=arc-20160816; b=NsSd0BF1AbtN6pVRF9UelcCGZ6tObd/orWzLfnXM+rQAjPXLBgBm3Whc4zVWhAUSZy jZYxCGqly9efJ/b1Ta4psjOpd8y02PaO2Ev3JVJl3GMzx9SGs6pT4I0o0DYDcGwfDKTN jAvg+C8y26g0RBpTHJajsbLJPot6NThSQkjW4RTV2Vo/jxzCwre2LIggKr2CbUj3iCX7 A4bs5Ycq2HpD3H1L1IoZGfxunxCKc6aQwe33qrD+foG7wPnnnMmCZQjFHBeJchxjxrgW oOVVwXURdl4vze1BvlcWARCYCkA6wkWa49Tgpj6VvTNv8y6gpshdkUdB09QJ5o2kDVve 1RaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=dS2bQbsQIb8CArWmGPDMcF+yvzLcVqjiAEJzVYwbS4Y=; fh=Ck1OhWEfvon+cMUr/uMs0xQ+NN16OOlklgt8Gan93ys=; b=B8+qAwv4Tx7emJS2BEOqME+uHjvMmZtxdT2JgLMGgBrvPQU1mGDKZ6x00tiT8fkHcM UFgnbyFvFZApFMGlAPmMi17xULV5stRrExT5wVCTOvYCHF8yBNRXtzFHnXNOooq2WZbm 9pRgUa6DBrbrv8E7++0jubpR40oDAYV1FBNO+nxqVLs3qsiWI4+XkvgUzAtZOHvQ2Ffb FMQKCqhjFTuWo89n/bwfRO5fjaru9nyzfGwc2kc+CT9HC/wjwYOkVcOEza+pT05DXkOv /7peJjtWBPeeULKn8nEgPesdIJRT+5Gkjf6hEcL2E/kCWhTpbCKto/hZq71H4YGy6egs wv8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id 188-20020a2501c5000000b00da0b6ba2fcdsi1408382ybb.332.2023.10.26.06.56.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 06:56:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 9F13780E6FF1; Thu, 26 Oct 2023 06:56:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235015AbjJZN4D (ORCPT + 26 others); Thu, 26 Oct 2023 09:56:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345136AbjJZNzz (ORCPT ); Thu, 26 Oct 2023 09:55:55 -0400 Received: from mail-oa1-f53.google.com (mail-oa1-f53.google.com [209.85.160.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40564D55; Thu, 26 Oct 2023 06:55:53 -0700 (PDT) Received: by mail-oa1-f53.google.com with SMTP id 586e51a60fabf-1d544a4a2f2so517460fac.3; Thu, 26 Oct 2023 06:55:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698328552; x=1698933352; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dS2bQbsQIb8CArWmGPDMcF+yvzLcVqjiAEJzVYwbS4Y=; b=WXv98GxHzt2vF0zr3O1BOVadpHB2m/CMItumCtVwmLY03ZCoBCumdZFuo5RQTtGDXX 3ufMt0KAAtGtMntMQ3dYWSNtE5TkOGDVay9n0Zvu3CJsb5k4BObx1KNzkupVfCbHOJHc tdsO9teLmm2wauB53lhQvOcK0rVhRYFieXtorEUK6xE1GExJDUcd3L4hVX2uKPpy9+Ra 8gtGKhqVQbqQLqYWvgIr0kuvSB/bF8e/LTMYH6rqAfxZ/n14uu91vn7KToGuhHkN/eNj orWkaPoMsQY1puYYJjdvDyWTuRbmfj7lZqpuVNrLu87OTr2U/aT6zVaEBZqCP0qlGHIu +hBQ== X-Gm-Message-State: AOJu0Yw7tRC1bfekSbi+Rhlm/TWIkSUc1pAPwz2N3XYHdwGgKpbgd13b 8Pbyz7FVAa98b/z3aLe7kQ== X-Received: by 2002:a05:6870:7a1b:b0:1e9:f0be:cbbe with SMTP id hf27-20020a0568707a1b00b001e9f0becbbemr24245194oab.9.1698328552259; Thu, 26 Oct 2023 06:55:52 -0700 (PDT) Received: from herring.priv (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id z7-20020a056870e14700b001c5a3e31474sm3046274oaa.45.2023.10.26.06.55.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 06:55:51 -0700 (PDT) Received: (nullmailer pid 3566795 invoked by uid 1000); Thu, 26 Oct 2023 13:55:50 -0000 From: Rob Herring To: Frank Rowand Cc: Herve Codina , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] of: address: Store number of bus flag cells rather than bool Date: Thu, 26 Oct 2023 08:53:58 -0500 Message-ID: <20231026135358.3564307-2-robh@kernel.org> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 26 Oct 2023 06:56:26 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780826601653425624 X-GMAIL-MSGID: 1780826601653425624 It is more useful to know how many flags cells a bus has rather than whether a bus has flags or not as ultimately the number of cells is the information used. Replace 'has_flags' boolean with 'flag_cells' count. Signed-off-by: Rob Herring Acked-by: Herve Codina --- This series applies on top of Herve's[1]. Rob [1] https://lore.kernel.org/all/20231017110221.189299-1-herve.codina@bootlin.com/ drivers/of/address.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/of/address.c b/drivers/of/address.c index d21a3b74ac56..997f431af165 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -45,7 +45,7 @@ struct of_bus { u64 (*map)(__be32 *addr, const __be32 *range, int na, int ns, int pna); int (*translate)(__be32 *addr, u64 offset, int na); - bool has_flags; + int flag_cells; unsigned int (*get_flags)(const __be32 *addr); }; @@ -370,7 +370,7 @@ static struct of_bus of_busses[] = { .count_cells = of_bus_pci_count_cells, .map = of_bus_pci_map, .translate = of_bus_default_flags_translate, - .has_flags = true, + .flag_cells = 1, .get_flags = of_bus_pci_get_flags, }, #endif /* CONFIG_PCI */ @@ -382,7 +382,7 @@ static struct of_bus of_busses[] = { .count_cells = of_bus_isa_count_cells, .map = of_bus_isa_map, .translate = of_bus_default_flags_translate, - .has_flags = true, + .flag_cells = 1, .get_flags = of_bus_isa_get_flags, }, /* Default with flags cell */ @@ -393,7 +393,7 @@ static struct of_bus of_busses[] = { .count_cells = of_bus_default_count_cells, .map = of_bus_default_flags_map, .translate = of_bus_default_flags_translate, - .has_flags = true, + .flag_cells = 1, .get_flags = of_bus_default_flags_get_flags, }, /* Default */ @@ -826,7 +826,7 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser, int na = parser->na; int ns = parser->ns; int np = parser->pna + na + ns; - int busflag_na = 0; + int busflag_na = parser->bus->flag_cells; if (!range) return NULL; @@ -836,10 +836,6 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser, range->flags = parser->bus->get_flags(parser->range); - /* A extra cell for resource flags */ - if (parser->bus->has_flags) - busflag_na = 1; - range->bus_addr = of_read_number(parser->range + busflag_na, na - busflag_na); if (parser->dma) From patchwork Thu Oct 26 13:53:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 158552 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp693023vqb; Thu, 26 Oct 2023 06:56:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFvFJyyMu5TqqWbNIrbuuPnp1dVeifZ+cyyHha2DOjyGmNCEssc+wu6DbwHtgAeALUARsog X-Received: by 2002:a25:50d1:0:b0:d85:e0d4:1c31 with SMTP id e200-20020a2550d1000000b00d85e0d41c31mr4190927ybb.7.1698328595343; Thu, 26 Oct 2023 06:56:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698328595; cv=none; d=google.com; s=arc-20160816; b=tF4fDA823fKI+Wxz9NCxWmTcKCmVXK4t3AIHMi+mNe/NNPyFNwYmW3wmoCD6LgNPnP bi+Ph6+jBHZmNRgCXP3hJEbqmxotJOAE6kaOSkAdgtU9jNBOQZsZYtVWPYzSx7K3S53u LW1oxbucbG4b82RELBtr6U3BoCKpwiTjLfQNNFxng9nZnSViDKBkHH5LvruYXOyWa8em f0ThqvZx19cmZ11In/xe643FmCuxv2QaTk3RSXKrB46qhYBMdnJboK3RVGEaIVca1FRx AUUJ83HP3rD5cTw9xv9pYEGZPT6atrsJ/TgQV/3gT4jmhLYhwpFWaYJxsgrmFEaHkAkG tYVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=yvFrN6RkHOEg6+kdZIT7qu8F7MiUG3qfKprWNC+gw7c=; fh=Ck1OhWEfvon+cMUr/uMs0xQ+NN16OOlklgt8Gan93ys=; b=qDf0wvUIGV6DcA2GzFcOazFlSczcI9N6Y111PvOSYa50ZtiANcGBpFHXYCn6WruAaw qdShtFVUscu7o/lamMbTbShnTNvlLzde9ihZ5xCPb+6KCrWKWFfRpGOpWwCfHRFE9DJi lRUWmusvyyPQvJok6P6yZAjOYJcB4WQ977htSgKJPcqmd6IOlFrxTRQiWTPaC7qvC0yF MrSK61t+sNqD0wtIP9A0rzScUPx5fm7/RbWTmvjwtZLZId2Z6jTi8yMb6sw63qL35fzi haacvm3x39ZhNPIsChq19xDesCn/9cDRXDLsNVaUH7oQXrd+9C5fAOQ4A9ixCnOfZgmx pwWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id d190-20020a2568c7000000b00da06fb414eesi5397737ybc.46.2023.10.26.06.56.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 06:56:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E1B90818ABFC; Thu, 26 Oct 2023 06:56:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345180AbjJZN4I (ORCPT + 26 others); Thu, 26 Oct 2023 09:56:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235052AbjJZNz7 (ORCPT ); Thu, 26 Oct 2023 09:55:59 -0400 Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6488AD54; Thu, 26 Oct 2023 06:55:55 -0700 (PDT) Received: by mail-oi1-f179.google.com with SMTP id 5614622812f47-3b2e07e5f3aso1028053b6e.0; Thu, 26 Oct 2023 06:55:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698328555; x=1698933355; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yvFrN6RkHOEg6+kdZIT7qu8F7MiUG3qfKprWNC+gw7c=; b=TPeTS3TPM3mZZ8D9Nc8qM165TuuUqTe41UnfTanHe3MFeL6BFpw9f5I32+bXaVIr+n psvMGRGBqyOwijwUGsxDNW6aAU91tITFDXEeATcs60omZjOGplWc2ei5VPbggKtrif7z VDovKClQLVsxWCKWApk2JiJCVhhKYrp6ClT6fjafeE4wthdDYfF5ZSANOfcyMEM5vo2H Q9ABWX9oQYwX43pLuMfWquiVnb8KkH94AQqV8yfrrqdBTZ+Uq13VPJkqdG2+Oj7g0G3/ s+S0H1aI8xBPut+Wmm0VZ6FQn4ihAopVZyM76BFTgZQm4MY4XfakfeKdlJIhSAKyqyUx gI8w== X-Gm-Message-State: AOJu0YwXyHtR5qP2/SFXlRaSlt4cNTyhZ7XF/MD+1cirQ7OjCn5lDcJ7 IEFjsJir1qqEXXe+LsHO1bF5HVKXjA== X-Received: by 2002:a05:6808:24f:b0:3b2:f4a2:e7fc with SMTP id m15-20020a056808024f00b003b2f4a2e7fcmr1541559oie.25.1698328554938; Thu, 26 Oct 2023 06:55:54 -0700 (PDT) Received: from herring.priv (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id z18-20020a056808029200b003b2f369a932sm2763797oic.49.2023.10.26.06.55.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 06:55:54 -0700 (PDT) Received: (nullmailer pid 3566879 invoked by uid 1000); Thu, 26 Oct 2023 13:55:53 -0000 From: Rob Herring To: Frank Rowand Cc: Herve Codina , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] of: address: Consolidate bus .map() functions Date: Thu, 26 Oct 2023 08:53:59 -0500 Message-ID: <20231026135358.3564307-3-robh@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231026135358.3564307-2-robh@kernel.org> References: <20231026135358.3564307-2-robh@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 26 Oct 2023 06:56:19 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780826605293578724 X-GMAIL-MSGID: 1780826605293578724 The bus .map() functions vary only by checking the flag cells values and skipping over any flag cells to read the addresses. Otherwise they all do the same reading 'ranges' address and size and returning the address's offset if it is within the 'ranges' entry. Refactor all the .map() functions to pass in the flag cell size so that each bus can check the bus specific flags and then call a common function to do everything else. Signed-off-by: Rob Herring Acked-by: Herve Codina --- drivers/of/address.c | 54 +++++++++----------------------------------- 1 file changed, 11 insertions(+), 43 deletions(-) diff --git a/drivers/of/address.c b/drivers/of/address.c index 997f431af165..b59956310f66 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -43,7 +43,7 @@ struct of_bus { void (*count_cells)(struct device_node *child, int *addrc, int *sizec); u64 (*map)(__be32 *addr, const __be32 *range, - int na, int ns, int pna); + int na, int ns, int pna, int fna); int (*translate)(__be32 *addr, u64 offset, int na); int flag_cells; unsigned int (*get_flags)(const __be32 *addr); @@ -63,13 +63,13 @@ static void of_bus_default_count_cells(struct device_node *dev, } static u64 of_bus_default_map(__be32 *addr, const __be32 *range, - int na, int ns, int pna) + int na, int ns, int pna, int fna) { u64 cp, s, da; - cp = of_read_number(range, na); + cp = of_read_number(range + fna, na - fna); s = of_read_number(range + na + pna, ns); - da = of_read_number(addr, na); + da = of_read_number(addr + fna, na - fna); pr_debug("default map, cp=%llx, s=%llx, da=%llx\n", cp, s, da); @@ -101,24 +101,13 @@ static unsigned int of_bus_default_get_flags(const __be32 *addr) } static u64 of_bus_default_flags_map(__be32 *addr, const __be32 *range, int na, - int ns, int pna) + int ns, int pna, int fna) { - u64 cp, s, da; - /* Check that flags match */ if (*addr != *range) return OF_BAD_ADDR; - /* Read address values, skipping high cell */ - cp = of_read_number(range + 1, na - 1); - s = of_read_number(range + na + pna, ns); - da = of_read_number(addr + 1, na - 1); - - pr_debug("default flags map, cp=%llx, s=%llx, da=%llx\n", cp, s, da); - - if (da < cp || da >= (cp + s)) - return OF_BAD_ADDR; - return da - cp; + return of_bus_default_map(addr, range, na, ns, pna, fna); } static int of_bus_default_flags_translate(__be32 *addr, u64 offset, int na) @@ -192,9 +181,8 @@ static void of_bus_pci_count_cells(struct device_node *np, } static u64 of_bus_pci_map(__be32 *addr, const __be32 *range, int na, int ns, - int pna) + int pna, int fna) { - u64 cp, s, da; unsigned int af, rf; af = of_bus_pci_get_flags(addr); @@ -204,16 +192,7 @@ static u64 of_bus_pci_map(__be32 *addr, const __be32 *range, int na, int ns, if ((af ^ rf) & (IORESOURCE_MEM | IORESOURCE_IO)) return OF_BAD_ADDR; - /* Read address values, skipping high cell */ - cp = of_read_number(range + 1, na - 1); - s = of_read_number(range + na + pna, ns); - da = of_read_number(addr + 1, na - 1); - - pr_debug("PCI map, cp=%llx, s=%llx, da=%llx\n", cp, s, da); - - if (da < cp || da >= (cp + s)) - return OF_BAD_ADDR; - return da - cp; + return of_bus_default_map(addr, range, na, ns, pna, fna); } #endif /* CONFIG_PCI */ @@ -319,24 +298,13 @@ static void of_bus_isa_count_cells(struct device_node *child, } static u64 of_bus_isa_map(__be32 *addr, const __be32 *range, int na, int ns, - int pna) + int pna, int fna) { - u64 cp, s, da; - /* Check address type match */ if ((addr[0] ^ range[0]) & cpu_to_be32(1)) return OF_BAD_ADDR; - /* Read address values, skipping high cell */ - cp = of_read_number(range + 1, na - 1); - s = of_read_number(range + na + pna, ns); - da = of_read_number(addr + 1, na - 1); - - pr_debug("ISA map, cp=%llx, s=%llx, da=%llx\n", cp, s, da); - - if (da < cp || da >= (cp + s)) - return OF_BAD_ADDR; - return da - cp; + return of_bus_default_map(addr, range, na, ns, pna, fna); } static unsigned int of_bus_isa_get_flags(const __be32 *addr) @@ -486,7 +454,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, rlen /= 4; rone = na + pna + ns; for (; rlen >= rone; rlen -= rone, ranges += rone) { - offset = bus->map(addr, ranges, na, ns, pna); + offset = bus->map(addr, ranges, na, ns, pna, bus->flag_cells); if (offset != OF_BAD_ADDR) break; }