diff mbox

mtrr: fix mtrr checking without devices that are under bridges

Message ID 1344941416-11122-1-git-send-email-ivan.hu@canonical.com
State Accepted
Headers show

Commit Message

Ivan Hu Aug. 14, 2012, 10:50 a.m. UTC
The issue seems that only check the bridges, doesn't check the devices under
the bridges. This causes the test fail. Fix the parser PCI Bus char and
prfetchable char.

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/bios/mtrr/mtrr.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Keng-Yu Lin Aug. 16, 2012, 3:04 a.m. UTC | #1
Hi Ivan,
  Can you attach the failure.log too?

  Thanks,
-kengyu

On Tue, Aug 14, 2012 at 6:50 PM, Ivan Hu <ivan.hu@canonical.com> wrote:
> The issue seems that only check the bridges, doesn't check the devices under
> the bridges. This causes the test fail. Fix the parser PCI Bus char and
> prfetchable char.
>
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/bios/mtrr/mtrr.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c
> index 4818c64..5bb27b8 100644
> --- a/src/bios/mtrr/mtrr.c
> +++ b/src/bios/mtrr/mtrr.c
> @@ -356,11 +356,11 @@ static int is_prefetchable(fwts_framework *fw, char *device, uint64_t address)
>         fwts_list_foreach(item, lspci_output) {
>                 char *str = strstr(fwts_text_list_text(item), "Memory at ");
>                 if (str && strtoull(str+10, NULL, 16) == address) {
> -                       if (strstr(str, "Non-Prefetchable"))
> +                       if (strstr(str, "non-prefetchable"))
>                                 pref = 0;
> -                       else if (strstr(str, "(Prefetchable"))
> +                       else if (strstr(str, "(prefetchable"))
>                                 pref = 1;
> -                       else if (strstr(str, ", Prefetchable"))
> +                       else if (strstr(str, ", prefetchable"))
>                                 pref = 1;
>                 }
>         }
> @@ -419,7 +419,7 @@ static int validate_iomem(fwts_framework *fw)
>                  * For pci bridges, we note the increased depth and
>                  * otherwise skip the entry
>                  */
> -               if (strstr(buffer, ": PCI Bus #")) {
> +               if (strstr(buffer, ": PCI Bus ")) {
>                         pcidepth++;
>                         continue;
>                 }
> --
> 1.7.9.5
>
>
> --
> fwts-devel mailing list
> fwts-devel@lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/fwts-devel
Ivan Hu Aug. 16, 2012, 3:10 a.m. UTC | #2
Hi kengyu,

log is attached.

Best regards,
Ivan

On 08/16/2012 11:04 AM, Keng-Yu Lin wrote:
> Hi Ivan,
>    Can you attach the failure.log too?
>
>    Thanks,
> -kengyu
>
> On Tue, Aug 14, 2012 at 6:50 PM, Ivan Hu <ivan.hu@canonical.com> wrote:
>> The issue seems that only check the bridges, doesn't check the devices under
>> the bridges. This causes the test fail. Fix the parser PCI Bus char and
>> prfetchable char.
>>
>> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
>> ---
>>   src/bios/mtrr/mtrr.c |    8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c
>> index 4818c64..5bb27b8 100644
>> --- a/src/bios/mtrr/mtrr.c
>> +++ b/src/bios/mtrr/mtrr.c
>> @@ -356,11 +356,11 @@ static int is_prefetchable(fwts_framework *fw, char *device, uint64_t address)
>>          fwts_list_foreach(item, lspci_output) {
>>                  char *str = strstr(fwts_text_list_text(item), "Memory at ");
>>                  if (str && strtoull(str+10, NULL, 16) == address) {
>> -                       if (strstr(str, "Non-Prefetchable"))
>> +                       if (strstr(str, "non-prefetchable"))
>>                                  pref = 0;
>> -                       else if (strstr(str, "(Prefetchable"))
>> +                       else if (strstr(str, "(prefetchable"))
>>                                  pref = 1;
>> -                       else if (strstr(str, ", Prefetchable"))
>> +                       else if (strstr(str, ", prefetchable"))
>>                                  pref = 1;
>>                  }
>>          }
>> @@ -419,7 +419,7 @@ static int validate_iomem(fwts_framework *fw)
>>                   * For pci bridges, we note the increased depth and
>>                   * otherwise skip the entry
>>                   */
>> -               if (strstr(buffer, ": PCI Bus #")) {
>> +               if (strstr(buffer, ": PCI Bus ")) {
>>                          pcidepth++;
>>                          continue;
>>                  }
>> --
>> 1.7.9.5
>>
>>
>> --
>> fwts-devel mailing list
>> fwts-devel@lists.ubuntu.com
>> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/fwts-devel
>
Colin Ian King Aug. 17, 2012, 12:37 p.m. UTC | #3
On 14/08/12 11:50, Ivan Hu wrote:
> The issue seems that only check the bridges, doesn't check the devices under
> the bridges. This causes the test fail. Fix the parser PCI Bus char and
> prfetchable char.
>
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>   src/bios/mtrr/mtrr.c |    8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c
> index 4818c64..5bb27b8 100644
> --- a/src/bios/mtrr/mtrr.c
> +++ b/src/bios/mtrr/mtrr.c
> @@ -356,11 +356,11 @@ static int is_prefetchable(fwts_framework *fw, char *device, uint64_t address)
>   	fwts_list_foreach(item, lspci_output) {
>   		char *str = strstr(fwts_text_list_text(item), "Memory at ");
>   		if (str && strtoull(str+10, NULL, 16) == address) {
> -			if (strstr(str, "Non-Prefetchable"))
> +			if (strstr(str, "non-prefetchable"))
>   				pref = 0;
> -			else if (strstr(str, "(Prefetchable"))
> +			else if (strstr(str, "(prefetchable"))
>   				pref = 1;
> -			else if (strstr(str, ", Prefetchable"))
> +			else if (strstr(str, ", prefetchable"))
>   				pref = 1;
>   		}
>   	}
> @@ -419,7 +419,7 @@ static int validate_iomem(fwts_framework *fw)
>   		 * For pci bridges, we note the increased depth and
>   		 * otherwise skip the entry
>    		 */
> -		if (strstr(buffer, ": PCI Bus #")) {
> +		if (strstr(buffer, ": PCI Bus ")) {
>   			pcidepth++;
>   			continue;
>   		}
>
I wonder if this is a regression because of changes in the output of 
lspci?  Does this break on earlier releases?
Ivan Hu Aug. 21, 2012, 6:27 a.m. UTC | #4
On 08/17/2012 08:37 PM, Colin Ian King wrote:
> On 14/08/12 11:50, Ivan Hu wrote:
>> The issue seems that only check the bridges, doesn't check the devices
>> under
>> the bridges. This causes the test fail. Fix the parser PCI Bus char and
>> prfetchable char.
>>
>> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
>> ---
>>   src/bios/mtrr/mtrr.c |    8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c
>> index 4818c64..5bb27b8 100644
>> --- a/src/bios/mtrr/mtrr.c
>> +++ b/src/bios/mtrr/mtrr.c
>> @@ -356,11 +356,11 @@ static int is_prefetchable(fwts_framework *fw,
>> char *device, uint64_t address)
>>       fwts_list_foreach(item, lspci_output) {
>>           char *str = strstr(fwts_text_list_text(item), "Memory at ");
>>           if (str && strtoull(str+10, NULL, 16) == address) {
>> -            if (strstr(str, "Non-Prefetchable"))
>> +            if (strstr(str, "non-prefetchable"))
>>                   pref = 0;
>> -            else if (strstr(str, "(Prefetchable"))
>> +            else if (strstr(str, "(prefetchable"))
>>                   pref = 1;
>> -            else if (strstr(str, ", Prefetchable"))
>> +            else if (strstr(str, ", prefetchable"))
>>                   pref = 1;
>>           }
>>       }
>> @@ -419,7 +419,7 @@ static int validate_iomem(fwts_framework *fw)
>>            * For pci bridges, we note the increased depth and
>>            * otherwise skip the entry
>>             */
>> -        if (strstr(buffer, ": PCI Bus #")) {
>> +        if (strstr(buffer, ": PCI Bus ")) {
>>               pcidepth++;
>>               continue;
>>           }
>>
> I wonder if this is a regression because of changes in the output of
> lspci?  Does this break on earlier releases?
>
>

I've checked release 11.10. It also breaks on the release 11.10.

Ivan
Alex Hung Aug. 23, 2012, 7:31 a.m. UTC | #5
On 08/14/2012 06:50 PM, Ivan Hu wrote:
> The issue seems that only check the bridges, doesn't check the devices under
> the bridges. This causes the test fail. Fix the parser PCI Bus char and
> prfetchable char.
>
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>   src/bios/mtrr/mtrr.c |    8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c
> index 4818c64..5bb27b8 100644
> --- a/src/bios/mtrr/mtrr.c
> +++ b/src/bios/mtrr/mtrr.c
> @@ -356,11 +356,11 @@ static int is_prefetchable(fwts_framework *fw, char *device, uint64_t address)
>   	fwts_list_foreach(item, lspci_output) {
>   		char *str = strstr(fwts_text_list_text(item), "Memory at ");
>   		if (str && strtoull(str+10, NULL, 16) == address) {
> -			if (strstr(str, "Non-Prefetchable"))
> +			if (strstr(str, "non-prefetchable"))
>   				pref = 0;
> -			else if (strstr(str, "(Prefetchable"))
> +			else if (strstr(str, "(prefetchable"))
>   				pref = 1;
> -			else if (strstr(str, ", Prefetchable"))
> +			else if (strstr(str, ", prefetchable"))
>   				pref = 1;
>   		}
>   	}
> @@ -419,7 +419,7 @@ static int validate_iomem(fwts_framework *fw)
>   		 * For pci bridges, we note the increased depth and
>   		 * otherwise skip the entry
>    		 */
> -		if (strstr(buffer, ": PCI Bus #")) {
> +		if (strstr(buffer, ": PCI Bus ")) {
>   			pcidepth++;
>   			continue;
>   		}
>
Acked-by: Alex Hung <alex.hung@canonical.com>
diff mbox

Patch

diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c
index 4818c64..5bb27b8 100644
--- a/src/bios/mtrr/mtrr.c
+++ b/src/bios/mtrr/mtrr.c
@@ -356,11 +356,11 @@  static int is_prefetchable(fwts_framework *fw, char *device, uint64_t address)
 	fwts_list_foreach(item, lspci_output) {
 		char *str = strstr(fwts_text_list_text(item), "Memory at ");
 		if (str && strtoull(str+10, NULL, 16) == address) {
-			if (strstr(str, "Non-Prefetchable"))
+			if (strstr(str, "non-prefetchable"))
 				pref = 0;
-			else if (strstr(str, "(Prefetchable"))
+			else if (strstr(str, "(prefetchable"))
 				pref = 1;
-			else if (strstr(str, ", Prefetchable"))
+			else if (strstr(str, ", prefetchable"))
 				pref = 1;
 		}
 	}
@@ -419,7 +419,7 @@  static int validate_iomem(fwts_framework *fw)
 		 * For pci bridges, we note the increased depth and
 		 * otherwise skip the entry
  		 */
-		if (strstr(buffer, ": PCI Bus #")) {
+		if (strstr(buffer, ": PCI Bus ")) {
 			pcidepth++;
 			continue;
 		}