Re: Hyper-V

2019-02-13 Thread Kimihiro Nonaka
On Tue, Feb 12, 2019 at 11:17 PM Kamil Rytarowski  wrote:

> Is it viable to get merged the Hyper-V support for NetBSD-9?

I'd like to merge it to NetBSD 9.
I'm working on moving Hyper-V releated drivers to sys/dev/hyperv from
sys/arch/x86.

-- 
Kimihiro Nonaka


Re: Power-cycle a usb port

2017-04-16 Thread Kimihiro Nonaka
Hi

On Sun, Apr 16, 2017 at 10:56 PM, Emmanuel Dreyfus  wrote:

> I already asked the question hidden at the end of another message [1]:
> can we power-cycle a USB port? My understanding is that we have no way
> of doing it from userland, but what about from kernel? Even if the capability
> is hardware-dependent, it would be nice to have an ioctl to power off/power
> on a USB port.

There is a patch using sysctl.

Regards,
-- 
Kimihiro Nonaka

uhub(4): Add port power control sysctl node.

diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c
index e5a9a13d710..33d3004ed5a 100644
--- a/sys/dev/usb/uhub.c
+++ b/sys/dev/usb/uhub.c
@@ -116,6 +116,8 @@ struct uhub_softc {
int  sc_explorepending;
 
u_char   sc_running;
+
+   struct sysctllog*sc_clog;
 };
 
 #define UHUB_IS_HIGH_SPEED(sc) \
