From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1mBll3-0004sw-DH for mharc-grub-devel@gnu.org; Thu, 05 Aug 2021 18:22:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBll1-0004rW-Ub for grub-devel@gnu.org; Thu, 05 Aug 2021 18:22:31 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:31474) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBlkz-0000ds-NK for grub-devel@gnu.org; Thu, 05 Aug 2021 18:22:31 -0400 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 175MDNrD060133; Thu, 5 Aug 2021 18:22:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=2B0/QP01IaV535Bo3FWdQwBRYJJPW4QvtxNXnpCzp00=; b=WgcmqqIEq9YSzu+rlGtYien6QYp1qOa8HreglBNhzZ+ErM3g3s3Za11t8q7jPUJmAcdi cwwr0HNQxkbkBEe3L1SCiEyC8e7jD5r2LapgmIrC7FWOKEDtGsHS427RSvUptWjHtsqU OccsV1zbOqU52oLfhBCXFHmvA4PtNJcn2+lYe6n0fJAlDhAKJL14cbNuNTVVhXHKlSaM AH/YpMKL1tYVw9pf4BjvgkIvy6LpsUzxrV54VxpDOiWW6yrjDVAC8x4juT5vhAGrDU34 mKFr4EZRsEqDPaTuoE4Ft7tw3ZEDTQ4M20mJ8T4yhmNmH4Yz/dGDs+wjptffN4vtSIH0 xg== Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com with ESMTP id 3a8m9u68pa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 05 Aug 2021 18:22:26 -0400 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 175MBkaU005435; Thu, 5 Aug 2021 22:22:25 GMT Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by ppma01dal.us.ibm.com with ESMTP id 3a4x5gqapb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 05 Aug 2021 22:22:25 +0000 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 175MMOJl34210234 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 5 Aug 2021 22:22:24 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8B4C22805C; Thu, 5 Aug 2021 22:22:24 +0000 (GMT) Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 54D9228058; Thu, 5 Aug 2021 22:22:24 +0000 (GMT) Received: from [9.47.158.152] (unknown [9.47.158.152]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 5 Aug 2021 22:22:24 +0000 (GMT) Subject: Re: [PATCH v3 1/4] ieee1275: Move #defines into common ieee1275.h header To: The development of GNU GRUB , Stefan Berger Cc: dkiper@net-space.pl, Eric Snowberg References: <20210730154540.3085221-1-stefanb@linux.vnet.ibm.com> <20210730154540.3085221-2-stefanb@linux.vnet.ibm.com> From: Stefan Berger Message-ID: <3ea47fa0-0780-e6d6-dd7d-ef7e77e5333f@linux.ibm.com> Date: Thu, 5 Aug 2021 18:22:24 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210730154540.3085221-2-stefanb@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-GUID: O1NF0DUPzCnzJi2dcSoMF4t784PXTvwF X-Proofpoint-ORIG-GUID: O1NF0DUPzCnzJi2dcSoMF4t784PXTvwF X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-08-05_11:2021-08-05, 2021-08-05 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 priorityscore=1501 phishscore=0 adultscore=0 impostorscore=0 clxscore=1015 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108050129 Received-SPF: pass client-ip=148.163.158.5; envelope-from=stefanb@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.132, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 22:22:32 -0000 On 7/30/21 11:45 AM, Stefan Berger wrote: > From: Stefan Berger > > Move some #defines from ieee1275.c into the common ieee1275.h > header file. Adjust the case used in IHANDLE_INVALID to use > proper ihandle_t. > > Signed-off-by: Stefan Berger > --- > grub-core/kern/ieee1275/ieee1275.c | 29 ++++++++++++----------------- > include/grub/ieee1275/ieee1275.h | 3 +++ > 2 files changed, 15 insertions(+), 17 deletions(-) > > diff --git a/grub-core/kern/ieee1275/ieee1275.c b/grub-core/kern/ieee1275/ieee1275.c > index 86f81a3c4..8fe92274d 100644 > --- a/grub-core/kern/ieee1275/ieee1275.c > +++ b/grub-core/kern/ieee1275/ieee1275.c > @@ -21,11 +21,6 @@ > #include > #include > > -#define IEEE1275_PHANDLE_INVALID ((grub_ieee1275_cell_t) -1) > -#define IEEE1275_IHANDLE_INVALID ((grub_ieee1275_cell_t) 0) > -#define IEEE1275_CELL_INVALID ((grub_ieee1275_cell_t) -1) > - > - > I think it's safer to keep these here  because of how the sizes for the grub_ieee1275_cell_t are defined: # grep -r grub_ieee1275_cell include/grub/ | grep typedef include/grub/powerpc/ieee1275/ieee1275.h:typedef grub_uint32_t grub_ieee1275_cell_t; include/grub/sparc64/ieee1275/ieee1275.h:typedef grub_uint64_t grub_ieee1275_cell_t; # grep -r grub_ieee1275_phandle include/grub/ | grep typedef include/grub/ieee1275/ieee1275.h:typedef grub_uint32_t grub_ieee1275_phandle_t; # grep -r grub_ieee1275_ihandle include/grub/ | grep typedef include/grub/ieee1275/ieee1275.h:typedef grub_uint32_t grub_ieee1275_ihandle_t; # grep -r GRUB_IEEE1275_PH include/grub/| grep def include/grub/ieee1275/ieee1275.h:#define GRUB_IEEE1275_PHANDLE_INVALID  ((grub_ieee1275_phandle_t) -1) Using the global GRUB_IEEE1275_PHANDLE_INVALID here would probably break things on sparc64 if we now use 32bit '-1' rather than 64bit '-1'.     Stefan > int > grub_ieee1275_finddevice (const char *name, grub_ieee1275_phandle_t *phandlep) > @@ -44,8 +39,7 @@ grub_ieee1275_finddevice (const char *name, grub_ieee1275_phandle_t *phandlep) > if (IEEE1275_CALL_ENTRY_FN (&args) == -1) > return -1; > *phandlep = args.phandle; > - if (args.phandle == IEEE1275_PHANDLE_INVALID) > - return -1; > + if (args.phandle == GRUB_IEEE1275_PHANDLE_INVALID) return -1; > return 0; > } > > @@ -75,7 +69,7 @@ grub_ieee1275_get_property (grub_ieee1275_phandle_t phandle, > return -1; > if (actual) > *actual = (grub_ssize_t) args.size; > - if (args.size == IEEE1275_CELL_INVALID) > + if (args.size == GRUB_IEEE1275_CELL_INVALID) > return -1; > return 0; > } > @@ -146,7 +140,7 @@ grub_ieee1275_get_property_length (grub_ieee1275_phandle_t phandle, > if (IEEE1275_CALL_ENTRY_FN (&args) == -1) > return -1; > *length = args.length; > - if (args.length == IEEE1275_CELL_INVALID) > + if (args.length == GRUB_IEEE1275_CELL_INVALID) > return -1; > return 0; > } > @@ -169,7 +163,7 @@ grub_ieee1275_instance_to_package (grub_ieee1275_ihandle_t ihandle, > if (IEEE1275_CALL_ENTRY_FN (&args) == -1) > return -1; > *phandlep = args.phandle; > - if (args.phandle == IEEE1275_PHANDLE_INVALID) > + if (args.phandle == GRUB_IEEE1275_PHANDLE_INVALID) > return -1; > return 0; > } > @@ -198,7 +192,7 @@ grub_ieee1275_package_to_path (grub_ieee1275_phandle_t phandle, > return -1; > if (actual) > *actual = args.actual; > - if (args.actual == IEEE1275_CELL_INVALID) > + if (args.actual == GRUB_IEEE1275_CELL_INVALID) > return -1; > return 0; > } > @@ -227,7 +221,7 @@ grub_ieee1275_instance_to_path (grub_ieee1275_ihandle_t ihandle, > return -1; > if (actual) > *actual = args.actual; > - if (args.actual == IEEE1275_CELL_INVALID) > + if (args.actual == GRUB_IEEE1275_CELL_INVALID) > return -1; > return 0; > } > @@ -355,7 +349,7 @@ grub_ieee1275_child (grub_ieee1275_phandle_t node, > > INIT_IEEE1275_COMMON (&args.common, "child", 1, 1); > args.node = node; > - args.result = IEEE1275_PHANDLE_INVALID; > + args.result = GRUB_IEEE1275_PHANDLE_INVALID; > > if (IEEE1275_CALL_ENTRY_FN (&args) == -1) > return -1; > @@ -379,7 +373,7 @@ grub_ieee1275_parent (grub_ieee1275_phandle_t node, > > INIT_IEEE1275_COMMON (&args.common, "parent", 1, 1); > args.node = node; > - args.result = IEEE1275_PHANDLE_INVALID; > + args.result = GRUB_IEEE1275_PHANDLE_INVALID; > > if (IEEE1275_CALL_ENTRY_FN (&args) == -1) > return -1; > @@ -459,7 +453,7 @@ grub_ieee1275_open (const char *path, grub_ieee1275_ihandle_t *result) > if (IEEE1275_CALL_ENTRY_FN (&args) == -1) > return -1; > *result = args.result; > - if (args.result == IEEE1275_IHANDLE_INVALID) > + if (args.result == GRUB_IEEE1275_IHANDLE_INVALID) > return -1; > return 0; > } > @@ -591,7 +585,7 @@ grub_ieee1275_claim (grub_addr_t addr, grub_size_t size, unsigned int align, > return -1; > if (result) > *result = args.base; > - if (args.base == IEEE1275_CELL_INVALID) > + if (args.base == GRUB_IEEE1275_CELL_INVALID) > return -1; > return 0; > } > @@ -641,7 +635,8 @@ grub_ieee1275_set_property (grub_ieee1275_phandle_t phandle, > if (IEEE1275_CALL_ENTRY_FN (&args) == -1) > return -1; > *actual = args.actual; > - if ((args.actual == IEEE1275_CELL_INVALID) || (args.actual != args.size)) > + if ((args.actual == GRUB_IEEE1275_CELL_INVALID) || > + (args.actual != args.size)) > return -1; > return 0; > } > diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h > index 73e2f4644..b963ee830 100644 > --- a/include/grub/ieee1275/ieee1275.h > +++ b/include/grub/ieee1275/ieee1275.h > @@ -24,6 +24,8 @@ > #include > #include > > +#define GRUB_IEEE1275_CELL_INVALID ((grub_ieee1275_cell_t) -1) > + > struct grub_ieee1275_mem_region > { > unsigned int start; > @@ -58,6 +60,7 @@ typedef grub_uint32_t grub_ieee1275_ihandle_t; > typedef grub_uint32_t grub_ieee1275_phandle_t; > > #define GRUB_IEEE1275_PHANDLE_INVALID ((grub_ieee1275_phandle_t) -1) > +#define GRUB_IEEE1275_IHANDLE_INVALID ((grub_ieee1275_ihandle_t) 0) > > struct grub_ieee1275_devalias > {