All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-rockchip][PATCH] Fix Rock Pi 4 serial port
@ 2020-12-11 14:47 Joshua Watt
  2020-12-11 15:16 ` [yocto] " Bruce Ashfield
  2020-12-17 16:57 ` Trevor Woerner
  0 siblings, 2 replies; 5+ messages in thread
From: Joshua Watt @ 2020-12-11 14:47 UTC (permalink / raw)
  To: yocto; +Cc: twoerner, Joshua Watt

Fixes the serial port output stopping mid way through the boot process
by reverting the kernel commit that caused it.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 ...-resolve-supply-after-creating-regul.patch | 53 +++++++++++++++++++
 recipes-kernel/linux/linux-yocto_5.8.bbappend |  4 ++
 2 files changed, 57 insertions(+)
 create mode 100644 recipes-kernel/linux/linux-yocto/0001-Revert-regulator-resolve-supply-after-creating-regul.patch
 create mode 100644 recipes-kernel/linux/linux-yocto_5.8.bbappend

diff --git a/recipes-kernel/linux/linux-yocto/0001-Revert-regulator-resolve-supply-after-creating-regul.patch b/recipes-kernel/linux/linux-yocto/0001-Revert-regulator-resolve-supply-after-creating-regul.patch
new file mode 100644
index 0000000..3dd336b
--- /dev/null
+++ b/recipes-kernel/linux/linux-yocto/0001-Revert-regulator-resolve-supply-after-creating-regul.patch
@@ -0,0 +1,53 @@
+From a414d39b848002e15531f2538d2b6427ce51d07d Mon Sep 17 00:00:00 2001
+From: Joshua Watt <JPEWhacker@gmail.com>
+Date: Thu, 10 Dec 2020 15:59:47 -0600
+Subject: [PATCH] Revert "regulator: resolve supply after creating regulator"
+
+This commit prevents the serial console from working on the Rock Pi 4
+for some reason. It *appears* to possibly be fixed by some other commit
+upstream, but after a lot of head scratching and bisecting, I was unable
+to find which one, so just revert it for now and we can deal with it
+later.
+
+This reverts commit 96c6b5d5775637b3095ef934f871044811fd4db7.
+
+---
+ drivers/regulator/core.c | 21 ++++++++-------------
+ 1 file changed, 8 insertions(+), 13 deletions(-)
+
+diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
+index 25e601bf9383..be8c709a7488 100644
+--- a/drivers/regulator/core.c
++++ b/drivers/regulator/core.c
+@@ -5187,20 +5187,15 @@ regulator_register(const struct regulator_desc *regulator_desc,
+ 	else if (regulator_desc->supply_name)
+ 		rdev->supply_name = regulator_desc->supply_name;
+ 
++	/*
++	 * Attempt to resolve the regulator supply, if specified,
++	 * but don't return an error if we fail because we will try
++	 * to resolve it again later as more regulators are added.
++	 */
++	if (regulator_resolve_supply(rdev))
++		rdev_dbg(rdev, "unable to resolve supply\n");
++
+ 	ret = set_machine_constraints(rdev, constraints);
+-	if (ret == -EPROBE_DEFER) {
+-		/* Regulator might be in bypass mode and so needs its supply
+-		 * to set the constraints */
+-		/* FIXME: this currently triggers a chicken-and-egg problem
+-		 * when creating -SUPPLY symlink in sysfs to a regulator
+-		 * that is just being created */
+-		ret = regulator_resolve_supply(rdev);
+-		if (!ret)
+-			ret = set_machine_constraints(rdev, constraints);
+-		else
+-			rdev_dbg(rdev, "unable to resolve supply early: %pe\n",
+-				 ERR_PTR(ret));
+-	}
+ 	if (ret < 0)
+ 		goto wash;
+ 
+-- 
+2.29.2
+
diff --git a/recipes-kernel/linux/linux-yocto_5.8.bbappend b/recipes-kernel/linux/linux-yocto_5.8.bbappend
new file mode 100644
index 0000000..5a31842
--- /dev/null
+++ b/recipes-kernel/linux/linux-yocto_5.8.bbappend
@@ -0,0 +1,4 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI_append_rock-pi-4 = " file://0001-Revert-regulator-resolve-supply-after-creating-regul.patch"
+
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [yocto] [meta-rockchip][PATCH] Fix Rock Pi 4 serial port
  2020-12-11 14:47 [meta-rockchip][PATCH] Fix Rock Pi 4 serial port Joshua Watt
@ 2020-12-11 15:16 ` Bruce Ashfield
  2020-12-11 15:55   ` Joshua Watt
  2020-12-17 16:57 ` Trevor Woerner
  1 sibling, 1 reply; 5+ messages in thread
From: Bruce Ashfield @ 2020-12-11 15:16 UTC (permalink / raw)
  To: Joshua Watt; +Cc: yocto, Trevor Woerner

On Fri, Dec 11, 2020 at 9:48 AM Joshua Watt <JPEWhacker@gmail.com> wrote:
>
> Fixes the serial port output stopping mid way through the boot process
> by reverting the kernel commit that caused it.

If you want, I can also pick this up and merge it directly into
linux-yocto and do a SRCREV bump.

Have you tested against 5.10 ? I'm working through issues with it now,
and it would be nice to fix this before it pops up again on the next
reference kernel bump.

Cheers,

Bruce

>
> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> ---
>  ...-resolve-supply-after-creating-regul.patch | 53 +++++++++++++++++++
>  recipes-kernel/linux/linux-yocto_5.8.bbappend |  4 ++
>  2 files changed, 57 insertions(+)
>  create mode 100644 recipes-kernel/linux/linux-yocto/0001-Revert-regulator-resolve-supply-after-creating-regul.patch
>  create mode 100644 recipes-kernel/linux/linux-yocto_5.8.bbappend
>
> diff --git a/recipes-kernel/linux/linux-yocto/0001-Revert-regulator-resolve-supply-after-creating-regul.patch b/recipes-kernel/linux/linux-yocto/0001-Revert-regulator-resolve-supply-after-creating-regul.patch
> new file mode 100644
> index 0000000..3dd336b
> --- /dev/null
> +++ b/recipes-kernel/linux/linux-yocto/0001-Revert-regulator-resolve-supply-after-creating-regul.patch
> @@ -0,0 +1,53 @@
> +From a414d39b848002e15531f2538d2b6427ce51d07d Mon Sep 17 00:00:00 2001
> +From: Joshua Watt <JPEWhacker@gmail.com>
> +Date: Thu, 10 Dec 2020 15:59:47 -0600
> +Subject: [PATCH] Revert "regulator: resolve supply after creating regulator"
> +
> +This commit prevents the serial console from working on the Rock Pi 4
> +for some reason. It *appears* to possibly be fixed by some other commit
> +upstream, but after a lot of head scratching and bisecting, I was unable
> +to find which one, so just revert it for now and we can deal with it
> +later.
> +
> +This reverts commit 96c6b5d5775637b3095ef934f871044811fd4db7.
> +
> +---
> + drivers/regulator/core.c | 21 ++++++++-------------
> + 1 file changed, 8 insertions(+), 13 deletions(-)
> +
> +diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> +index 25e601bf9383..be8c709a7488 100644
> +--- a/drivers/regulator/core.c
> ++++ b/drivers/regulator/core.c
> +@@ -5187,20 +5187,15 @@ regulator_register(const struct regulator_desc *regulator_desc,
> +       else if (regulator_desc->supply_name)
> +               rdev->supply_name = regulator_desc->supply_name;
> +
> ++      /*
> ++       * Attempt to resolve the regulator supply, if specified,
> ++       * but don't return an error if we fail because we will try
> ++       * to resolve it again later as more regulators are added.
> ++       */
> ++      if (regulator_resolve_supply(rdev))
> ++              rdev_dbg(rdev, "unable to resolve supply\n");
> ++
> +       ret = set_machine_constraints(rdev, constraints);
> +-      if (ret == -EPROBE_DEFER) {
> +-              /* Regulator might be in bypass mode and so needs its supply
> +-               * to set the constraints */
> +-              /* FIXME: this currently triggers a chicken-and-egg problem
> +-               * when creating -SUPPLY symlink in sysfs to a regulator
> +-               * that is just being created */
> +-              ret = regulator_resolve_supply(rdev);
> +-              if (!ret)
> +-                      ret = set_machine_constraints(rdev, constraints);
> +-              else
> +-                      rdev_dbg(rdev, "unable to resolve supply early: %pe\n",
> +-                               ERR_PTR(ret));
> +-      }
> +       if (ret < 0)
> +               goto wash;
> +
> +--
> +2.29.2
> +
> diff --git a/recipes-kernel/linux/linux-yocto_5.8.bbappend b/recipes-kernel/linux/linux-yocto_5.8.bbappend
> new file mode 100644
> index 0000000..5a31842
> --- /dev/null
> +++ b/recipes-kernel/linux/linux-yocto_5.8.bbappend
> @@ -0,0 +1,4 @@
> +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
> +
> +SRC_URI_append_rock-pi-4 = " file://0001-Revert-regulator-resolve-supply-after-creating-regul.patch"
> +
> --
> 2.29.2
>
>
> 
>


--
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [yocto] [meta-rockchip][PATCH] Fix Rock Pi 4 serial port
  2020-12-11 15:16 ` [yocto] " Bruce Ashfield
@ 2020-12-11 15:55   ` Joshua Watt
  2020-12-11 15:59     ` Bruce Ashfield
  0 siblings, 1 reply; 5+ messages in thread
From: Joshua Watt @ 2020-12-11 15:55 UTC (permalink / raw)
  To: Bruce Ashfield; +Cc: yocto, Trevor Woerner


On 12/11/20 9:16 AM, Bruce Ashfield wrote:
> On Fri, Dec 11, 2020 at 9:48 AM Joshua Watt <JPEWhacker@gmail.com> wrote:
>> Fixes the serial port output stopping mid way through the boot process
>> by reverting the kernel commit that caused it.
> If you want, I can also pick this up and merge it directly into
> linux-yocto and do a SRCREV bump.
>
> Have you tested against 5.10 ? I'm working through issues with it now,
> and it would be nice to fix this before it pops up again on the next
> reference kernel bump.

When I use `linux-yocto-dev` as the kernel provider, it works just fine 
(in fact, I can't seem to find the commit that *fixes* the problem 
there....), so I think 5.10 will be OK? Is there something else I should 
try instead?


I'm not sure if we want to backport it to linux-yocto or not... I 
presume upstream backported it because it fixed something, so I'd be a 
little worried about a regression somewhere else.

>
> Cheers,
>
> Bruce
>
>> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
>> ---
>>   ...-resolve-supply-after-creating-regul.patch | 53 +++++++++++++++++++
>>   recipes-kernel/linux/linux-yocto_5.8.bbappend |  4 ++
>>   2 files changed, 57 insertions(+)
>>   create mode 100644 recipes-kernel/linux/linux-yocto/0001-Revert-regulator-resolve-supply-after-creating-regul.patch
>>   create mode 100644 recipes-kernel/linux/linux-yocto_5.8.bbappend
>>
>> diff --git a/recipes-kernel/linux/linux-yocto/0001-Revert-regulator-resolve-supply-after-creating-regul.patch b/recipes-kernel/linux/linux-yocto/0001-Revert-regulator-resolve-supply-after-creating-regul.patch
>> new file mode 100644
>> index 0000000..3dd336b
>> --- /dev/null
>> +++ b/recipes-kernel/linux/linux-yocto/0001-Revert-regulator-resolve-supply-after-creating-regul.patch
>> @@ -0,0 +1,53 @@
>> +From a414d39b848002e15531f2538d2b6427ce51d07d Mon Sep 17 00:00:00 2001
>> +From: Joshua Watt <JPEWhacker@gmail.com>
>> +Date: Thu, 10 Dec 2020 15:59:47 -0600
>> +Subject: [PATCH] Revert "regulator: resolve supply after creating regulator"
>> +
>> +This commit prevents the serial console from working on the Rock Pi 4
>> +for some reason. It *appears* to possibly be fixed by some other commit
>> +upstream, but after a lot of head scratching and bisecting, I was unable
>> +to find which one, so just revert it for now and we can deal with it
>> +later.
>> +
>> +This reverts commit 96c6b5d5775637b3095ef934f871044811fd4db7.
>> +
>> +---
>> + drivers/regulator/core.c | 21 ++++++++-------------
>> + 1 file changed, 8 insertions(+), 13 deletions(-)
>> +
>> +diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
>> +index 25e601bf9383..be8c709a7488 100644
>> +--- a/drivers/regulator/core.c
>> ++++ b/drivers/regulator/core.c
>> +@@ -5187,20 +5187,15 @@ regulator_register(const struct regulator_desc *regulator_desc,
>> +       else if (regulator_desc->supply_name)
>> +               rdev->supply_name = regulator_desc->supply_name;
>> +
>> ++      /*
>> ++       * Attempt to resolve the regulator supply, if specified,
>> ++       * but don't return an error if we fail because we will try
>> ++       * to resolve it again later as more regulators are added.
>> ++       */
>> ++      if (regulator_resolve_supply(rdev))
>> ++              rdev_dbg(rdev, "unable to resolve supply\n");
>> ++
>> +       ret = set_machine_constraints(rdev, constraints);
>> +-      if (ret == -EPROBE_DEFER) {
>> +-              /* Regulator might be in bypass mode and so needs its supply
>> +-               * to set the constraints */
>> +-              /* FIXME: this currently triggers a chicken-and-egg problem
>> +-               * when creating -SUPPLY symlink in sysfs to a regulator
>> +-               * that is just being created */
>> +-              ret = regulator_resolve_supply(rdev);
>> +-              if (!ret)
>> +-                      ret = set_machine_constraints(rdev, constraints);
>> +-              else
>> +-                      rdev_dbg(rdev, "unable to resolve supply early: %pe\n",
>> +-                               ERR_PTR(ret));
>> +-      }
>> +       if (ret < 0)
>> +               goto wash;
>> +
>> +--
>> +2.29.2
>> +
>> diff --git a/recipes-kernel/linux/linux-yocto_5.8.bbappend b/recipes-kernel/linux/linux-yocto_5.8.bbappend
>> new file mode 100644
>> index 0000000..5a31842
>> --- /dev/null
>> +++ b/recipes-kernel/linux/linux-yocto_5.8.bbappend
>> @@ -0,0 +1,4 @@
>> +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
>> +
>> +SRC_URI_append_rock-pi-4 = " file://0001-Revert-regulator-resolve-supply-after-creating-regul.patch"
>> +
>> --
>> 2.29.2
>>
>>
>> 
>>
>
> --
> - Thou shalt not follow the NULL pointer, for chaos and madness await
> thee at its end
> - "Use the force Harry" - Gandalf, Star Trek II

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [yocto] [meta-rockchip][PATCH] Fix Rock Pi 4 serial port
  2020-12-11 15:55   ` Joshua Watt
@ 2020-12-11 15:59     ` Bruce Ashfield
  0 siblings, 0 replies; 5+ messages in thread
From: Bruce Ashfield @ 2020-12-11 15:59 UTC (permalink / raw)
  To: Joshua Watt; +Cc: yocto, Trevor Woerner

On Fri, Dec 11, 2020 at 10:55 AM Joshua Watt <jpewhacker@gmail.com> wrote:
>
>
> On 12/11/20 9:16 AM, Bruce Ashfield wrote:
> > On Fri, Dec 11, 2020 at 9:48 AM Joshua Watt <JPEWhacker@gmail.com> wrote:
> >> Fixes the serial port output stopping mid way through the boot process
> >> by reverting the kernel commit that caused it.
> > If you want, I can also pick this up and merge it directly into
> > linux-yocto and do a SRCREV bump.
> >
> > Have you tested against 5.10 ? I'm working through issues with it now,
> > and it would be nice to fix this before it pops up again on the next
> > reference kernel bump.
>
> When I use `linux-yocto-dev` as the kernel provider, it works just fine
> (in fact, I can't seem to find the commit that *fixes* the problem
> there....), so I think 5.10 will be OK? Is there something else I should
> try instead?
>

Nope, that should be enough to show that it has already been addressed
upstream. By default, you'll get a v5.10-rc with -dev in master, so
that confirms the fix.

>
> I'm not sure if we want to backport it to linux-yocto or not... I
> presume upstream backported it because it fixed something, so I'd be a
> little worried about a regression somewhere else.
>

True that. And the time spent to prove that, or identify the fix isn't
worth it (since 5.8 is going away).  If this was a longer term
version, I'd create a BSP branch and we could isolate it that way, but
again, just not worth the wrangling.

Bruce

> >
> > Cheers,
> >
> > Bruce
> >
> >> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> >> ---
> >>   ...-resolve-supply-after-creating-regul.patch | 53 +++++++++++++++++++
> >>   recipes-kernel/linux/linux-yocto_5.8.bbappend |  4 ++
> >>   2 files changed, 57 insertions(+)
> >>   create mode 100644 recipes-kernel/linux/linux-yocto/0001-Revert-regulator-resolve-supply-after-creating-regul.patch
> >>   create mode 100644 recipes-kernel/linux/linux-yocto_5.8.bbappend
> >>
> >> diff --git a/recipes-kernel/linux/linux-yocto/0001-Revert-regulator-resolve-supply-after-creating-regul.patch b/recipes-kernel/linux/linux-yocto/0001-Revert-regulator-resolve-supply-after-creating-regul.patch
> >> new file mode 100644
> >> index 0000000..3dd336b
> >> --- /dev/null
> >> +++ b/recipes-kernel/linux/linux-yocto/0001-Revert-regulator-resolve-supply-after-creating-regul.patch
> >> @@ -0,0 +1,53 @@
> >> +From a414d39b848002e15531f2538d2b6427ce51d07d Mon Sep 17 00:00:00 2001
> >> +From: Joshua Watt <JPEWhacker@gmail.com>
> >> +Date: Thu, 10 Dec 2020 15:59:47 -0600
> >> +Subject: [PATCH] Revert "regulator: resolve supply after creating regulator"
> >> +
> >> +This commit prevents the serial console from working on the Rock Pi 4
> >> +for some reason. It *appears* to possibly be fixed by some other commit
> >> +upstream, but after a lot of head scratching and bisecting, I was unable
> >> +to find which one, so just revert it for now and we can deal with it
> >> +later.
> >> +
> >> +This reverts commit 96c6b5d5775637b3095ef934f871044811fd4db7.
> >> +
> >> +---
> >> + drivers/regulator/core.c | 21 ++++++++-------------
> >> + 1 file changed, 8 insertions(+), 13 deletions(-)
> >> +
> >> +diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> >> +index 25e601bf9383..be8c709a7488 100644
> >> +--- a/drivers/regulator/core.c
> >> ++++ b/drivers/regulator/core.c
> >> +@@ -5187,20 +5187,15 @@ regulator_register(const struct regulator_desc *regulator_desc,
> >> +       else if (regulator_desc->supply_name)
> >> +               rdev->supply_name = regulator_desc->supply_name;
> >> +
> >> ++      /*
> >> ++       * Attempt to resolve the regulator supply, if specified,
> >> ++       * but don't return an error if we fail because we will try
> >> ++       * to resolve it again later as more regulators are added.
> >> ++       */
> >> ++      if (regulator_resolve_supply(rdev))
> >> ++              rdev_dbg(rdev, "unable to resolve supply\n");
> >> ++
> >> +       ret = set_machine_constraints(rdev, constraints);
> >> +-      if (ret == -EPROBE_DEFER) {
> >> +-              /* Regulator might be in bypass mode and so needs its supply
> >> +-               * to set the constraints */
> >> +-              /* FIXME: this currently triggers a chicken-and-egg problem
> >> +-               * when creating -SUPPLY symlink in sysfs to a regulator
> >> +-               * that is just being created */
> >> +-              ret = regulator_resolve_supply(rdev);
> >> +-              if (!ret)
> >> +-                      ret = set_machine_constraints(rdev, constraints);
> >> +-              else
> >> +-                      rdev_dbg(rdev, "unable to resolve supply early: %pe\n",
> >> +-                               ERR_PTR(ret));
> >> +-      }
> >> +       if (ret < 0)
> >> +               goto wash;
> >> +
> >> +--
> >> +2.29.2
> >> +
> >> diff --git a/recipes-kernel/linux/linux-yocto_5.8.bbappend b/recipes-kernel/linux/linux-yocto_5.8.bbappend
> >> new file mode 100644
> >> index 0000000..5a31842
> >> --- /dev/null
> >> +++ b/recipes-kernel/linux/linux-yocto_5.8.bbappend
> >> @@ -0,0 +1,4 @@
> >> +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
> >> +
> >> +SRC_URI_append_rock-pi-4 = " file://0001-Revert-regulator-resolve-supply-after-creating-regul.patch"
> >> +
> >> --
> >> 2.29.2
> >>
> >>
> >> 
> >>
> >
> > --
> > - Thou shalt not follow the NULL pointer, for chaos and madness await
> > thee at its end
> > - "Use the force Harry" - Gandalf, Star Trek II



-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [meta-rockchip][PATCH] Fix Rock Pi 4 serial port
  2020-12-11 14:47 [meta-rockchip][PATCH] Fix Rock Pi 4 serial port Joshua Watt
  2020-12-11 15:16 ` [yocto] " Bruce Ashfield
@ 2020-12-17 16:57 ` Trevor Woerner
  1 sibling, 0 replies; 5+ messages in thread
From: Trevor Woerner @ 2020-12-17 16:57 UTC (permalink / raw)
  To: Joshua Watt; +Cc: yocto

On Fri 2020-12-11 @ 08:47:52 AM, Joshua Watt wrote:
> Fixes the serial port output stopping mid way through the boot process
> by reverting the kernel commit that caused it.

Interesting.

As you know (but for reference for other people) the baud rate of the rock pi
4's serial console is 1,500,000bps and not the usual 115,200bps that
everything else uses.

I have *always* seen instability on the console. The best way to reproduce
this instability is with the following test:

	root@rock-pi-4:~# cd /
	root@rock-pi-4:/# ls -lR

This never lasts more than a second or two before freezing up.

The ironic thing is, before applying this patch I thought I'd give the latest
of everything a test (I don't test every change every day on my board).

With all the latest software but before applying your patch, I just went
through 5 cycles of:
	- reboot
	- ls -lR

I didn't see a single freeze-up on the console! I've never seen the console
survive the ls -lR thing, nevermind 5 in a row.

Weird.

I did, however, recently change the device I'm using to supply my USB-C power.
I had noticed my last power supply was flaky, my local computer shop had some
new fandangled ones on sale, so I upgraded.

In any case I'm happy to apply the patch, if it solves a problem for you then
others are likely to bump into it as well. But interesting nonetheless.

Best regards,
	Trevor

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-12-17 16:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-11 14:47 [meta-rockchip][PATCH] Fix Rock Pi 4 serial port Joshua Watt
2020-12-11 15:16 ` [yocto] " Bruce Ashfield
2020-12-11 15:55   ` Joshua Watt
2020-12-11 15:59     ` Bruce Ashfield
2020-12-17 16:57 ` Trevor Woerner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.