Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: patches for RDC pcidevs, rdcpcib driver and Vortex86 SoCs identification



There's a mistake in rdcpicb.c patch. Last ID duplicated, should be {
PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6036_PCIB}.

diff --git a/sys/arch/x86/pci/rdcpcib.c b/sys/arch/x86/pci/rdcpcib.c
index a5d521f8a50..4c4c659716c 100644
--- a/sys/arch/x86/pci/rdcpcib.c
+++ b/sys/arch/x86/pci/rdcpcib.c
@@ -25,7 +25,7 @@
  */

 /*
- * driver for the RDC vortex86/PMX-1000 SoC PCI-ISA bridge, which also drives
+ * driver for the RDC Vortex86 SoC family PCI-ISA bridge, which also drives
  * the watchdog timer
  */

@@ -87,19 +87,32 @@ static void rdc_wdtimer_start(struct rdcpcib_softc *);
 CFATTACH_DECL2_NEW(rdcpcib, sizeof(struct rdcpcib_softc),
     rdcpcibmatch, rdcpcibattach, rdcpcibdetach, NULL,
     pcibrescan, pcibchilddet);
+
+static const struct rdcpcib_device {
+       pcireg_t vendor, product;
+} rdcpcib_devices[] = {
+       { PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6011_PCIB},
+       { PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6013_PCIB},
+       { PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6031_PCIB},
+       { PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6035_PCIB},
+       { PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6036_PCIB},
+};