@@ -127,7 +129,8 @@ struct uhub_softc {
 
 Static usbd_status uhub_explore(struct usbd_device *);
 Static void uhub_intr(struct usbd_xfer *, void *, usbd_status);
-
+Static int uhub_sysctl_port_power(SYSCTLFN_PROTO);
+Static int uhub_sysctl_port_reset(SYSCTLFN_PROTO);
 
 /*
  * We need two attachment points:
@@ -261,6 +264,8 @@ uhub_attach(device_t parent, device_t self, void *aux)
struct usbd_interface *iface;
usb_endpoint_descriptor_t *ed;
struct usbd_tt *tts = NULL;
+   const struct sysctlnode *rnode, *cnode, *node;
+   int error;
 
UHUBHIST_FUNC(); UHUBHIST_CALLED();
 
@@ -458,6 +463,58 @@ uhub_attach(device_t parent, device_t self, void *aux)
if (dev->ud_powersrc->up_parent != NULL)
usbd_delay_ms(dev, pwrdly);
 
+   /* Port power */
+   if ((dev->ud_hub->uh_hubdesc.wHubCharacteristics[0] & UHD_PWR) >=
+   UHD_PWR_NO_SWITCH)
+   goto sysctl_done;
+   if ((error = sysctl_createv(&sc->sc_clog, 0, NULL, &rnode,
+   CTLFLAG_PERMANENT, CTLTYPE_NODE, "uhub",
+   SYSCTL_DESCR("uhub global controls"),
+   NULL, 0, NULL, 0, CTL_HW, CTL_CREATE, CTL_EOL)) != 0) {
+   aprint_normal_dev(sc->sc_dev,
+   "couldn't create uhub global sysctl node\n");
+   goto sysctl_done;
+   }
+   if ((error = sysctl_createv(&sc->sc_clog, 0, &rnode, &rnode,
+   0, CTLTYPE_NODE, device_xname(self),
+   SYSCTL_DESCR("per uhub controls"),
+   NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL)) != 0) {
+   aprint_normal_dev(sc->sc_dev,
+   "couldn't create uhub sysctl node\n");
+   goto sysctl_done;
+   }
+   for (port = 1; port <= nports; port++) {
+   char buf[8];
+   snprintf(buf, sizeof(buf), "port%d", port);
+   if ((error = sysctl_createv(&sc->sc_clog, 0, &rnode, &cnode,
+   0, CTLTYPE_NODE, buf,
+   SYSCTL_DESCR("uhub port controls"),
+   NULL, 0, NULL, 0, port, CTL_EOL)) != 0) {
+   aprint_normal_dev(sc->sc_dev,
+   "couldn't create uhub port sysctl node\n");
+   goto sysctl_done;
+   }
+   if ((error = sysctl_createv(&sc->sc_clog, 0, &cnode, &node,
+   CTLFLAG_READWRITE, CTLTYPE_INT, "power",
+   SYSCTL_DESCR("uhub port power control"),
+   uhub_sysctl_port_power, 0, (void *)sc, 0,
+   CTL_CREATE, CTL_EOL)) != 0) {
+   aprint_normal_dev(sc->sc_dev,
+   "couldn't create uhub port power sysctl node\n");
+   goto sysctl_done;
+   }
+   if ((error = sysctl_createv(&sc->sc_clog, 0, &cnode, &node,
+   CTLFLAG_READWRITE, CTLTYPE_INT, "reset",
+   SYSCTL_DESCR("uhub port reset control"),
+   uhub_sysctl_port_reset, 0, (void *)sc, 0,
+   CTL_CREATE, CTL_EOL)) != 0) {
+   aprint_normal_dev(sc->sc_dev,
+   "couldn't create uhub port reset sysctl node\n");
+   goto sysctl_done;
+   }
+   }
+sysctl_done:
+
/* The usual exploration will finish the setup. */
 
sc->sc_running = 1;
@@ -468,6 +525,7 @@ uhub_attach(device_t parent, device_t self, void *aux)
return;
 
  bad:
+   sysctl_teardown(&sc->sc_clog);
if (sc->sc_status)
kmem_free(sc->sc_status, sc->sc_statuslen);
if (sc->sc_statuspend)
@@ -822,6 +880,8 @@ uhub_detach(device_t self, int flags)
/* XXXSMP usb */
KERNEL_LOCK(1, curlwp);
 
+   sysctl_teardown(&sc->sc_clog);
+

Re: EFI native support on amd64

2016-12-08 Thread Kimihiro Nonaka
Hi,

2016-12-09 7:09 GMT+09:00 Alexander Nasonov :

>> http://cdn.netbsd.org/pub/NetBSD/misc/nonaka/efiboot/
>
> Hi Kimihiro,
>
> That's cool! I can boot from your bootloader. The compilation fails,
> though:
>
> /home/alnsn/netbsd-current/tooldir.amd64/bin/x86_64--netbsd-ld: cannot
> find startprog32.o: No such file or directory

I updated the patches.

Regards,
-- 
Kimihiro Nonaka


Re: EFI native support on amd64

2016-12-08 Thread Kimihiro Nonaka
Hi,

2016-12-08 18:35 GMT+09:00 Alexander Nasonov :

> I see some pieces of EFI in the base (gnu-efi, grub support) but
> no complete native support. If I remember correctly, someone worked
> on it but I don't have any link to their work. Are there any patches
> I can hack on further?

I'm working on efiboot.

http://cdn.netbsd.org/pub/NetBSD/misc/nonaka/efiboot/

Regards,
-- 
Kimihiro Nonaka


Re: device-major question

2016-05-11 Thread Kimihiro Nonaka
2016-05-11 15:41 GMT+09:00 Nick Hudson :

> I'd be happy (as a tegra owner/user) to move hdmicec to 206. I don't think
> hdmicec is use anywhere else yet.

char 206 is already used by seeprom.

- sys/conf/majors
device-major seeprom char 206 seeprom
-

Regards,
-- 
NONAKA Kimihiro


device-major question

2016-05-10 Thread Kimihiro Nonaka
Hi,

I found hdmicec and MI com use same device-major "char 260".
Would it be acceptable?

- sys/conf/majors
device-major hdmicec   char 260hdmicec
-

- sys/conf/majors.tty
device-majorcom char 260com
-

Regards,
-- 
NONAKA Kimihiro