From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c05::229; helo=mail-pg0-x229.google.com; envelope-from=haojian.zhuang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pg0-x229.google.com (mail-pg0-x229.google.com [IPv6:2607:f8b0:400e:c05::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2D19E203BA4EB for ; Wed, 23 May 2018 00:14:22 -0700 (PDT) Received: by mail-pg0-x229.google.com with SMTP id p9-v6so8991197pgc.9 for ; Wed, 23 May 2018 00:14:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:thread-topic:thread-index:date:message-id :references:in-reply-to:accept-language:content-language :content-transfer-encoding:mime-version; bh=OrFeMqxpMRdTXSe08pX7a1wdDbpcAQDm7EAFldQGc1Q=; b=O1xwJP07ZcwpMn5tR8FSFEbzdkt7zKh0DOYrZesDp4xIQWlaDMOW9u2kQW4tHC5uw0 i9B/Kofa2K6qpd45qLqvJ2VoWC+714+XkAWmwIErq3dnPRPe4YdAleG/RilN8NPLKKkd pXdfUsAfajpRpkzvt2Ge/JUHoJuS059tPhhNo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:thread-topic:thread-index :date:message-id:references:in-reply-to:accept-language :content-language:content-transfer-encoding:mime-version; bh=OrFeMqxpMRdTXSe08pX7a1wdDbpcAQDm7EAFldQGc1Q=; b=SaPxEH6350YTn4USawFCfAP8Ey/VuMIuCfOmwR1Q6PPvzaoPFhu3UHVLW2KHufooKh 5PKkyYq4/nG4HSnfRXVO173xK3NzrFM3tzO1bFQTKd2HAhkmlQLp/irdUjsaB3rbKxUb hFUBF5+Pa2wpjxMi1awHKjO0kdjpOEeLkaFrTK5sWKZn1cZjGa7q6TZCxV1NeguVYyK1 aDlnIWDKAzURrBVcF9Iha14HlGPDXt3Etw2gNEgbWaG8l9EjjZF3bDHwpl25q/gYwJ/A gPYjO2cY6jR0UimD5Kwf4TlXaG8mwbb7Xb6WdwIq+NmZB21/jzbMHDvKv6FcRNpSb7gg eVyg== X-Gm-Message-State: ALKqPwcyshzVRkhnvVk4H7fc9bc7m44Uv/1ge5RCLp62NZf/wJ1DlKLC GjoSaOVJ2abMBijC/CgD93TIxg== X-Google-Smtp-Source: AB8JxZrOkjhCLf+Bkjk36sy+gt9zk9Tm3Lhn3T5o471rScedDueokt/Vuwpo+nSc6NrY0nPiqNjEfg== X-Received: by 2002:a62:2f44:: with SMTP id v65-v6mr1701287pfv.83.1527059661693; Wed, 23 May 2018 00:14:21 -0700 (PDT) Received: from CY1PR15MB0730.namprd15.prod.outlook.com ([132.245.253.237]) by smtp.gmail.com with ESMTPSA id b29-v6sm34236665pfh.155.2018.05.23.00.14.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 May 2018 00:14:20 -0700 (PDT) From: Haojian Zhuang To: Leif Lindholm , Haojian Zhuang CC: "edk2-devel@lists.01.org" , Ard Biesheuvel Thread-Topic: [edk2][PATCH edk2-platforms v4 2/6] Platform/HiKey960: do basic initialization Thread-Index: AQHT6zznYbdOW/Mtx0eSIa4LGzrCNaQ5+W6AgAL5TrA= X-MS-Exchange-MessageSentRepresentingType: 2 Date: Wed, 23 May 2018 07:14:18 +0000 Message-ID: References: <1526272473-25565-1-git-send-email-haojian.zhuang@linaro.org> <1526272473-25565-3-git-send-email-haojian.zhuang@linaro.org>, <20180521094155.cpufarav5f6kqcfu@bivouac.eciton.net> In-Reply-To: <20180521094155.cpufarav5f6kqcfu@bivouac.eciton.net> Accept-Language: en-US X-MS-Has-Attach: X-MS-Exchange-Organization-SCL: -1 X-MS-TNEF-Correlator: X-MS-Exchange-Organization-RecordReviewCfmType: 0 MIME-Version: 1.0 Subject: Re: [PATCH edk2-platforms v4 2/6] Platform/HiKey960: do basic initialization X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 May 2018 07:14:22 -0000 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable >> +STATIC=0A= >> +VOID=0A= >> +OnEndOfDxe (=0A= >> + IN EFI_EVENT Event,=0A= >> + IN VOID *Context=0A= >> + )=0A= >> +{=0A= >> + UINT32 BootMode;=0A= >> +=0A= >> + BootMode =3D MmioRead32 (SCTRL_BAK_DATA0) & BOOT_MODE_MASK;=0A= >> + if (BootMode =3D=3D BOOT_MODE_RECOVERY) {=0A= >> + SerialPortWrite ((UINT8 *)"WARNING: CAN NOT BOOT KERNEL IN RECOVERY= MODE!\r\n", 48);=0A= >> + SerialPortWrite ((UINT8 *)"Switch to normal boot mode, then reboot = to boot kernel.\r\n", 57);=0A= > =0A= > I commented on v1:=0A= > ---=0A= > 1) Why this use of SerialPortWrite instead of Print?=0A= > 2) This cast to (UINT8 *) works by accident. Please don't do this.=0A= > 3) Please _never_ use hand-coded values for compile-time determined=0A= > (and known) information. In this case the output string length.=0A= > ---=0A= > Please change to Print().=0A= > =0A= =0A= I can't use Print() at here since console isn't ready. The OnEndOfDxe() is = executed=0A= before console ready. SerialPortWrite () is the only choice to me.=0A= =0A= I'll fix other issues with comments.=0A= =0A= Best Regards=0A= Haojian=