On Mon, Apr 6, 2020 at 11:50 PM Andrius V <vezhlys%gmail.com@localhost> wrote:
>
> Hi,
>
> I updated pcidevs list with RDC devices from various DM&P SoCs.
> Additionally, by doing this exercise I noticed that there's a custom
> rdcpcib driver which configures watchdog timer (WDT0). This driver
> actually is needed for all Vortex86 SoCs, since all of them has the
> same configuration regarding first watchdog timer (and similar with
> the second one, but it's not being enabled specifically in the
> driver). I changed the driver to match all currently known PCIBs.
> Finally I updated the CPU identification to add EX2 (it's surely
> working but since I am not that familiar with C and bitwise
> operations, not sure if it's the best approach). Everything was tested
> on Vortex86DX3, Vortex86EX2.
>
> pcidevs+rdcpcib:
>
> diff --git a/sys/dev/pci/pcidevs b/sys/dev/pci/pcidevs
> index 12434bb23b3..b353d2a0b2a 100644
> --- a/sys/dev/pci/pcidevs
> +++ b/sys/dev/pci/pcidevs
> @@ -7067,13 +7067,28 @@ product RALINK  RT5390_5        0x539f  RT5390
>  product RATOC  REXPCI31        0x0853  REX PCI-31/33 SCSI
>
>  /* RDC Semiconductor products */
> -product RDC    R1010_IDE       0x1010  R1010 IDE controller
> -product RDC    R1011_IDE       0x1011  R1011 IDE controller
> -product RDC    R1012_IDE       0x1012  R1012 IDE controller
> +product RDC    R1010_IDE       0x1010  R1010 IDE Controller
> +product RDC    R1011_IDE       0x1011  R1011 IDE Controller
> +product RDC    R1012_IDE       0x1012  R1012 IDE Controller
> +product RDC    R1031_PPB       0x1031  R1031 PCI-PCIE Bridge
> +product RDC    R1060_USBD      0x1060  R1060 USB Device
> +product RDC    R1061_USBD      0x1061  R1061 USB Device
> +product RDC    R1070_CAN       0x1070  R1070 CANbus
> +product RDC    R1331_MC        0x1331  R1331 Motion Control
> +product RDC    R1710_SPI       0x1710  R1710 SPI
> +product RDC    R1930_HBRD      0x1930  R1930 Hybrid Function Control Register
> +product RDC    R2010_VGA       0x2010  R2010 VGA Controller
> +product RDC    R2012_VGA       0x2012  R2012 VGA Controller
> +product RDC    R2015_VGA       0x2015  R2015 VGA Controller
> +product RDC    R6011_PCIB      0x6011  R6011 PCI-ISA bridge
> +product RDC    R6013_PCIB      0x6013  R6013 PCI-ISA bridge
>  product RDC    R6021_HB        0x6021  R6021 Host
> +product RDC    R6023_HB        0x6023  R6023 Host
>  product RDC    R6025_HB        0x6025  R6025 Host
> -product RDC    R6031_ISA       0x6031  R6031 PCI-ISA bridge
> -product RDC    PCIB            0x6036  R6036 PCI-ISA bridge
> +product RDC    R6026_HB        0x6026  R6026 Host
> +product RDC    R6031_PCIB      0x6031  R6031 PCI-ISA bridge
> +product RDC    R6035_PCIB      0x6035  R6035 PCI-ISA bridge
> +product RDC    R6036_PCIB      0x6036  R6036 PCI-ISA bridge
>  product RDC    R6040           0x6040  R6040 10/100 Ethernet
>  product RDC    R6060_OHCI      0x6060  R6060 USB OHCI
>  product RDC    R6061_EHCI      0x6061  R6061 USB EHCI
>
> diff --git a/sys/arch/x86/pci/rdcpcib.c b/sys/arch/x86/pci/rdcpcib.c
> index a5d521f8a50..4c4c659716c 100644
> --- a/sys/arch/x86/pci/rdcpcib.c
> +++ b/sys/arch/x86/pci/rdcpcib.c
> @@ -25,7 +25,7 @@
>   */
>
>  /*
> - * driver for the RDC vortex86/PMX-1000 SoC PCI-ISA bridge, which also drives
> + * driver for the RDC Vortex86 SoC family PCI-ISA bridge, which also drives
>   * the watchdog timer
>   */
>
> @@ -87,19 +87,32 @@ static void rdc_wdtimer_start(struct rdcpcib_softc *);
>  CFATTACH_DECL2_NEW(rdcpcib, sizeof(struct rdcpcib_softc),
>      rdcpcibmatch, rdcpcibattach, rdcpcibdetach, NULL,
>      pcibrescan, pcibchilddet);
> +
> +static const struct rdcpcib_device {
> +       pcireg_t vendor, product;
> +} rdcpcib_devices[] = {
> +       { PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6011_PCIB},
> +       { PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6013_PCIB},
> +       { PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6031_PCIB},
> +       { PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6035_PCIB},
> +       { PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6035_PCIB},
> +};
>
>  static int
>  rdcpcibmatch(device_t parent, cfdata_t match, void *aux)
>  {
>         struct pci_attach_args *pa = aux;
> +       const struct rdcpcib_device *rdcpcib_dev;
>
>         if (PCI_CLASS(pa->pa_class) != PCI_CLASS_BRIDGE ||
>             PCI_SUBCLASS(pa->pa_class) != PCI_SUBCLASS_BRIDGE_ISA)
>                 return 0;
>
> -       if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_RDC &&
> -           PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_RDC_PCIB)
> +       for (rdcpcib_dev = rdcpcib_devices; rdcpcib_dev->vendor;
> ++rdcpcib_dev) {
> +               if (PCI_VENDOR(pa->pa_id) == rdcpcib_dev->vendor &&
> +                   PCI_PRODUCT(pa->pa_id) == rdcpcib_dev->product)
>                         return 10;
> +       }
>
>         return 0;
>  }
>
> CPU identification:
>
> diff --git a/sys/arch/x86/x86/identcpu.c b/sys/arch/x86/x86/identcpu.c
> index 80f7e403a37..5c52635825f 100644
> --- a/sys/arch/x86/x86/identcpu.c
> +++ b/sys/arch/x86/x86/identcpu.c
> @@ -704,7 +704,7 @@ cpu_probe_vortex86(struct cpu_info *ci)
>  #define PCI_MODE1_DATA_REG     0x0cfc
>  #define PCI_MODE1_ENABLE       0x80000000UL
>
> -       uint32_t reg;
> +       uint32_t reg, idx;
>
>         if (cpu_vendor != CPUVENDOR_VORTEX86)
>                 return;
> @@ -718,17 +718,18 @@ cpu_probe_vortex86(struct cpu_info *ci)
>         outl(PCI_MODE1_ADDRESS_REG, PCI_MODE1_ENABLE | 0x90);
>         reg = inl(PCI_MODE1_DATA_REG);
>
> -       if ((reg & 0xf8ffffff) != 0x30504d44) {
> -               reg = 0;
> +       if ((reg & 0xf0ffffff) != 0x30504d44) {
> +               idx = 0;
>         } else {
> -               reg = (reg >> 24) & 7;
> +               idx = (reg >> 24) & 0x0f;
>         }
>
>         static const char *cpu_vortex86_flavor[] = {
> -           "??", "SX", "DX", "MX", "DX2", "MX+", "DX3", "EX",
> +           "??", "SX", "DX", "MX", "DX2", "MX+", "DX3", "EX", "EX2"
>         };
> +       idx = sizeof(cpu_vortex86_flavor) > idx ? idx : 0;
>         snprintf(cpu_brand_string, sizeof(cpu_brand_string), "Vortex86%s",
> -           cpu_vortex86_flavor[reg]);
> +           cpu_vortex86_flavor[idx]);
>
>  #undef PCI_MODE1_ENABLE
>  #undef PCI_MODE1_ADDRESS_REG


Home | Main Index | Thread Index | Old Index