{"action":"created","comment":{"url":"https://api.github.com/repos/otcshare/contiki-x86/pulls/comments/40460964","id":40460964,"diff_hunk":"@@ -62,18 +62,58 @@ pci_config_read(pci_config_addr_t addr)\n }\n /*---------------------------------------------------------------------------*/\n /**\n+ * \\brief       Write to the specified PCI configuration register.\n+ * \\param addr  Address of PCI configuration register.\n+ * \\param value Value to be written on PCI configuration register.\n+ */\n+void\n+pci_config_write(pci_config_addr_t addr, uint32_t value)\n+{\n+  set_addr(addr);\n+\n+  outl(PCI_CONFIG_DATA_PORT, value);\n+}\n+/*---------------------------------------------------------------------------*/\n+/**\n+ * \\brief       Enable PCI command bits of the specified PCI configuration register.\n+ * \\param addr  Address of PCI configuration register.\n+ * \\param flags Flags used to enable PCI command bits.\n+ */\n+void\n+pci_command_enable(pci_config_addr_t pci_addr, uint32_t flags)\n+{\n+  pci_config_addr_t pci;\n+  uint32_t pci_data;\n+\n+  pci.raw = 0;\n+  pci.bus = pci_addr.bus;\n+  pci.dev = pci_addr.dev;\n+  pci.func = pci_addr.func;\n+  pci.reg_off = 0x04; /* PCI COMMAND_REGISTER */\n+\n+  pci_data = pci_config_read(pci);\n+\n+  pci_data = pci_data | flags;\n+\n+  pci_config_write(pci, pci_data);\n+}\n+/*---------------------------------------------------------------------------*/\n+/**\n  * \\brief          Initialize a structure for a PCI device driver that performs\n  *                 MMIO to address range 0.  Assumes that device has already\n  *                 been configured with an MMIO address range 0, e.g. by\n  *                 firmware.\n  * \\param c_this   Structure that will be initialized to represent the driver.\n  * \\param pci_addr PCI base address of device.\n+ * \\param bar      Base Address Register (BAR) address.\n  */\n void\n-pci_init_bar0(pci_driver_t *c_this, pci_config_addr_t pci_addr)\n+pci_init(pci_driver_t *c_this, pci_config_addr_t pci_addr, uint8_t bar)\n {\n-  pci_addr.reg_off = PCI_CONFIG_REG_BAR0;\n-  /* The BAR0 value is masked to clear non-address bits. */\n-  c_this->mmio = pci_config_read(pci_addr) & ~0xFFF;\n+  pci_addr.reg_off = bar;\n+\n+  /* The BAR value is masked to clear non-address bits. */\n+  if (bar == PCI_CONFIG_REG_BAR0 || bar == PCI_CONFIG_REG_BAR1)","path":"cpu/x86/drivers/legacy_pc/pci.c","position":59,"original_position":59,"commit_id":"c305963492aba6cc15dca981f4d96739d6fe5d0c","original_commit_id":"c305963492aba6cc15dca981f4d96739d6fe5d0c","user":{"login":"ricardotk","id":3178975,"avatar_url":"https://avatars.githubusercontent.com/u/3178975?v=3","gravatar_id":"","url":"https://api.github.com/users/ricardotk","html_url":"https://github.com/ricardotk","followers_url":"https://api.github.com/users/ricardotk/followers","following_url":"https://api.github.com/users/ricardotk/following{/other_user}","gists_url":"https://api.github.com/users/ricardotk/gists{/gist_id}","starred_url":"https://api.github.com/users/ricardotk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ricardotk/subscriptions","organizations_url":"https://api.github.com/users/ricardotk/orgs","repos_url":"https://api.github.com/users/ricardotk/repos","events_url":"https://api.github.com/users/ricardotk/events{/privacy}","received_events_url":"https://api.github.com/users/ricardotk/received_events","type":"User","site_admin":false},"body":"ACK, thanks!","created_at":"2015-09-25T18:29:06Z","updated_at":"2015-09-25T18:29:06Z","html_url":"https://github.com/otcshare/contiki-x86/pull/3#discussion_r40460964","pull_request_url":"https://api.github.com/repos/otcshare/contiki-x86/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/otcshare/contiki-x86/pulls/comments/40460964"},"html":{"href":"https://github.com/otcshare/contiki-x86/pull/3#discussion_r40460964"},"pull_request":{"href":"https://api.github.com/repos/otcshare/contiki-x86/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/otcshare/contiki-x86/pulls/3","id":45929212,"html_url":"https://github.com/otcshare/contiki-x86/pull/3","diff_url":"https://github.com/otcshare/contiki-x86/pull/3.diff","patch_url":"https://github.com/otcshare/contiki-x86/pull/3.patch","issue_url":"https://api.github.com/repos/otcshare/contiki-x86/issues/3","number":3,"state":"closed","locked":false,"title":"Add Intel Quark X1000 GPIO Controller (non-legacy) support","user":{"login":"ricardotk","id":3178975,"avatar_url":"https://avatars.githubusercontent.com/u/3178975?v=3","gravatar_id":"","url":"https://api.github.com/users/ricardotk","html_url":"https://github.com/ricardotk","followers_url":"https://api.github.com/users/ricardotk/followers","following_url":"https://api.github.com/users/ricardotk/following{/other_user}","gists_url":"https://api.github.com/users/ricardotk/gists{/gist_id}","starred_url":"https://api.github.com/users/ricardotk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ricardotk/subscriptions","organizations_url":"https://api.github.com/users/ricardotk/orgs","repos_url":"https://api.github.com/users/ricardotk/repos","events_url":"https://api.github.com/users/ricardotk/events{/privacy}","received_events_url":"https://api.github.com/users/ricardotk/received_events","type":"User","site_admin":false},"body":"This patch adds files which support access to GPIO Controller\r\n(non-legacy) configuration register through a function interface.\r\n\r\nIt doesn't add interrupt support due to pinmux reasons. On\r\nGalileo Gen 2 we need to configure a pin as input/interrupt\r\nusing pinmux and this can only be achieved through I2C. There's\r\none pin exported by default as GPIO output and we used this one\r\nto test this driver.\r\n\r\nIn the future, we plan to add an I2C driver and a pinmux configuration\r\ndriver in order to solve this kind of problems.","created_at":"2015-09-24T18:03:16Z","updated_at":"2015-09-25T18:29:06Z","closed_at":"2015-09-25T15:03:15Z","merged_at":null,"merge_commit_sha":"eacef6f7fcbe2526d8f662697089b5512fbc24b6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/otcshare/contiki-x86/pulls/3/commits","review_comments_url":"https://api.github.com/repos/otcshare/contiki-x86/pulls/3/comments","review_comment_url":"https://api.github.com/repos/otcshare/contiki-x86/pulls/comments{/number}","comments_url":"https://api.github.com/repos/otcshare/contiki-x86/issues/3/comments","statuses_url":"https://api.github.com/repos/otcshare/contiki-x86/statuses/c305963492aba6cc15dca981f4d96739d6fe5d0c","head":{"label":"ricardotk:x86-gpio","ref":"x86-gpio","sha":"c305963492aba6cc15dca981f4d96739d6fe5d0c","user":{"login":"ricardotk","id":3178975,"avatar_url":"https://avatars.githubusercontent.com/u/3178975?v=3","gravatar_id":"","url":"https://api.github.com/users/ricardotk","html_url":"https://github.com/ricardotk","followers_url":"https://api.github.com/users/ricardotk/followers","following_url":"https://api.github.com/users/ricardotk/following{/other_user}","gists_url":"https://api.github.com/users/ricardotk/gists{/gist_id}","starred_url":"https://api.github.com/users/ricardotk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ricardotk/subscriptions","organizations_url":"https://api.github.com/users/ricardotk/orgs","repos_url":"https://api.github.com/users/ricardotk/repos","events_url":"https://api.github.com/users/ricardotk/events{/privacy}","received_events_url":"https://api.github.com/users/ricardotk/received_events","type":"User","site_admin":false},"repo":{"id":42539475,"name":"contiki-x86","full_name":"ricardotk/contiki-x86","owner":{"login":"ricardotk","id":3178975,"avatar_url":"https://avatars.githubusercontent.com/u/3178975?v=3","gravatar_id":"","url":"https://api.github.com/users/ricardotk","html_url":"https://github.com/ricardotk","followers_url":"https://api.github.com/users/ricardotk/followers","following_url":"https://api.github.com/users/ricardotk/following{/other_user}","gists_url":"https://api.github.com/users/ricardotk/gists{/gist_id}","starred_url":"https://api.github.com/users/ricardotk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ricardotk/subscriptions","organizations_url":"https://api.github.com/users/ricardotk/orgs","repos_url":"https://api.github.com/users/ricardotk/repos","events_url":"https://api.github.com/users/ricardotk/events{/privacy}","received_events_url":"https://api.github.com/users/ricardotk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ricardotk/contiki-x86","description":"The official git repository for Contiki, the open source OS for the Internet of Things","fork":true,"url":"https://api.github.com/repos/ricardotk/contiki-x86","forks_url":"https://api.github.com/repos/ricardotk/contiki-x86/forks","keys_url":"https://api.github.com/repos/ricardotk/contiki-x86/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ricardotk/contiki-x86/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ricardotk/contiki-x86/teams","hooks_url":"https://api.github.com/repos/ricardotk/contiki-x86/hooks","issue_events_url":"https://api.github.com/repos/ricardotk/contiki-x86/issues/events{/number}","events_url":"https://api.github.com/repos/ricardotk/contiki-x86/events","assignees_url":"https://api.github.com/repos/ricardotk/contiki-x86/assignees{/user}","branches_url":"https://api.github.com/repos/ricardotk/contiki-x86/branches{/branch}","tags_url":"https://api.github.com/repos/ricardotk/contiki-x86/tags","blobs_url":"https://api.github.com/repos/ricardotk/contiki-x86/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ricardotk/contiki-x86/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ricardotk/contiki-x86/git/refs{/sha}","trees_url":"https://api.github.com/repos/ricardotk/contiki-x86/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ricardotk/contiki-x86/statuses/{sha}","languages_url":"https://api.github.com/repos/ricardotk/contiki-x86/languages","stargazers_url":"https://api.github.com/repos/ricardotk/contiki-x86/stargazers","contributors_url":"https://api.github.com/repos/ricardotk/contiki-x86/contributors","subscribers_url":"https://api.github.com/repos/ricardotk/contiki-x86/subscribers","subscription_url":"https://api.github.com/repos/ricardotk/contiki-x86/subscription","commits_url":"https://api.github.com/repos/ricardotk/contiki-x86/commits{/sha}","git_commits_url":"https://api.github.com/repos/ricardotk/contiki-x86/git/commits{/sha}","comments_url":"https://api.github.com/repos/ricardotk/contiki-x86/comments{/number}","issue_comment_url":"https://api.github.com/repos/ricardotk/contiki-x86/issues/comments{/number}","contents_url":"https://api.github.com/repos/ricardotk/contiki-x86/contents/{+path}","compare_url":"https://api.github.com/repos/ricardotk/contiki-x86/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ricardotk/contiki-x86/merges","archive_url":"https://api.github.com/repos/ricardotk/contiki-x86/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ricardotk/contiki-x86/downloads","issues_url":"https://api.github.com/repos/ricardotk/contiki-x86/issues{/number}","pulls_url":"https://api.github.com/repos/ricardotk/contiki-x86/pulls{/number}","milestones_url":"https://api.github.com/repos/ricardotk/contiki-x86/milestones{/number}","notifications_url":"https://api.github.com/repos/ricardotk/contiki-x86/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ricardotk/contiki-x86/labels{/name}","releases_url":"https://api.github.com/repos/ricardotk/contiki-x86/releases{/id}","created_at":"2015-09-15T18:48:07Z","updated_at":"2015-09-15T18:48:18Z","pushed_at":"2015-09-25T14:51:44Z","git_url":"git://github.com/ricardotk/contiki-x86.git","ssh_url":"git@github.com:ricardotk/contiki-x86.git","clone_url":"https://github.com/ricardotk/contiki-x86.git","svn_url":"https://github.com/ricardotk/contiki-x86","homepage":"http://www.contiki-os.org/","size":62619,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"otcshare:x86","ref":"x86","sha":"e4982aa416e8dd4351644eb0c4e293304525185d","user":{"login":"otcshare","id":587360,"avatar_url":"https://avatars.githubusercontent.com/u/587360?v=3","gravatar_id":"","url":"https://api.github.com/users/otcshare","html_url":"https://github.com/otcshare","followers_url":"https://api.github.com/users/otcshare/followers","following_url":"https://api.github.com/users/otcshare/following{/other_user}","gists_url":"https://api.github.com/users/otcshare/gists{/gist_id}","starred_url":"https://api.github.com/users/otcshare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otcshare/subscriptions","organizations_url":"https://api.github.com/users/otcshare/orgs","repos_url":"https://api.github.com/users/otcshare/repos","events_url":"https://api.github.com/users/otcshare/events{/privacy}","received_events_url":"https://api.github.com/users/otcshare/received_events","type":"Organization","site_admin":false},"repo":{"id":40901838,"name":"contiki-x86","full_name":"otcshare/contiki-x86","owner":{"login":"otcshare","id":587360,"avatar_url":"https://avatars.githubusercontent.com/u/587360?v=3","gravatar_id":"","url":"https://api.github.com/users/otcshare","html_url":"https://github.com/otcshare","followers_url":"https://api.github.com/users/otcshare/followers","following_url":"https://api.github.com/users/otcshare/following{/other_user}","gists_url":"https://api.github.com/users/otcshare/gists{/gist_id}","starred_url":"https://api.github.com/users/otcshare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otcshare/subscriptions","organizations_url":"https://api.github.com/users/otcshare/orgs","repos_url":"https://api.github.com/users/otcshare/repos","events_url":"https://api.github.com/users/otcshare/events{/privacy}","received_events_url":"https://api.github.com/users/otcshare/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/otcshare/contiki-x86","description":"The official git repository for Contiki, the open source OS for the Internet of Things","fork":true,"url":"https://api.github.com/repos/otcshare/contiki-x86","forks_url":"https://api.github.com/repos/otcshare/contiki-x86/forks","keys_url":"https://api.github.com/repos/otcshare/contiki-x86/keys{/key_id}","collaborators_url":"https://api.github.com/repos/otcshare/contiki-x86/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/otcshare/contiki-x86/teams","hooks_url":"https://api.github.com/repos/otcshare/contiki-x86/hooks","issue_events_url":"https://api.github.com/repos/otcshare/contiki-x86/issues/events{/number}","events_url":"https://api.github.com/repos/otcshare/contiki-x86/events","assignees_url":"https://api.github.com/repos/otcshare/contiki-x86/assignees{/user}","branches_url":"https://api.github.com/repos/otcshare/contiki-x86/branches{/branch}","tags_url":"https://api.github.com/repos/otcshare/contiki-x86/tags","blobs_url":"https://api.github.com/repos/otcshare/contiki-x86/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/otcshare/contiki-x86/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/otcshare/contiki-x86/git/refs{/sha}","trees_url":"https://api.github.com/repos/otcshare/contiki-x86/git/trees{/sha}","statuses_url":"https://api.github.com/repos/otcshare/contiki-x86/statuses/{sha}","languages_url":"https://api.github.com/repos/otcshare/contiki-x86/languages","stargazers_url":"https://api.github.com/repos/otcshare/contiki-x86/stargazers","contributors_url":"https://api.github.com/repos/otcshare/contiki-x86/contributors","subscribers_url":"https://api.github.com/repos/otcshare/contiki-x86/subscribers","subscription_url":"https://api.github.com/repos/otcshare/contiki-x86/subscription","commits_url":"https://api.github.com/repos/otcshare/contiki-x86/commits{/sha}","git_commits_url":"https://api.github.com/repos/otcshare/contiki-x86/git/commits{/sha}","comments_url":"https://api.github.com/repos/otcshare/contiki-x86/comments{/number}","issue_comment_url":"https://api.github.com/repos/otcshare/contiki-x86/issues/comments{/number}","contents_url":"https://api.github.com/repos/otcshare/contiki-x86/contents/{+path}","compare_url":"https://api.github.com/repos/otcshare/contiki-x86/compare/{base}...{head}","merges_url":"https://api.github.com/repos/otcshare/contiki-x86/merges","archive_url":"https://api.github.com/repos/otcshare/contiki-x86/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/otcshare/contiki-x86/downloads","issues_url":"https://api.github.com/repos/otcshare/contiki-x86/issues{/number}","pulls_url":"https://api.github.com/repos/otcshare/contiki-x86/pulls{/number}","milestones_url":"https://api.github.com/repos/otcshare/contiki-x86/milestones{/number}","notifications_url":"https://api.github.com/repos/otcshare/contiki-x86/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/otcshare/contiki-x86/labels{/name}","releases_url":"https://api.github.com/repos/otcshare/contiki-x86/releases{/id}","created_at":"2015-08-17T14:34:26Z","updated_at":"2015-09-25T16:43:44Z","pushed_at":"2015-09-25T15:02:33Z","git_url":"git://github.com/otcshare/contiki-x86.git","ssh_url":"git@github.com:otcshare/contiki-x86.git","clone_url":"https://github.com/otcshare/contiki-x86.git","svn_url":"https://github.com/otcshare/contiki-x86","homepage":"http://www.contiki-os.org/","size":62639,"stargazers_count":1,"watchers_count":1,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":9,"forks":2,"open_issues":9,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/otcshare/contiki-x86/pulls/3"},"html":{"href":"https://github.com/otcshare/contiki-x86/pull/3"},"issue":{"href":"https://api.github.com/repos/otcshare/contiki-x86/issues/3"},"comments":{"href":"https://api.github.com/repos/otcshare/contiki-x86/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/otcshare/contiki-x86/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/otcshare/contiki-x86/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/otcshare/contiki-x86/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/otcshare/contiki-x86/statuses/c305963492aba6cc15dca981f4d96739d6fe5d0c"}}}}